Преглед на файлове

解决试听停止回环bug

allen преди 3 години
родител
ревизия
014573645a
променени са 2 файла, в които са добавени 15 реда и са изтрити 8 реда
  1. 2 2
      src/api/calling-broadcast.js
  2. 13 6
      src/views/ncs-broadcast/index.vue

+ 2 - 2
src/api/calling-broadcast.js

@@ -129,9 +129,9 @@ export function auditionStart(id, uuid) {
   })
 }
 
-export function auditionStop() {
+export function auditionStop(uuid) {
   return mediaRequest({
     method: 'get',
-    url: '/streaming/audition_stop'
+    url: `/streaming/audition_stop/${uuid}`
   })
 }

+ 13 - 6
src/views/ncs-broadcast/index.vue

@@ -37,7 +37,7 @@
       />
     </ag-grid-layout>
 
-    <el-dialog title="试听" width="300" :visible="stream!==null" :before-close="streamingStop">
+    <el-dialog title="试听" width="300" :visible="stream!==null" :show-close="false">
       <el-row>
         <el-col :span="24">
           {{auditionTotalMsg}}
@@ -55,7 +55,7 @@
         <audio ref="audio" loop autoplay playsinline :srcObject.prop="stream" v-if="stream" style="width: 300px;height:100px;"></audio>
       </div>
       <span slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="streamingStop">停止</el-button>
+        <el-button type="primary" @click="streamingStop(true)">停止</el-button>
       </span>
     </el-dialog>
 
@@ -394,7 +394,7 @@ export default {
                   if (this.stream === null) {
                     this.streamingStart(param.data.id)
                   } else {
-                    this.streamingStop()
+                    this.streamingStop(true)
                   }
                 }
               }
@@ -451,6 +451,9 @@ export default {
       if (_this.janus === null) {
         _this.connect(this.rtcServer)
       }
+      if (_this.websock === null) {
+        _this.initAuditionWebSocket()
+      }
     }, 60000)
   },
   methods: {
@@ -742,6 +745,7 @@ export default {
     },
     websocketonerror: function(e) {
       console.log(this.$t('deviceManage.webSocketError'))
+      this.websock = null
     },
     websocketonmessage: function(e) {
       // this.scheduledIds = JSON.parse(e.data)
@@ -760,7 +764,7 @@ export default {
 
       if (result.finished){
         this.auditionTotalMsg = null
-        this.streamingStop()
+        this.streamingStop(false)
         this.$message({
           type: 'success',
           message: '试听结束'
@@ -769,6 +773,7 @@ export default {
     },
     websocketclose: function(e) {
       console.log('connection closed (' + e.code + ')')
+      this.websock = null
     },
     refreshPlayStatus() {
       if (this.rowData !== null) {
@@ -969,11 +974,13 @@ export default {
         }
       })
     },
-    streamingStop() {
+    streamingStop(personClose) {
       this.pluginHandle.send({ message: { request: "stop" } })
       this.pluginHandle.hangup()
       this.onCleanup()
-      API_Broadcast.auditionStop()
+      if (personClose) {
+        API_Broadcast.auditionStop(this.$store.getters.uuid)
+      }
       this.auditionMsg = null
     },
     onCleanup() {