|
|
@@ -31,8 +31,8 @@ |
|
|
|
class="video_content" |
|
|
|
:class="videoShow == 'back' ? 'video_show' : 'video_hidden'" |
|
|
|
> |
|
|
|
<VideoPlayer ref="videoRef" :options="getVideoOptions" @time-update="handleOriginTime" @video-status="handleOriginStatus" /> |
|
|
|
<VideoPlayer ref="aiVideoRef" :options="getVideoAiOptions" @time-update="handleAiTime" @video-status="handleAiStatus" /> |
|
|
|
<VideoPlayer ref="originRef" :options="getVideoOptions" @time-update="handleOriginTime" @video-status="handleOriginStatus" /> |
|
|
|
<VideoPlayer ref="analyseRef" :options="getVideoAiOptions" @time-update="handleAiTime" @video-status="handleAiStatus" /> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@@ -75,6 +75,9 @@ export default defineComponent({ |
|
|
|
'update:visible': null |
|
|
|
}, |
|
|
|
setup(props, { emit }) { |
|
|
|
const originRef = ref(null) |
|
|
|
const analyseRef = ref(null) |
|
|
|
|
|
|
|
const data = reactive({ |
|
|
|
show: props.visible, |
|
|
|
mapData: null, |
|
|
@@ -144,16 +147,14 @@ export default defineComponent({ |
|
|
|
source: props.data.aiVideoUrl |
|
|
|
} |
|
|
|
}) |
|
|
|
const videoRef = ref(null) |
|
|
|
const aiVideoRef = ref(null) |
|
|
|
|
|
|
|
const handleOriginStatus = function(params) { |
|
|
|
switch (params.status) { |
|
|
|
case 'pause': |
|
|
|
aiVideoRef.value?.pauseVideo() |
|
|
|
analyseRef.value?.pauseVideo() |
|
|
|
break |
|
|
|
case 'play': |
|
|
|
aiVideoRef.value.playVideo() |
|
|
|
analyseRef.value.playVideo() |
|
|
|
break |
|
|
|
case 'ready': |
|
|
|
data.videoStatus.status = params.status |
|
|
@@ -166,10 +167,10 @@ export default defineComponent({ |
|
|
|
const handleAiStatus = function(params) { |
|
|
|
switch (params.status) { |
|
|
|
case 'pause': |
|
|
|
videoRef.value?.pauseVideo() |
|
|
|
originRef.value?.pauseVideo() |
|
|
|
break |
|
|
|
case 'play': |
|
|
|
videoRef.value.playVideo() |
|
|
|
originRef.value.playVideo() |
|
|
|
break |
|
|
|
case 'ready': |
|
|
|
data.videoStatus.aiStatus = params.status |
|
|
@@ -185,7 +186,7 @@ export default defineComponent({ |
|
|
|
} |
|
|
|
const len = Math.abs(params.currentTime - data.aiVideoInfo.currentTime) |
|
|
|
if ((params.status === 'skip' || len > 3) && data.canSkip) { |
|
|
|
aiVideoRef.value?.seekTime(params.currentTime + 0.1) |
|
|
|
analyseRef.value?.seekTime(params.currentTime + 0.1) |
|
|
|
data.canSkip = false |
|
|
|
setTimeout(() => { |
|
|
|
data.canSkip = true |
|
|
@@ -198,7 +199,7 @@ export default defineComponent({ |
|
|
|
} |
|
|
|
const len = Math.abs(params.currentTime - data.videoInfo.currentTime) |
|
|
|
if ((params.status === 'skip' || len > 3) && data.canSkip) { |
|
|
|
videoRef.value?.seekTime(params.currentTime + 0.1) |
|
|
|
originRef.value?.seekTime(params.currentTime + 0.1) |
|
|
|
data.canSkip = false |
|
|
|
setTimeout(() => { |
|
|
|
data.canSkip = true |
|
|
@@ -207,8 +208,8 @@ export default defineComponent({ |
|
|
|
} |
|
|
|
/* 播放视频 */ |
|
|
|
const startAllVideo = function() { |
|
|
|
videoRef.value.playVideo() |
|
|
|
aiVideoRef.value.playVideo() |
|
|
|
originRef.value.playVideo() |
|
|
|
analyseRef.value.playVideo() |
|
|
|
} |
|
|
|
|
|
|
|
/* 获取轨迹数据 */ |
|
|
@@ -222,27 +223,26 @@ export default defineComponent({ |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
watch(() => data.videoStatus, (status) => { |
|
|
|
if (status.status === 'ready' && status.aiStatus === 'ready') { |
|
|
|
startAllVideo() |
|
|
|
} |
|
|
|
}, { deep: true }) |
|
|
|
watch(() => props.visible, (value) => { |
|
|
|
if (value) { |
|
|
|
if (document.getElementById('history-map')) { |
|
|
|
initMap() |
|
|
|
} else { |
|
|
|
setTimeout(() => { |
|
|
|
watch([() => props.visible, () => data.videoStatus], ([visible, status]) => { |
|
|
|
if (visible) { |
|
|
|
nextTick(() => { |
|
|
|
if (!data.mapData) { |
|
|
|
initMap() |
|
|
|
getTrackData().then(res => { |
|
|
|
if (res.trackList.length > 0) { |
|
|
|
initTrack(formatTradeList(res.trackList), 'route') |
|
|
|
} |
|
|
|
}) |
|
|
|
}, 500) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
} else { |
|
|
|
originRef.value?.disposeVideo() |
|
|
|
analyseRef.value?.disposeVideo() |
|
|
|
} |
|
|
|
}) |
|
|
|
if (status.status === 'ready' && status.aiStatus === 'ready') { |
|
|
|
startAllVideo() |
|
|
|
} |
|
|
|
}, { deep: true }) |
|
|
|
|
|
|
|
/* 初始化地图 */ |
|
|
|
const initMap = function() { |
|
|
@@ -342,8 +342,8 @@ export default defineComponent({ |
|
|
|
|
|
|
|
return { |
|
|
|
...toRefs(data), |
|
|
|
videoRef, |
|
|
|
aiVideoRef, |
|
|
|
originRef, |
|
|
|
analyseRef, |
|
|
|
getDrawerOptions, |
|
|
|
handleOriginStatus, |
|
|
|
handleAiStatus, |