|
@@ -424,6 +424,8 @@
|
|
|
}, delay);
|
|
|
};
|
|
|
}
|
|
|
+ let webSocketWorker = null
|
|
|
+ let getResidueTimeBool = true
|
|
|
// 判断是否是苹果手机
|
|
|
let isiPhone = /(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent);
|
|
|
// 判断是否支持webRTC
|
|
@@ -449,13 +451,13 @@
|
|
|
$('.weui-mask_transparent').show();
|
|
|
$('.weui-toast').show();
|
|
|
if(bool) {
|
|
|
- engine.disconnect();
|
|
|
+ engine && engine.disconnect();
|
|
|
}
|
|
|
|
|
|
- wsss.close();
|
|
|
+ wsss && wsss.close();
|
|
|
// decodeWoker.postMessage('close');
|
|
|
// decodeWoker.terminate();
|
|
|
- webSocketWorker.postMessage('close');
|
|
|
+ webSocketWorker && webSocketWorker.postMessage('close');
|
|
|
connect();
|
|
|
},
|
|
|
2000,
|
|
@@ -463,11 +465,14 @@
|
|
|
);
|
|
|
window.addEventListener('message', function (e) {
|
|
|
let data = e.data;
|
|
|
- let bool = data.bool && isVideo && !$('#playCanvas').is(':visible') && !isShowiPhoneWebRTC
|
|
|
- if (bool) {
|
|
|
+ let bool = isVideo && !$('#playCanvas').is(':visible') && !isShowiPhoneWebRTC
|
|
|
+ if(data.bool) {
|
|
|
+ getResidueTimeBool = true
|
|
|
+ if (bool) {
|
|
|
document.getElementById('playVideo').play();
|
|
|
}
|
|
|
- debounceSwitchingScreens(bool);
|
|
|
+ debounceSwitchingScreens(bool);
|
|
|
+ }
|
|
|
});
|
|
|
// 开发环境
|
|
|
var isDev =
|
|
@@ -658,10 +663,10 @@
|
|
|
async: false,
|
|
|
success: function (res) {
|
|
|
if (res.status === 0) {
|
|
|
- //getResidueTime()
|
|
|
- if(connectStatus==1) {
|
|
|
- getResidueTime();
|
|
|
- }
|
|
|
+ // getResidueTime()
|
|
|
+ // if(connectStatus==1) {
|
|
|
+ // getResidueTime();
|
|
|
+ // }
|
|
|
if (timerInterval) {
|
|
|
timerInterval = clearTimeout();
|
|
|
}
|
|
@@ -1277,6 +1282,11 @@
|
|
|
logicWidth * logicHeight,
|
|
|
(logicWidth / 2) * (logicHeight / 2),
|
|
|
);
|
|
|
+ if(getResidueTimeBool) {
|
|
|
+ // 如果是计时卡的话就上报
|
|
|
+ getResidueTime()
|
|
|
+ getResidueTimeBool = false
|
|
|
+ }
|
|
|
$('.weui-mask_transparent').hide();
|
|
|
$('.weui-toast').hide();
|
|
|
$('.loading').hide();
|
|
@@ -1384,7 +1394,7 @@
|
|
|
// 启动视频流连接过程。这将根据之前配置的参数建立与服务器的 WebSocket 连接,并开始视频流的传输和播放。
|
|
|
engine.connect();
|
|
|
}
|
|
|
- var webSocketWorker = new Worker(
|
|
|
+ webSocketWorker = new Worker(
|
|
|
'websocket.js?socketURL=' +
|
|
|
encodeURIComponent(socketURL) +
|
|
|
'&cardToken=' +
|
|
@@ -1969,11 +1979,11 @@
|
|
|
});
|
|
|
}
|
|
|
function quit() {
|
|
|
- engine.disconnect();
|
|
|
- wsss.close();
|
|
|
- decodeWoker.postMessage('close');
|
|
|
- decodeWoker.terminate();
|
|
|
- webSocketWorker.postMessage('close');
|
|
|
+ engine && engine.disconnect();
|
|
|
+ wsss&&wsss.close();
|
|
|
+ decodeWoker&&decodeWoker.postMessage('close');
|
|
|
+ decodeWoker&&decodeWoker.terminate();
|
|
|
+ webSocketWorker && webSocketWorker.postMessage('close');
|
|
|
if (navigator.userAgent.toLowerCase().includes('toutiaomicroapp')) {
|
|
|
tt.miniProgram.switchTab({
|
|
|
url: '/pages/home/home',
|