mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-08 23:46:24 -06:00
FIX: stop video when not visible
Change-Id: Ibc5204084efec5381a7ede9face0519276592aa8
This commit is contained in:
parent
08c9385383
commit
4601022aaa
3 changed files with 15 additions and 3 deletions
|
@ -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)!"));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue