FIX: media error message

Change-Id: I6fb9879b03fee6fab3b0aa2123cfe67c9b5916dc
This commit is contained in:
chunmao.guo 2023-06-14 10:00:56 +08:00 committed by Lane.Wei
parent 11fb7fb89f
commit ac4f641222
5 changed files with 14 additions and 12 deletions

View file

@ -1376,10 +1376,10 @@ void MachineObject::parse_version_func()
is_support_remote_tunnel = true;
is_support_tunnel_mqtt = (ota_version->second.sw_ver.compare("01.04.01.04") >= 0
|| (rv1126_version != module_vers.end() && rv1126_version->second.sw_ver.compare("00.00.20.30") >= 0));
local_camera_proto = (local_rtsp_url.empty() || local_rtsp_url == "disable") ? 0
: boost::algorithm::starts_with(local_rtsp_url, "rtsps") ? 2 : 3;
file_proto = 2;
}
local_camera_proto = local_rtsp_url.empty() ? -1 : local_rtsp_url == "disable" ? 0
: boost::algorithm::starts_with(local_rtsp_url, "rtsps") ? 2 : 3;
file_proto = 2;
}
} else if (printer_type == "C11") {
is_cloud_print_only = true;

View file

@ -697,7 +697,7 @@ public:
std::string camera_resolution = "";
bool xcam_first_layer_inspector { false };
int xcam_first_layer_hold_count = 0;
int local_camera_proto = 0;
int local_camera_proto = -1;
int file_proto = 0;
std::string local_rtsp_url;
std::string tutk_state;

View file

@ -89,7 +89,7 @@ void MediaPlayCtrl::SetMachineObject(MachineObject* obj)
} else {
m_camera_exists = false;
m_lan_mode = false;
m_lan_proto = 0;
m_lan_proto = -1;
m_lan_ip.clear();
m_lan_passwd.clear();
m_tutk_state.clear();
@ -154,7 +154,7 @@ void MediaPlayCtrl::Play()
NetworkAgent *agent = wxGetApp().getAgent();
std::string agent_version = agent ? agent->get_version() : "";
if (m_lan_proto && (m_lan_mode ||!m_remote_support) && !m_disable_lan && !m_lan_ip.empty()) {
if (m_lan_proto > 0 && (m_lan_mode ||!m_remote_support) && !m_disable_lan && !m_lan_ip.empty()) {
m_disable_lan = m_remote_support && !m_lan_mode; // try remote next time
if (m_lan_proto == 1)
m_url = "bambu:///local/" + m_lan_ip + ".?port=6000&user=" + m_lan_user + "&passwd=" + m_lan_passwd + "&device=" + m_machine + "&version=" + agent_version;
@ -185,16 +185,16 @@ void MediaPlayCtrl::Play()
m_failed_code = 1;
if (m_lan_mode) {
Stop(m_lan_passwd.empty()
? _L("Initialize failed (Not supported with LAN-only mode)!")
: _L("Initialize failed (Not accessible in LAN-only mode)!"));
Stop(m_lan_proto < 0
? _L("Initialize failed (Not supported on the current printer version)!")
: _L("Initialize failed (Not accessible in LAN-only mode)!"));
return;
}
if (!m_remote_support) { // not support tutk
Stop(m_lan_ip.empty()
? _L("Initialize failed (Missing LAN ip of printer)!")
: _L("Initialize failed (Not supported on the current printer version)!"));
: wxString());
return;
}
@ -284,7 +284,7 @@ void MediaPlayCtrl::Stop(wxString const &msg)
m_url.clear();
++m_failed_retry;
if (m_failed_code != 0 && (!m_remote_support || m_lan_mode) && (m_failed_retry > 1 || m_user_triggered)) {
if (m_failed_code != 0 && last_state != wxMEDIASTATE_PLAYING && (!m_remote_support || m_lan_mode) && (m_failed_retry > 1 || m_user_triggered)) {
m_next_retry = wxDateTime(); // stop retry
if (wxGetApp().show_modal_ip_address_enter_dialog(_L("LAN Connection Failed (Failed to start liveview)"))) {
m_failed_retry = 0;

View file

@ -31,7 +31,8 @@ wxDEFINE_EVENT(EVT_FILE_CALLBACK, wxCommandEvent);
static wxBitmap default_thumbnail;
static std::map<int, std::string> error_messages = {
{PrinterFileSystem::FILE_TYPE_ERR, L("Not supported on the current printer version.")}
{PrinterFileSystem::FILE_TYPE_ERR, L("Not supported on the current printer version.")},
{PrinterFileSystem::STORAGE_UNAVAILABLE, L("Storage unavailable, insert SD card.")}
};
struct StaticBambuLib : BambuLib {

View file

@ -51,6 +51,7 @@ public:
FILE_READ_ERR = 14,
FILE_CHECK_ERR = 15,
FILE_TYPE_ERR = 16,
STORAGE_UNAVAILABLE = 17,
};