husq
2023-09-26 a035d06975c9cef97fb296b9a09de6925d81d823
处理视频关闭问题
2 files modified
28 ■■■■ changed files
src/components/GMap.vue 24 ●●●● patch | view | raw | blame | history
src/components/Jessibuca/Jessibuca.vue 4 ●●● patch | view | raw | blame | history
src/components/GMap.vue
@@ -373,7 +373,7 @@
      </div>
      <a-row class="p5" v-if="showMonitor" justify="center" align="middle">
        <!-- <a-spin :spinning="spinning"> -->
          <Jessibuca v-if="airPortUrl" :videoUrl="airPortUrl" width="100%" height="300px" />
          <Jessibuca v-if="airPortUrl" @timeout="airTimeout" :videoUrl="airPortUrl" width="100%" height="300px" />
        <!-- </a-spin> -->
      </a-row>
      <!--  飞机-->
@@ -417,7 +417,7 @@
      <!-- 飞机直播 -->
      <a-row class="p5" v-if="showAircraft">
        <!-- <a-spin :spinning="spinning"> -->
          <Jessibuca v-if="aircraftUrl" :videoUrl="aircraftUrl" width="100%" height="300px" />
          <Jessibuca v-if="aircraftUrl" @timeout="flyTimeout" :videoUrl="aircraftUrl" width="100%" height="300px" />
        <!-- </a-spin> -->
      </a-row>
      <!-- 飞机图标信息 -->
@@ -905,8 +905,24 @@
          message.error(error)
        })
    }
    // 机场视频超时说明可能直播被关闭需要重新开启直播
    const airTimeout = () => {
      try {
        onStart()
      } catch (e) {
        onClose()
      }
    }
    const flyTimeout = () => {
      try {
        flyOnStart()
      } catch (e) {
        closeFly()
      }
    }
    // 设备开始播放
    const onStart = async () => {
      airPortUrl.value = ''
      const videoId = droneList.value[droneIndex.value].value + '/' + cameraList.value[cameraIndex.value].value + '/' + videoList.value[videoIndex.value].value
      const streamId = droneList.value[droneIndex.value].value + '-' + cameraList.value[cameraIndex.value].value + '-' + videoList.value[videoIndex.value].value
      const liveURL = config.rtmpURL + streamId
@@ -1315,7 +1331,9 @@
      closeOsdWindow,
      openDroneControl,
      openFlySetting,
      openDeviceSetting
      openDeviceSetting,
      airTimeout,
      flyTimeout
    }
  }
})
src/components/Jessibuca/Jessibuca.vue
@@ -3,7 +3,7 @@
</template>
<script setup lang="ts">
import { onMounted, onUnmounted, ref, defineProps } from 'vue'
import { onMounted, onUnmounted, ref, defineProps, defineEmits } from 'vue'
import Jessibuca from '../../../public/jessibuca/jessibuca'
const props = defineProps({
  videoUrl: {
@@ -19,6 +19,7 @@
    default: '200px'
  }
})
const emits = defineEmits(['timeout'])
let jessibuca: null | Jessibuca = null
const container = ref(null)
const buffer = ref(null)
@@ -107,6 +108,7 @@
  jessibuca.on('timeout', function () {
    console.log('timeout')
    emits('timeout')
  })
  jessibuca.on('start', function () {