From 1245ae7874fd97c70ec6048f4d90ee70831d17ba Mon Sep 17 00:00:00 2001
From: PengOu <595466820@qq.com>
Date: 星期二, 30 一月 2024 10:59:25 +0800
Subject: [PATCH] Fix 推流列表-> 添加通道 报错: 错误: 字段 "gbStreamId" 不存在 ,改为:gb_stream_id 自测试通过
---
web_src/src/components/dialog/rtcPlayer.vue | 46 +++++++++++++++++++++++++++-------------------
1 files changed, 27 insertions(+), 19 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 6208100..f957df7
--- 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)=>{//鑾峰彇鍒颁簡杩滅娴侊紝鍙互鎾斁
- 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")
- setTimeout(()=>{
+ console.log("娴佷笉瀛樺湪")
+ 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