Sfoglia il codice sorgente

增加耗时时间、自动播放失败时的弹窗

leo 9 mesi fa
parent
commit
f24b8f2f44
1 ha cambiato i file con 17 aggiunte e 2 eliminazioni
  1. 17 2
      static/rtcEngine/js/WXtrialInterface.js

+ 17 - 2
static/rtcEngine/js/WXtrialInterface.js

@@ -102,13 +102,14 @@ const app = new Vue({
         layoutViewHeight: null,
         // 是否显示video
         isShowVideo: false,
-
+        plugFlowStartDate: null,
+        obtainCardInfoStartDate: null
     },
     created() {
         this.initConfig()
     },
     mounted() {
-
+        this.obtainCardInfoStartDate = + new Date()
         this.getUserCardInfo()
     },
     computed: {
@@ -174,6 +175,7 @@ const app = new Vue({
 
         // 连接webRTC
         connectWebRtc() {
+            this.plugFlowStartDate = +new Date()
             const { sn: topic, cardToken: authToken, internetHttps, internetHttp, webrtcTransferCmnet, webrtcTransferTelecom, webrtcTransferUnicom } = this.userCardInfoData;
             const isWss = location.protocol === 'https:'
             const url = `${isWss ? 'wss://' : 'ws://'}${isWss ? internetHttps : internetHttp}/nats`;
@@ -240,9 +242,21 @@ const app = new Vue({
                         this.doConnectDirectives()
                         this.isShowVideo = true
                         this.$refs.rtcMediaPlayer.volume = 0
+                        console.log('推流消耗时间:' + ((+ new Date() - this.plugFlowStartDate) / 1000) + '秒')
                         this.$refs.rtcMediaPlayer.play().then(() => {
                             this.$refs.rtcMediaPlayer.volume = 1
                         }).catch(error => {
+                            Dialog.alert({
+                                title: '提示',
+                                message: '加载失败,请手动刷新',
+                                confirmButtonText: '刷新',
+                                confirmButtonColor: '#3cc51f',
+                                beforeClose: (action, done) => {
+                                    this.$refs.rtcMediaPlayer.play()
+                                    this.$refs.rtcMediaPlayer.volume = 1
+                                    done()
+                                }
+                            })
                             // Toast('如需声音,可调高音量使用')
                             console.error('自动播放失败', error);
                         });
@@ -562,6 +576,7 @@ const app = new Vue({
                             return
                         }
                         this.userCardInfoData = res.data
+                        console.log('获取卡信息消耗时间:' + ((+ new Date() - this.obtainCardInfoStartDate) / 1000) + '秒')
                         this.connectWebRtc()
                         return
                     case 5200: