FIX: stop video when not visible

Change-Id: Ibc5204084efec5381a7ede9face0519276592aa8
This commit is contained in:
chunmao.guo authored and Lane.Wei committed 2022-09-02 13:16:54 +08:00
1 parent 08c9385383
commit 4601022aaa
3 files changed
+15 -3

No files matched your search

+12
View File
@@ -40,6 +40,14 @@ MediaPlayCtrl::MediaPlayCtrl(wxWindow *parent, wxMediaCtrl2 *media_ctrl, const w
#if BBL_RELEASE_TO_PUBLIC
m_next_retry = wxDateTime::Now();
#endif
auto onShowHide = [this](auto &e) {
e.Skip();
if (m_isBeingDeleted) return;
IsShownOnScreen() ? Play() : Stop();
};
parent->Bind(wxEVT_SHOW, onShowHide);
parent->GetParent()->GetParent()->Bind(wxEVT_SHOW, onShowHide);
}
MediaPlayCtrl::~MediaPlayCtrl()
@@ -72,6 +80,10 @@ void MediaPlayCtrl::SetMachineObject(MachineObject* obj)
void MediaPlayCtrl::Play()
{
if (!m_next_retry.IsValid())
return;
if (!IsShownOnScreen())
return;
if (m_machine.empty()) {
Stop();
SetStatus(_L("Initialize failed (No Device)!"));