huangxiaojing před 3 roky
rodič
revize
8084ef2e14

+ 30 - 18
screenAndroid/WXdraw.js

@@ -68,7 +68,21 @@ function doConnect() {
     wsss.close();
     throttle(doConnect, 100);
     if (errorTime > 1000) {
-      quit();
+      if (navigator.userAgent.toLowerCase().includes('toutiaomicroapp')) {
+        tt.miniProgram.switchTab({
+          url: '/pages/home/home'
+        })
+      } else if (window.__wxjs_environment === 'miniprogram') {
+        wx.miniProgram.switchTab({
+          url: '/pages/home/home'
+        })
+      } else {
+        document.addEventListener('UniAppJSBridgeReady', function () {
+          uni.webView.navigateTo({
+            url: '/pages/index/index'
+          });
+        })
+      }
     }
   };
   wsss.onmessage = function (res) {
@@ -90,7 +104,21 @@ function doConnect() {
           }, function () {
             isControl = false;
             //点击取消后的回调函数
-            quit();
+            if (navigator.userAgent.toLowerCase().includes('toutiaomicroapp')) {
+              tt.miniProgram.switchTab({
+                url: '/pages/home/home'
+              })
+            } else if (window.__wxjs_environment === 'miniprogram') {
+              wx.miniProgram.switchTab({
+                url: '/pages/home/home'
+              })
+            } else {
+              document.addEventListener('UniAppJSBridgeReady', function () {
+                uni.webView.navigateTo({
+                  url: '/pages/index/index'
+                });
+              })
+            }
           });
         } else {
           $.confirm("当前云手机正在授控,是否请求获取云手机控制权?", function () {
@@ -152,22 +180,6 @@ $(".PictureQuality").on("click", function () {
   var id = $(this).attr("data-id")
   var buffer = makeSharpness(Number(id));
   ws.send(buffer);
-  isFeed = false;
-  isAudioPlay = false;
-  $('.weui-mask_transparent').show();
-  $('.weui-toast').show();
-  if (jmuxer) {
-    jmuxer.destroy();
-  }
-  jmuxer = new JMuxer({
-    node: 'playerVideo',
-    flushingTime: 33,
-    fps: 30,
-    mode: 'video',
-    debug: false
-  });
-  myVideo.play();
-  isWaitSps = true;
 })
 //画图形
 var draw_graph = function (graphType, obj) {

+ 109 - 31
screenAndroid/WXtrialInterface.html

@@ -35,7 +35,9 @@
   <link rel="stylesheet" href="https://cdn.bootcss.com/weui/1.1.3/style/weui.min.css" />
   <link rel="stylesheet" href="https://cdn.bootcss.com/jquery-weui/1.2.1/css/jquery-weui.min.css" />
   <style>
-    .try-use-wrap, .buy-phone-wrap, .look-wrap {
+    .try-use-wrap,
+    .buy-phone-wrap,
+    .look-wrap {
       width: 100%;
       height: 100%;
       position: fixed;
@@ -299,7 +301,6 @@
     var isVisuable = true;
     var isFeed = true;
     var isFinish = false;
-    var isWaitSps = false;
     var myVideo = document.getElementById("playerVideo");
     Module = {};
     Module.onRuntimeInitialized = function () {
@@ -354,7 +355,21 @@
         } else {
           clearInterval(intervaler);
           $.toast("画面异常,请重新进入", "text");
-          quit();
+          if (navigator.userAgent.toLowerCase().includes('toutiaomicroapp')) {
+            tt.miniProgram.switchTab({
+              url: '/pages/home/home'
+            })
+          } else if (window.__wxjs_environment === 'miniprogram') {
+            wx.miniProgram.switchTab({
+              url: '/pages/home/home'
+            })
+          } else {
+            document.addEventListener('UniAppJSBridgeReady', function () {
+              uni.webView.navigateTo({
+                url: '/pages/index/index'
+              });
+            })
+          }
         }
       }, 3000);
 
@@ -372,7 +387,21 @@
         if (errorTime > 1000) {
           $.toast("画面异常,请重新进入", "text");
           wsss.close();
-          quit();
+          if (navigator.userAgent.toLowerCase().includes('toutiaomicroapp')) {
+            tt.miniProgram.switchTab({
+              url: '/pages/home/home'
+            })
+          } else if (window.__wxjs_environment === 'miniprogram') {
+            wx.miniProgram.switchTab({
+              url: '/pages/home/home'
+            })
+          } else {
+            document.addEventListener('UniAppJSBridgeReady', function () {
+              uni.webView.navigateTo({
+                url: '/pages/index/index'
+              });
+            })
+          }
         }
       });
       ws.addEventListener('message', function (event) {
@@ -411,13 +440,10 @@
           if (data.frameType == 7 || data.frameType == 8) {
             isFeed = true;
             isAudioPlay = true;
-            isWaitSps = false;
           }
 
           if (isFeed) {
-            if (!isWaitSps) {
-              jmuxer.feed(data);
-            }
+            jmuxer.feed(data);
           }
         }
       });
@@ -439,7 +465,21 @@
     document.addEventListener("visibilitychange", function () {
       console.log(document[hidden]);
       if (document[hidden]) {
-        quit();
+        if (navigator.userAgent.toLowerCase().includes('toutiaomicroapp')) {
+          tt.miniProgram.switchTab({
+            url: '/pages/home/home'
+          })
+        } else if (window.__wxjs_environment === 'miniprogram') {
+          wx.miniProgram.switchTab({
+            url: '/pages/home/home'
+          })
+        } else {
+          document.addEventListener('UniAppJSBridgeReady', function () {
+            uni.webView.navigateTo({
+              url: '/pages/index/index'
+            });
+          })
+        }
       }
     }, false);
 
@@ -460,24 +500,6 @@
       $('.mask').hide();
     }
 
