FIX: not keep restarting video on local error

Change-Id: I2f79208326f92931bec108a4609088788ceca998
This commit is contained in:
chunmao.guo 2022-09-07 14:03:53 +08:00 committed by Lane.Wei
parent 288913cc4b
commit b2b2bc2a9c
3 changed files with 18 additions and 5 deletions

View File

@ -135,6 +135,8 @@ void MediaPlayCtrl::Stop()
m_cond.notify_all();
m_last_state = MEDIASTATE_IDLE;
SetStatus(_L("Stopped."));
if (m_failed_code >= 100) // not keep retry on local error
m_next_retry = wxDateTime();
}
++m_failed_retry;
if (m_next_retry.IsValid())

View File

@ -746,7 +746,7 @@ void PrinterFileSystem::Reconnect(boost::unique_lock<boost::mutex> &l, int resul
std::string url = m_messages.front();
m_messages.clear();
if (url.empty()) {
m_last_error = -100;
m_last_error = 1;
} else {
l.unlock();
m_status = Status::Connecting;

View File

@ -46,21 +46,32 @@ void wxMediaCtrl2::Load(wxURI url)
return;
}
{
wxRegKey key(wxRegKey::HKCR, "CLSID\\{233E64FB-2041-4A6C-AFAB-FF9BCF83E7AA}\\InProcServer32");
wxString path = key.QueryDefaultValue();
wxRegKey key1(wxRegKey::HKCR, "CLSID\\{233E64FB-2041-4A6C-AFAB-FF9BCF83E7AA}\\InProcServer32");
wxString path = key1.QueryDefaultValue();
wxRegKey key2(wxRegKey::HKCR, "bambu");
wxString clsid;
key2.QueryRawValue("Source Filter", clsid);
if (!wxFile::Exists(path) || clsid != L"{233E64FB-2041-4A6C-AFAB-FF9BCF83E7AA}") {
wxMessageBox(_L("Missing BambuSource component registered for media playing! Please re-install BambuStutio or seek after-sales help."), _L("Error"),
Slic3r::GUI::wxGetApp().CallAfter([] {
wxMessageBox(_L("Missing BambuSource component registered for media playing! Please re-install BambuStutio or seek after-sales help."), _L("Error"),
wxOK);
m_error = 3;
});
m_error = clsid.IsEmpty() ? 100 : clsid != L"{233E64FB-2041-4A6C-AFAB-FF9BCF83E7AA}" ? 101 : 102;
wxMediaEvent event(wxEVT_MEDIA_STATECHANGED);
event.SetId(GetId());
event.SetEventObject(this);
wxPostEvent(this, event);
return;
}
wxRegKey keyWmp(wxRegKey::HKCU, "SOFTWARE\\Microsoft\\MediaPlayer\\Player\\Extensions\\.");
keyWmp.Create();
long permissions = 0;
if (keyWmp.HasValue("Permissions"))
keyWmp.QueryValue("Permissions", &permissions);
if ((permissions & 32) == 0) {
permissions |= 32;
keyWmp.SetValue("Permissions", permissions);
}
}
url = wxURI(url.BuildURI().append("&hwnd=").append(
boost::lexical_cast<std::string>(GetHandle())));