From 3ec3b88456cf9ac455d93baba40f339bb284dd77 Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期三, 14 十月 2020 14:39:10 +0800
Subject: [PATCH] 修复点播判断错误导致的15s超长延时 增加默认不关闭推流, 无人观看超时或点击停止按钮关闭流 修复点播其他bug

---
 web_src/src/components/gb28181/devicePlayer.vue |   29 ++++++++++++++---------------
 1 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/web_src/src/components/gb28181/devicePlayer.vue b/web_src/src/components/gb28181/devicePlayer.vue
index f49e03f..ce36483 100644
--- a/web_src/src/components/gb28181/devicePlayer.vue
+++ b/web_src/src/components/gb28181/devicePlayer.vue
@@ -1,6 +1,6 @@
 <template>
 	<div id="devicePlayer">
-		<el-dialog title="瑙嗛鎾斁" top="0" :visible.sync="showVideoDialog" :destroy-on-close="true" @close="stop()">
+		<el-dialog title="瑙嗛鎾斁" top="0" :visible.sync="showVideoDialog" :destroy-on-close="true" @close="close()">
       <LivePlayer v-if="showVideoDialog" ref="videoPlayer" :videoUrl="videoUrl" :error="videoError" :hasaudio="hasaudio" fluent autoplay live ></LivePlayer>
 			<div id="shared" style="text-align: right; margin-top: 1rem;">
 				<el-tabs v-model="tabActiveName">
@@ -124,6 +124,18 @@
 			play: function(streamInfo, deviceId, channelId, hasAudio) {
         console.log(hasAudio);
         this.hasaudio = hasAudio;
+        // 鏍规嵁濯掍綋娴佷俊鎭簩娆″垽鏂�
+        if( this.hasaudio && !!streamInfo.tracks && streamInfo.tracks.length > 0) {
+          var realHasAudio = false;
+          for (let i = 0; i < streamInfo.tracks; i++) {
+            if (streamInfo.tracks[i].codec_type == 1) { // 鍒ゆ柇涓洪煶棰�
+              realHasAudio = true;
+            }
+          }
+          this.hasaudio = realHasAudio && this.hasaudio;
+        }
+        console.log("111")
+        console.log(this.hasaudio)
         this.ssrc = streamInfo.ssrc;
 				this.deviceId = deviceId;
 				this.channelId = channelId;
@@ -133,24 +145,11 @@
 				this.showVideoDialog = true;
 				console.log(this.ssrc);
 			},
-			stop: function() {
+			close: function() {
 				console.log('鍏抽棴瑙嗛');
 				this.$refs.videoPlayer.pause();
 				this.videoUrl = '';
 				this.showVideoDialog = false;
-				this.$axios({
-					method: 'post',
-					url: '/api/play/' + this.ssrc + '/stop'
-				}).then(function(res) {
-					console.log(JSON.stringify(res));
-				});
-
-				this.$axios({
-					method: 'post',
-					url: '/api/playback/' + this.ssrc + '/stop'
-				}).then(function(res) {
-					console.log(JSON.stringify(res));
-				});
 			},
 			copySharedInfo: function(data) {
 				console.log('澶嶅埗鍐呭锛�' + data);

--
Gitblit v1.8.0