-    function quit() {
-      if (navigator.userAgent.toLowerCase().includes('toutiaomicroapp')) {
-        tt.miniProgram.switchTab({
-          url: '/pages/home/home'
-        })
-      } else if (window.__wxjs_environment === 'miniprogram') {
-        wx.miniProgram.switchTab({
-          url: '/pages/home/home'
-        })
-      } else {
-        document.addEventListener('UniAppJSBridgeReady', function () {
-          uni.webView.navigateTo({
-            url: '/pages/index/index'
-          });
-        })
-      }
-    }
-
     function decodeAAC(data) {
       var retPtr = Module._malloc(4 * 5 * 1024); // 接收的数据
       var inputPtr = Module._malloc(4 * data.length); // 输入数据
@@ -537,7 +559,21 @@
             clearInterval(intervaler);
             ws.close();
             wsss.close();
-            quit();
+            if (navigator.userAgent.toLowerCase().includes('toutiaomicroapp')) {
+              tt.miniProgram.switchTab({
+                url: '/pages/home/home'
+              })
+            } else if (window.__wxjs_environment === 'miniprogram') {
+              wx.miniProgram.switchTab({
+                url: '/pages/home/home'
+              })
+            } else {
+              document.addEventListener('UniAppJSBridgeReady', function () {
+                uni.webView.navigateTo({
+                  url: '/pages/index/index'
+                });
+              })
+            }
           }
         }
         if (input[23] == 0x05) { //横竖屏标识
@@ -907,7 +943,21 @@
       clearInterval(intervaler);
       ws.close();
       wsss.close();
-      quit();
+      if (navigator.userAgent.toLowerCase().includes('toutiaomicroapp')) {
+        tt.miniProgram.switchTab({
+          url: '/pages/home/home'
+        })
+      } else if (window.__wxjs_environment === 'miniprogram') {
+        wx.miniProgram.switchTab({
+          url: '/pages/home/home'
+        })
+      } else {
+        document.addEventListener('UniAppJSBridgeReady', function () {
+          uni.webView.navigateTo({
+            url: '/pages/index/index'
+          });
+        })
+      }
     })
 
     function selectText(x) {
@@ -1080,7 +1130,21 @@
       $('.buy-phone-wrap').eq(0).hide();
       if (disconnectionFlag || getDate) {//设置了断线时间,取消直接退出
         systemBuriedPoint('激活码-断线-取消');
-        quit();
+        if (navigator.userAgent.toLowerCase().includes('toutiaomicroapp')) {
+          tt.miniProgram.switchTab({
+            url: '/pages/home/home'
+          })
+        } else if (window.__wxjs_environment === 'miniprogram') {
+          wx.miniProgram.switchTab({
+            url: '/pages/home/home'
+          })
+        } else {
+          document.addEventListener('UniAppJSBridgeReady', function () {
+            uni.webView.navigateTo({
+              url: '/pages/index/index'
+            });
+          })
+        }
         return
       }
       let pointName = '';
@@ -1127,7 +1191,21 @@
       } else {
         systemBuriedPoint('激活码-强制关闭-放弃');
       }
