FIX: stop video when not visible

Change-Id: Ibc5204084efec5381a7ede9face0519276592aa8
This commit is contained in:
chunmao.guo 2022-08-31 17:15:34 +08:00 committed by Lane.Wei
parent 08c9385383
commit 4601022aaa
3 changed files with 15 additions and 3 deletions

View file

@ -146,9 +146,10 @@ MediaFilePanel::MediaFilePanel(wxWindow * parent)
m_button_delete->Bind(wxEVT_COMMAND_BUTTON_CLICKED, [this](auto &e) { m_image_grid->DoActionOnSelection(0); });
auto onShowHide = [this](auto &e) {
e.Skip();
if (m_isBeingDeleted) return;
auto fs = m_image_grid ? m_image_grid->GetFileSystem() : nullptr;
if (fs) e.IsShown() && IsShown() ? fs->Start() : fs->Stop();
if (fs) IsShownOnScreen() ? fs->Start() : fs->Stop();
};
Bind(wxEVT_SHOW, onShowHide);
parent->GetParent()->Bind(wxEVT_SHOW, onShowHide);