Commit f4ee7271e70acb596bdd74321faf228658afccec

Authored by 648540858
Committed by GitHub
2 parents 4c8e2beb aae7c80f

Merge pull request #661 from xiaoQQya/wvp-28181-2.0

修复分屏监控与视频播放页在 HTTPS 环境下无法播放的问题
web_src/src/components/dialog/devicePlayer.vue
... ... @@ -121,6 +121,10 @@
121 121 <el-tag >RTC:</el-tag>
122 122 <span>{{ streamInfo.rtc }}</span>
123 123 </el-dropdown-item>
  124 + <el-dropdown-item :command="streamInfo.rtcs">
  125 + <el-tag >RTCS:</el-tag>
  126 + <span>{{ streamInfo.rtcs }}</span>
  127 + </el-dropdown-item>
124 128 <el-dropdown-item :command="streamInfo.rtmp">
125 129 <el-tag >RTMP:</el-tag>
126 130 <span>{{ streamInfo.rtmp }}</span>
... ... @@ -322,7 +326,7 @@ export default {
322 326 player: {
323 327 jessibuca : ["ws_flv", "wss_flv"],
324 328 livePlayer : ["ws_flv", "wss_flv"],
325   - webRTC: ["rtc", "rtc"],
  329 + webRTC: ["rtc", "rtcs"],
326 330 },
327 331 videoHistory: {
328 332 date: '',
... ... @@ -393,7 +397,7 @@ export default {
393 397 changePlayer: function (tab) {
394 398 console.log(this.player[tab.name][0])
395 399 this.activePlayer = tab.name;
396   - this.videoUrl = this.streamInfo[this.player[tab.name][0]]
  400 + this.videoUrl = this.getUrlByStreamInfo()
397 401 console.log(this.videoUrl)
398 402 },
399 403 openDialog: function (tab, deviceId, channelId, param) {
... ...
web_src/src/components/dialog/rtcPlayer.vue
... ... @@ -51,7 +51,7 @@ export default {
51 51 });
52 52  
53 53 webrtcPlayer.on(ZLMRTCClient.Events.WEBRTC_ON_REMOTE_STREAMS,(e)=>{//获取到了远端流,可以播放
54   - console.error('播放成功',e.streams)
  54 + console.log('播放成功',e.streams)
55 55 this.eventcallbacK("playing", "播放成功")
56 56 });
57 57  
... ... @@ -59,7 +59,7 @@ export default {
59 59 console.error('offer anwser 交换失败',e)
60 60 this.eventcallbacK("OFFER ANSWER ERROR ", "offer anwser 交换失败")
61 61 if (e.code ==-400 && e.msg=="流不存在"){
62   - console.log("111111")
  62 + console.log("流不存在")
63 63 this.timer = setTimeout(()=>{
64 64 this.webrtcPlayer.close();
65 65 this.play(url)
... ...
web_src/src/components/live.vue
... ... @@ -138,8 +138,14 @@ export default {
138 138 url: '/api/play/start/' + deviceId + '/' + channelId
139 139 }).then(function (res) {
140 140 if (res.data.code === 0 && res.data.data) {
141   - itemData.playUrl = res.data.data.httpsFlv
142   - that.setPlayUrl(res.data.data.ws_flv, idxTmp)
  141 + let videoUrl;
  142 + if (location.protocol === "https:") {
  143 + videoUrl = res.data.data.wss_flv;
  144 + } else {
  145 + videoUrl = res.data.data.ws_flv;
  146 + }
  147 + itemData.playUrl = videoUrl;
  148 + that.setPlayUrl(videoUrl, idxTmp);
143 149 } else {
144 150 that.$message.error(res.data.msg);
145 151 }
... ...