-      quit();
+      if (navigator.userAgent.toLowerCase().includes('toutiaomicroapp')) {
+        tt.miniProgram.switchTab({
+          url: '/pages/home/home'
+        })
+      } else if (window.__wxjs_environment === 'miniprogram') {
+        wx.miniProgram.switchTab({
+          url: '/pages/home/home'
+        })
+      } else {
+        document.addEventListener('UniAppJSBridgeReady', function () {
+          uni.webView.navigateTo({
+            url: '/pages/index/index'
+          });
+        })
+      }
     })
     // 继续观看
     $('.looking')[0].addEventListener('click', () => {

+ 30 - 2
screenIos/WXdraw.js

@@ -77,7 +77,21 @@ function doConnect() {
     wsss.close();
     throttle(doConnect, 100);
     if (errorTime > 1000) {
-      quit();
+      if (navigator.userAgent.toLowerCase().includes('toutiaomicroapp')) {
+        tt.miniProgram.switchTab({
+          url: '/pages/home/home'
+        })
+      } else if (window.__wxjs_environment === 'miniprogram') {
+        wx.miniProgram.switchTab({
+          url: '/pages/home/home'
+        })
+      } else {
+        document.addEventListener('UniAppJSBridgeReady', function () {
+          uni.webView.navigateTo({
+            url: '/pages/index/index'
+          });
+        })
+      }
     }
   };
   wsss.onmessage = function (res) {
@@ -99,7 +113,21 @@ function doConnect() {
           }, function () {
             isControl = false;
             //点击取消后的回调函数
-            quit();
+            if (navigator.userAgent.toLowerCase().includes('toutiaomicroapp')) {
+              tt.miniProgram.switchTab({
+                url: '/pages/home/home'
+              })
+            } else if (window.__wxjs_environment === 'miniprogram') {
+              wx.miniProgram.switchTab({
+                url: '/pages/home/home'
+              })
+            } else {
+              document.addEventListener('UniAppJSBridgeReady', function () {
+                uni.webView.navigateTo({
+                  url: '/pages/index/index'
+                });
+              })
+            }
           });
         } else {
           $.confirm("当前云手机正在授控,是否请求获取云手机控制权?", function () {

+ 90 - 24
screenIos/WXtrialInterface.html

@@ -675,7 +675,21 @@
       decodeWoker.postMessage('close');
       decodeWoker.terminate();
       webSocketWorker.terminate();
-      quit();
+      if (navigator.userAgent.toLowerCase().includes('toutiaomicroapp')) {
+        tt.miniProgram.switchTab({
+          url: '/pages/home/home'
+        })
+      } else if (window.__wxjs_environment === 'miniprogram') {
+        wx.miniProgram.switchTab({
+          url: '/pages/home/home'
+        })
+      } else {
+        document.addEventListener('UniAppJSBridgeReady', function () {
+          uni.webView.navigateTo({
+            url: '/pages/index/index'
+          });
+        })
+      }
     })
 
     function handleClose() {
@@ -791,7 +805,21 @@
             decodeWoker.postMessage('close');
             decodeWoker.terminate();
             webSocketWorker.terminate();
-            quit();
+            if (navigator.userAgent.toLowerCase().includes('toutiaomicroapp')) {
+              tt.miniProgram.switchTab({
+                url: '/pages/home/home'
+              })
+            } else if (window.__wxjs_environment === 'miniprogram') {
+              wx.miniProgram.switchTab({
+                url: '/pages/home/home'
+              })
+            } else {
+              document.addEventListener('UniAppJSBridgeReady', function () {
+                uni.webView.navigateTo({
+                  url: '/pages/index/index'
+                });
+              })
+            }
           }
         }
         if (input[23] == 0x05) { //横竖屏标识
@@ -816,7 +844,21 @@
         decodeWoker.postMessage('close');
         decodeWoker.terminate();
         webSocketWorker.terminate();
-        quit();
+        if (navigator.userAgent.toLowerCase().includes('toutiaomicroapp')) {
+          tt.miniProgram.switchTab({
+            url: '/pages/home/home'
+          })
+        } else if (window.__wxjs_environment === 'miniprogram') {
+          wx.miniProgram.switchTab({
+            url: '/pages/home/home'
+          })
+        } else {
+          document.addEventListener('UniAppJSBridgeReady', function () {
+            uni.webView.navigateTo({
+              url: '/pages/index/index'
+            });
+          })
+        }
       }
     }
 
