Browse Source

视频回放

yanghao 1 day ago
parent
commit
c67df7a4d3

+ 1 - 1
src/api/pms/video/channel.ts

@@ -82,7 +82,7 @@ export function playbackReplay(deviceId, channelId, streamId) {
 
 export function playbackSeek(deviceId, channelId, streamId, query) {
   return request.get({
-    url: '/sip/player/playbackSeek/' + deviceId + '/' + channelId + '/' + streamId,
+    url: '/rq/sip/player/playbackSeek/' + deviceId + '/' + channelId + '/' + streamId,
 
     params: query
   })

+ 13 - 13
src/views/pms/video_center/device/device-edit.vue

@@ -894,9 +894,9 @@ const tabChange = (panel) => {
   nextTick(() => {
     if (form.deviceType == 3 && panel.name != 'deviceReturn') {
       if (panel.name === 'sipPlayer') {
-        // if (this.$refs.deviceVideo && this.$refs.deviceVideo.destroy) {
-        //   this.$refs.deviceVideo.destroy()
-        // }
+        if (deviceVideoRef.value && deviceVideoRef.value.destroy) {
+          deviceVideoRef.value.destroy()
+        }
         if (deviceLiveStreamRef.value) {
           if (channelId.value) {
             deviceLiveStreamRef.value.channelId = channelId.value
@@ -909,13 +909,13 @@ const tabChange = (panel) => {
         if (deviceLiveStreamRef.value && deviceLiveStreamRef.value.destroy) {
           deviceLiveStreamRef.value.destroy()
         }
-        // if (
-        //   this.$refs.deviceVideo &&
-        //   this.$refs.deviceVideo.channelId !== undefined &&
-        //   this.$refs.deviceVideo.queryDate
-        // ) {
-        //   this.$refs.deviceVideo.loadDevRecord()
-        // }
+        if (
+          deviceVideoRef.value &&
+          deviceVideoRef.value.channelId !== undefined &&
+          deviceVideoRef.value.queryDate
+        ) {
+          deviceVideoRef.value.loadDevRecord()
+        }
       } else if (panel.name === 'sipChannel') {
         nextTick(() => {
           ChannelRef.value.getList()
@@ -930,9 +930,9 @@ const tabChange = (panel) => {
         deviceLiveStreamRef.value.closeDestroy(false)
       }
       //关闭录像流
-      // if (panel.name !== 'sipVideo' && this.$refs.deviceVideo && this.$refs.deviceVideo.playing) {
-      //   this.$refs.deviceVideo.closeDestroy()
-      // }
+      if (panel.name !== 'sipVideo' && deviceVideoRef.value && deviceVideoRef.value.playing) {
+        deviceVideoRef.value.closeDestroy()
+      }
     }
   })
 

+ 23 - 5
src/views/pms/video_center/sip/components/player/deviceVideo.vue

@@ -108,7 +108,11 @@ const queryDate = ref('')
 const playing = ref(false)
 const vodData = ref({})
 const hisData = ref([])
-const playinfo = ref({})
+const playinfo = ref({
+  playtype: 'playback',
+  deviceId: '',
+  channelId: '',
+})
 const channelList = ref<{value: string, label: string}[]>([])
 const playbackinfo = ref({})
 const timeRange = ref<[string, string] | null>(null)
@@ -147,6 +151,7 @@ const init = () => {
   playinfo.value = {
     playtype: 'playback',
     deviceId: props.device.serialNumber,
+    channelId:''
   }
 }
 
@@ -217,8 +222,8 @@ const loadDevRecord = async () => {
     try {
         const res = await getDevRecord(deviceId.value, channelId.value, query)
       console.log('res :>> ', res)
-      hisData.value = res.data.recordItems
-      if (res.data.recordItems) {
+      hisData.value = res.recordItems
+      if (res.recordItems) {
         const len = hisData.value.length
         if (len > 0) {
           if (hisData.value[0].start < start) {
@@ -260,10 +265,13 @@ const playback = async () => {
     if (ssrc.value) {
       await closeStream(deviceId.value, channelId.value, ssrc.value)
       const res = await playbackvideo(deviceId.value, channelId.value, query)
-      initUrl(res.data)
+
+      console.log('res :>>>>>>>>>>>>>>>> ', res)
+      initUrl(res)
     } else {
       const res = await playbackvideo(deviceId.value, channelId.value, query)
-      initUrl(res.data)
+       console.log('***********************', res)
+      initUrl(res)
     }
     triggerPlay(hisData.value)
   } catch (error) {
@@ -365,4 +373,14 @@ const downloadRecord = async () => {
 onBeforeUnmount(() => {
   closeStreamFunc()
 })
+
+defineExpose({
+  loadDevRecord,
+  closeStreamFunc,
+  closeDestroy,
+  timePickerChange,
+  downloadRecord,
+  destroy,
+  queryDate
+})
 </script>