From d09d8f11f06ee6eeeb4c7f9bd6d35e6fbd49e05f Mon Sep 17 00:00:00 2001
From: jiang <893224616@qq.com>
Date: 星期四, 04 八月 2022 17:01:31 +0800
Subject: [PATCH] 修改‘修改pushkey’窗口的标题提示文案

---
 web_src/src/components/dialog/rtcPlayer.vue |   42 +++++++++++++++++++++++++-----------------
 1 files changed, 25 insertions(+), 17 deletions(-)

diff --git a/web_src/src/components/dialog/rtcPlayer.vue b/web_src/src/components/dialog/rtcPlayer.vue
index 6208100..4737849 100644
--- a/web_src/src/components/dialog/rtcPlayer.vue
+++ b/web_src/src/components/dialog/rtcPlayer.vue
@@ -7,18 +7,23 @@
 </template>
 
 <script>
+let webrtcPlayer = null;
 export default {
     name: 'rtcPlayer',
     data() {
         return {
-            webrtcPlayer: null
+            timer: null
         };
     },
     props: ['videoUrl', 'error', 'hasaudio'],
     mounted () {
+      let paramUrl = decodeURIComponent(this.$route.params.url)
        this.$nextTick(() =>{
-           console.log("鍒濆鍖栨椂鐨勫湴鍧�涓�: " + this.videoUrl)
-            this.play(this.videoUrl)
+         if (typeof (this.videoUrl) == "undefined") {
+           this.videoUrl = paramUrl;
+         }
+         console.log("鍒濆鍖栨椂鐨勫湴鍧�涓�: " + this.videoUrl)
+         this.play(this.videoUrl)
         })
     },
     watch:{
@@ -30,7 +35,7 @@
     },
     methods: {
         play: function (url) {
-            this.webrtcPlayer = new ZLMRTCClient.Endpoint({
+            webrtcPlayer = new ZLMRTCClient.Endpoint({
                 element: document.getElementById('webRtcPlayerBox'),// video 鏍囩
                 debug: true,// 鏄惁鎵撳嵃鏃ュ織
                 zlmsdpUrl: url,//娴佸湴鍧�
@@ -40,48 +45,51 @@
                 videoEnable: false,
                 recvOnly: true,
             })
-            this.webrtcPlayer.on(ZLMRTCClient.Events.WEBRTC_ICE_CANDIDATE_ERROR,(e)=>{// ICE 鍗忓晢鍑洪敊
+            webrtcPlayer.on(ZLMRTCClient.Events.WEBRTC_ICE_CANDIDATE_ERROR,(e)=>{// ICE 鍗忓晢鍑洪敊
                 console.error('ICE 鍗忓晢鍑洪敊')
                 this.eventcallbacK("ICE ERROR", "ICE 鍗忓晢鍑洪敊")
             });
 
-            this.webrtcPlayer.on(ZLMRTCClient.Events.WEBRTC_ON_REMOTE_STREAMS,(e)=>{//鑾峰彇鍒颁簡杩滅娴侊紝鍙互鎾斁
+            webrtcPlayer.on(ZLMRTCClient.Events.WEBRTC_ON_REMOTE_STREAMS,(e)=>{//鑾峰彇鍒颁簡杩滅娴侊紝鍙互鎾斁
                 console.error('鎾斁鎴愬姛',e.streams)
                 this.eventcallbacK("playing", "鎾斁鎴愬姛")
             });
 
-            this.webrtcPlayer.on(ZLMRTCClient.Events.WEBRTC_OFFER_ANWSER_EXCHANGE_FAILED,(e)=>{// offer anwser 浜ゆ崲澶辫触
+            webrtcPlayer.on(ZLMRTCClient.Events.WEBRTC_OFFER_ANWSER_EXCHANGE_FAILED,(e)=>{// offer anwser 浜ゆ崲澶辫触
                 console.error('offer anwser 浜ゆ崲澶辫触',e)
                 this.eventcallbacK("OFFER ANSWER ERROR ", "offer anwser 浜ゆ崲澶辫触")
                 if (e.code ==-400 && e.msg=="娴佷笉瀛樺湪"){
                     console.log("111111")
-                    setTimeout(()=>{
+                    this.timer = setTimeout(()=>{
                         this.webrtcPlayer.close();
                         this.play(url)
                     }, 100)
-                    
+
                 }
             });
 
-            this.webrtcPlayer.on(ZLMRTCClient.Events.WEBRTC_ON_LOCAL_STREAM,(s)=>{// 鑾峰彇鍒颁簡鏈湴娴�
+            webrtcPlayer.on(ZLMRTCClient.Events.WEBRTC_ON_LOCAL_STREAM,(s)=>{// 鑾峰彇鍒颁簡鏈湴娴�
 
                 // document.getElementById('selfVideo').srcObject=s;
                 this.eventcallbacK("LOCAL STREAM", "鑾峰彇鍒颁簡鏈湴娴�")
             });
-            
+
         },
         pause: function () {
-            if (this.webrtcPlayer != null) {
-                this.webrtcPlayer.close();
-                this.webrtcPlayer = null;
+            if (webrtcPlayer != null) {
+                webrtcPlayer.close();
+                webrtcPlayer = null;
             }
-            
+
         },
         eventcallbacK: function(type, message) {
             console.log("player 浜嬩欢鍥炶皟")
             console.log(type)
             console.log(message)
         }
+    },
+    destroyed() {
+        clearTimeout(this.timer);
     },
 }
 </script>
@@ -102,5 +110,5 @@
     /* .iconqingxiLOGO {
         display: none !important;
     } */
-    
-</style>
\ No newline at end of file
+
+</style>

--
Gitblit v1.8.0