From 84a4622fdfc6836fb1197abb3f43b20f967bb514 Mon Sep 17 00:00:00 2001 From: "chunmao.guo" Date: Mon, 17 Oct 2022 09:55:18 +0800 Subject: [PATCH] FIX: Media playing state & detect play end Change-Id: I378da3f104120110b8032a355a22a89ebe69a0fb --- src/slic3r/GUI/MediaPlayCtrl.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/slic3r/GUI/MediaPlayCtrl.cpp b/src/slic3r/GUI/MediaPlayCtrl.cpp index f36cf414f..0df1b9fca 100644 --- a/src/slic3r/GUI/MediaPlayCtrl.cpp +++ b/src/slic3r/GUI/MediaPlayCtrl.cpp @@ -193,7 +193,10 @@ void MediaPlayCtrl::Stop() m_tasks.push_back(""); m_cond.notify_all(); m_last_state = MEDIASTATE_IDLE; - SetStatus(_L("Stopped."), false); + if (m_failed_code) + SetStatus(_L("Stopped [%d]!"), true); + else + SetStatus(_L("Stopped."), false); if (m_failed_code >= 100) // not keep retry on local error m_next_retry = wxDateTime(); } @@ -286,6 +289,7 @@ void MediaPlayCtrl::onStateChanged(wxMediaEvent& event) } if ((last_state == wxMEDIASTATE_PAUSED || last_state == wxMEDIASTATE_PLAYING) && state == wxMEDIASTATE_STOPPED) { + m_failed_code = m_media_ctrl->GetLastError(); Stop(); return; } @@ -306,9 +310,9 @@ void MediaPlayCtrl::onStateChanged(wxMediaEvent& event) if (m_failed_code == 0) m_failed_code = 2; SetStatus(_L("Load failed [%d]!")); - } else { - m_last_state = last_state; } + } else { + m_last_state = state; } }