Bläddra i källkod

增加弹窗处理小程序没有画面问题

leo 7 månader sedan
förälder
incheckning
903de4082c
2 ändrade filer med 44 tillägg och 24 borttagningar
  1. 4 4
      static/rtcEngine/WXtrialInterface.html
  2. 40 20
      static/rtcEngine/js/WXtrialInterface.js

+ 4 - 4
static/rtcEngine/WXtrialInterface.html

@@ -7,10 +7,10 @@
     <title>双子星云手机</title>
     <link rel="stylesheet" href="./config/css/vant.css">
     <link rel="stylesheet" href="./css/WXtrialInterface.css">
-    <script src="https://lf9-cdn-tos.bytecdntp.com/cdn/expire-1-M/vConsole/3.12.1/vconsole.min.js"></script>
-    <script>
+    <!-- <script src="https://lf9-cdn-tos.bytecdntp.com/cdn/expire-1-M/vConsole/3.12.1/vconsole.min.js"></script> -->
+    <!-- <script>
         const vConsole = new VConsole();
-    </script>
+    </script> -->
 </head>
 
 <body @touchmove.prevent>
@@ -36,7 +36,7 @@
                     x5-video-player-fullscreen="true" x5-video-orientation="portraint" id="playerVideo"
                     class="videoRotate" :controls="false" @touchmove.prevent="(event) => {engine.touchClick(event, 2)}"
                     @touchstart.prevent="(event) => {engine.touchClick(event, 0)}"
-                    @touchend.prevent="touchendRtcMediaPlayer" v-show="isShowVideo" muted>
+                    @touchend.prevent="touchendRtcMediaPlayer" v-show="isShowVideo">
                     当前浏览器暂不支持、请使用谷歌浏览器或前往双子星客户端使用</video>
             </div>
             <!-- 底部按钮 -->

+ 40 - 20
static/rtcEngine/js/WXtrialInterface.js

@@ -174,7 +174,7 @@ const app = new Vue({
 
         // 连接webRTC
         connectWebRtc() {
-            console.time('获取推流响应消耗时间:')
+            // console.time('获取推流响应消耗时间:')
             this.plugFlowStartTime = +new Date()
             const { sn: topic, cardToken: authToken, internetHttps, internetHttp, webrtcTransferCmnet, webrtcTransferTelecom, webrtcTransferUnicom } = this.userCardInfoData;
             const isWss = location.protocol === 'https:'
@@ -209,14 +209,13 @@ const app = new Vue({
 
         // webRTC状态回调
         statusCallBack(event) {
-            console.log(event.val)
             if (event.type !== 'StreamStates') {
                 // console.log("链接的状态", event, event.val);
             }
             switch (event.type) {
                 case "screenChange":
                     // 0:横屏 1:竖屏
-                    console.log("屏幕方向变化事件:" + event.val);
+                    // console.log("屏幕方向变化事件:" + event.val);
                     this.isLandscape = event.val === 0;
                     break;
                 case "wsState":
@@ -238,25 +237,26 @@ const app = new Vue({
                     break;
                 case "rtcState":
                     // “connected”:rtc链接成功 “failed”:rtc链接失败 “closed”:rtc链接关闭 “disconnected”:rtc链接超时
-                    console.log(event.val, 'rtc链接成功状态')
+                    // console.log(event.val, 'rtc链接成功状态')
                     if (event.val === "connected") {
-                        Toast.clear();
-                        this.doConnectDirectives()
-                        this.isShowVideo = true
-                        this.$refs.rtcMediaPlayer.play()
-                        let ms = +new Date - this.plugFlowStartTime
-                        console.timeEnd('获取推流响应消耗时间:')
-                        console.log(`获取推流响应消耗时间:${ms / 1000}秒`)
-                        this.definitionFun(this.definitionValue)
-                        this.pushflowPopup()
-                        this.getResidueTime()
+                        // Toast.clear();
+                        // this.doConnectDirectives()
+                        // this.isShowVideo = true
+                        // this.$refs.rtcMediaPlayer.play()
+                        // let ms = +new Date - this.plugFlowStartTime
+                        // console.timeEnd('获取推流响应消耗时间:')
+                        // console.log(`获取推流响应消耗时间:${ms / 1000}秒`)
+                        // this.definitionFun(this.definitionValue)
+                        // this.pushflowPopup()
+                        // this.getResidueTime()
+                        playOnBtn.bind(this)()
                         return
                     }
                     if (event.val === "connecting") return
                     this.exit()
                     break;
                 case "AuthenticationStatus":
-                    console.log(`鉴权${event.val === "success" ? '成功' : '失败'}`);
+                    // console.log(`鉴权${event.val === "success" ? '成功' : '失败'}`);
                     break;
                 case "StreamStates":
                     // “currentRoundTripTime”:延迟 “lostRate”:丢包率 “seconds_KBytes”:带宽 “framesPerSecond”:帧率
@@ -267,10 +267,10 @@ const app = new Vue({
                     // console.log(event.val, '分辨率')
                     break
                 case 'networkService': // 获取三网信息
-                    console.log("三网信息:", event.val);
+                    // console.log("三网信息:", event.val);
                     break
                 case 'networkServiceURL': // 获取三网信息
-                    console.log("三网IP地址:", event.val);
+                    // console.log("三网IP地址:", event.val);
                     break
             }
         },
@@ -532,7 +532,6 @@ const app = new Vue({
                 message: '数据加载中...',
             });
             this.obtainCardInfoStartTime = + new Date()
-            console.time('获取卡信息响应消耗时间:')
             let { userCardId } = this.parametersData
             userCardId = +userCardId
             const statusTips = {
@@ -566,8 +565,6 @@ const app = new Vue({
                         }
                         this.userCardInfoData = res.data
                         let ms = + new Date() - this.obtainCardInfoStartTime
-                        console.timeEnd('获取卡信息响应消耗时间:')
-                        console.log(`获取卡信息响应消耗时间:${ms / 1000}秒`)
                         this.connectWebRtc()
                         return
                     case 5200:
@@ -770,6 +767,29 @@ const app = new Vue({
     }
 })
 
+function playOnBtn() {
+    const { isTips } = this.parametersData;
+    Dialog.alert({
+        title: '提示',
+        message: `${+isTips ? '开始' : '继续'}使用云手机`,
+        confirmButtonText: '确定',
+        confirmButtonColor: '#3cc51f',
+        beforeClose: (action, done) => {
+            if (action === 'confirm') {
+                this.isShowVideo = true
+                this.$refs.rtcMediaPlayer.play()
+                setTimeout(() => {
+                    this.definitionFun(this.definitionValue)
+                    this.pushflowPopup()
+                    this.getResidueTime()
+                    done()
+                })
+                
+            }
+        }
+    });
+}
+
 
 // 获取URL参数
 function getParameters() {