@@ -978,7 +1020,21 @@
       $('.buy-phone-wrap').eq(0).hide();
       if (disconnectionFlag || getDate) {//设置了断线时间,取消直接退出
         systemBuriedPoint('激活码-断线-取消');
-        quit();
+        if (navigator.userAgent.toLowerCase().includes('toutiaomicroapp')) {
+          tt.miniProgram.switchTab({
+            url: '/pages/home/home'
+          })
+        } else if (window.__wxjs_environment === 'miniprogram') {
+          wx.miniProgram.switchTab({
+            url: '/pages/home/home'
+          })
+        } else {
+          document.addEventListener('UniAppJSBridgeReady', function () {
+            uni.webView.navigateTo({
+              url: '/pages/index/index'
+            });
+          })
+        }
         return
       }
       let pointName = '';
@@ -1025,7 +1081,21 @@
       } else {
         systemBuriedPoint('激活码-强制关闭-放弃');
       }
-      quit();
+      if (navigator.userAgent.toLowerCase().includes('toutiaomicroapp')) {
+        tt.miniProgram.switchTab({
+          url: '/pages/home/home'
+        })
+      } else if (window.__wxjs_environment === 'miniprogram') {
+        wx.miniProgram.switchTab({
+          url: '/pages/home/home'
+        })
+      } else {
+        document.addEventListener('UniAppJSBridgeReady', function () {
+          uni.webView.navigateTo({
+            url: '/pages/index/index'
+          });
+        })
+      }
     })
     // 继续观看
     $('.looking')[0].addEventListener('click', () => {
@@ -1100,28 +1170,24 @@
     // 处理页面可见属性的改变
     document.addEventListener("visibilitychange", function () {
       if (document[hidden]) {
-        quit();
+        if (navigator.userAgent.toLowerCase().includes('toutiaomicroapp')) {
+          tt.miniProgram.switchTab({
+            url: '/pages/home/home'
+          })
+        } else if (window.__wxjs_environment === 'miniprogram') {
+          wx.miniProgram.switchTab({
+            url: '/pages/home/home'
+          })
+        } else {
+          document.addEventListener('UniAppJSBridgeReady', function () {
+            uni.webView.navigateTo({
+              url: '/pages/index/index'
+            });
+          })
+        }
       }
     }, false);
 
-    function quit() {
-      if (navigator.userAgent.toLowerCase().includes('toutiaomicroapp')) {
-        tt.miniProgram.switchTab({
-          url: '/pages/home/home'
-        })
-      } else if (window.__wxjs_environment === 'miniprogram') {
-        wx.miniProgram.switchTab({
-          url: '/pages/home/home'
-        })
-      } else {
-        document.addEventListener('UniAppJSBridgeReady', function () {
-          uni.webView.navigateTo({
-            url: '/pages/index/index'
-          });
-        })
-      }
-    }
-    
     window.onbeforeunload = function () {
       wsss.close();
       decodeWoker.postMessage('close');

+ 0 - 8
screenIos/decoder.js

@@ -54,14 +54,6 @@ self.addEventListener('message', function (e) {
 
     }
   }
-
-  if (msg.type == "switchSharpness") { // 分辨率切换实现
-    /*isSwitchSharpness = true;
-    closeDecoder();
-    var ret = Module._openDecoder();//再次开启解码器
-    var timeFlag = setInterval(decodeVideo, 1);
-    console.log("切换解码器成功");*/
-  }
 }, false);
 
 function PrintfLog(str) {