瀏覽代碼

Merge branch 'dev5.7.3' of Software/android-cloud-H5 into master

guocanfeng 1 年之前
父節點
當前提交
c856dc7677

+ 6 - 1
static/webRtcYJ/WXdraw.js

@@ -60,7 +60,12 @@ function doConnectDirectives() {
     clearInterval(intervalerPing)
     // 获取虚拟场景状态
     intervalerPing = setInterval(() => {
-      wsss.send('ping');
+      if (wsss.readyState === 1) {
+        wsss.send('ping');
+      } else {
+        clearInterval(intervalerPing);
+      }
+      
     }, 3000)
     errorTime = 0;
     var pings = { type: 'getVsStatus' };

+ 23 - 5
static/webRtcYJ/WXtrialInterface.html

@@ -1336,7 +1336,7 @@
         $('#playVideo').show();
         $('#playCanvas').hide();
       }
-      let extranetIp, extranetPort;
+      let extranetIp, extranetPort, connectClearSetInterval, numberOfTimes = 1;
       function doConnectBusiness(res) {
         if (isVideo && !isShowiPhoneWebRTC) {
           var url0 = url[0]; //协议
@@ -1363,7 +1363,7 @@
               ip +
               ':' +
               port +
-              '/index/api/webrtc?app=live&stream=test&type=play';
+              '/index/api/webrtc?app=live&stream=h264&type=play';
             wsUrl = 'ws://' + ip + ':' + port + '/plugflow';
           }
           let token = res.data.cardToken;
@@ -1424,7 +1424,25 @@
                 var checkBuffer = GetScreenState();
                 webSocketWorker.postMessage(checkBuffer);
               } else {
-                connect('update');
+               // connect('update');
+              clearInterval(connectClearSetInterval)
+              connectClearSetInterval = setInterval(() => {
+                if(numberOfTimes >= 6) {
+                  quit();
+                  clearInterval(connectClearSetInterval)
+                  return 
+                }
+                numberOfTimes++
+                engine && engine.disconnect();
+                wsss&&wsss.close();
+                webSocketWorker && webSocketWorker.postMessage('endRequest');
+                decodeWoker&&decodeWoker.postMessage('close');
+                decodeWoker&&decodeWoker.terminate();
+                webSocketWorker && webSocketWorker.postMessage('close');
+                setTimeout(() => {
+                  connect('update');
+                })
+              })
               }
             }
             if (input[23] == 0x05) {
@@ -1984,13 +2002,13 @@
           wsss&&wsss.close();
           decodeWoker&&decodeWoker.postMessage('close');
           decodeWoker&&decodeWoker.terminate();
+          // 如果是指令请求失败或者直接退出,都要发送消息给视频流js文件,告知视频流请求失败情况不再做退出操作
+          webSocketWorker && webSocketWorker.postMessage('endRequest');
           webSocketWorker && webSocketWorker.postMessage('close');
           if(!quitBool) {
               return 
           }
           quitBool = false
-          // 如果是指令请求失败或者直接退出,都要发送消息给视频流js文件,告知视频流请求失败情况不再做退出操作
-          webSocketWorker && webSocketWorker.postMessage('endRequest');
         if (navigator.userAgent.toLowerCase().includes('toutiaomicroapp')) {
           tt.miniProgram.switchTab({
             url: '/pages/home/home',

+ 1 - 1
static/webRtcYJ/css/WXtrialInterface.css

@@ -184,7 +184,7 @@ html {
   top: 0;
   opacity: 0.8;
   bottom: 50px;
-  z-index: 2;
+  z-index: 1500;
   transition: all 0.2s ease-in;
   display: flex;
   flex-direction: column;

+ 9 - 1
static/webRtcYJ/timer.js

@@ -27,7 +27,15 @@ function handleQuit(action = "quit") {
     case 'quit':
       return exit();
     case 'dormant':
-      return downline();
+      $.confirm({
+        title: '提示',
+        text: '确定退出云手机并下机',
+        onOK: function () {
+          //点击确认
+          downline();
+        },
+      });
+    // return 
   }
 }
 

+ 2 - 2
static/webRtcYJ/websocket.js

@@ -20,7 +20,7 @@ doConnect();
 //   };
 // }
 let timeInterval = 1
-let quitBool = false
+let quitBool = true
 function doConnect() {
   var ws = new WebSocket(socketURL);
   ws.binaryType = 'arraybuffer';
@@ -35,7 +35,7 @@ function doConnect() {
   ws.onerror = function () {
     // ws.close(1006);
     clearInterval(intervaler);
-    if (quitBool) return
+    if (!quitBool) return
     if (timeInterval > 7) return self.postMessage('close');
     timeInterval++
     doConnect()