From 9f16b5c553b479ea12fe368a7ecc748872ea8b98 Mon Sep 17 00:00:00 2001
From: zxl <763096477@qq.com>
Date: 星期四, 12 六月 2025 11:11:27 +0800
Subject: [PATCH] 修改配置文件

---
 web_src/src/components/dialog/rtcPlayer.vue |   27 ++++++++++++++-------------
 1 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/web_src/src/components/dialog/rtcPlayer.vue b/web_src/src/components/dialog/rtcPlayer.vue
old mode 100644
new mode 100755
index 75c18f3..ff44b8c
--- a/web_src/src/components/dialog/rtcPlayer.vue
+++ b/web_src/src/components/dialog/rtcPlayer.vue
@@ -7,11 +7,11 @@
 </template>
 
 <script>
+let webrtcPlayer = null;
 export default {
     name: 'rtcPlayer',
     data() {
         return {
-            webrtcPlayer: null,
             timer: null
         };
     },
@@ -35,31 +35,32 @@
     },
     methods: {
         play: function (url) {
-            this.webrtcPlayer = new ZLMRTCClient.Endpoint({
+            webrtcPlayer = new ZLMRTCClient.Endpoint({
                 element: document.getElementById('webRtcPlayerBox'),// video 鏍囩
                 debug: true,// 鏄惁鎵撳嵃鏃ュ織
                 zlmsdpUrl: url,//娴佸湴鍧�
                 simulecast: false,
                 useCamera: false,
-                audioEnable: false,
-                videoEnable: false,
+                audioEnable: true,
+                videoEnable: true,
                 recvOnly: true,
+                usedatachannel: false,
             })
-            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)=>{//鑾峰彇鍒颁簡杩滅娴侊紝鍙互鎾斁
-                console.error('鎾斁鎴愬姛',e.streams)
+            webrtcPlayer.on(ZLMRTCClient.Events.WEBRTC_ON_REMOTE_STREAMS,(e)=>{//鑾峰彇鍒颁簡杩滅娴侊紝鍙互鎾斁
+                console.log('鎾斁鎴愬姛',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")
+                    console.log("娴佷笉瀛樺湪")
                     this.timer = setTimeout(()=>{
                         this.webrtcPlayer.close();
                         this.play(url)
@@ -68,7 +69,7 @@
                 }
             });
 
-            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", "鑾峰彇鍒颁簡鏈湴娴�")
@@ -76,9 +77,9 @@
 
         },
         pause: function () {
-            if (this.webrtcPlayer != null) {
-                this.webrtcPlayer.close();
-                this.webrtcPlayer = null;
+            if (webrtcPlayer != null) {
+                webrtcPlayer.close();
+                webrtcPlayer = null;
             }
 
         },

--
Gitblit v1.8.0