Browse Source

视频问题修改, 行车诱导修改

wangqin
zhangzhang 1 year ago
parent
commit
0b928fc433
  1. 4
      ruoyi-ui/src/views/JiHeExpressway/components/Video/Video.vue
  2. 38
      ruoyi-ui/src/views/JiHeExpressway/components/Video/videoStream.js
  3. 3
      ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/DrivingGuidance/index.vue

4
ruoyi-ui/src/views/JiHeExpressway/components/Video/Video.vue

@ -22,8 +22,8 @@ export default {
}
},
async mounted() {
const player = await openLiveVideo(this.$refs.videoContainerRef, { camId: this.camId, url: this.url, pileNum: this.pileNum })
// const player = new HttpLivePlayer(this.$refs.videoContainerRef, { camId: this.camId, url: this.url, pileNum: this.pileNum });
// const player = await openLiveVideo(this.$refs.videoContainerRef, { camId: this.camId, url: this.url, pileNum: this.pileNum })
const player = new HttpLivePlayer(this.$refs.videoContainerRef, { camId: this.camId, url: this.url, pileNum: this.pileNum });
this.$once("hook:beforeDestroy", () => player?.destroy());
}

38
ruoyi-ui/src/views/JiHeExpressway/components/Video/videoStream.js

@ -107,8 +107,6 @@ export class HttpLivePlayer {
if (!flvJs.getFeatureList().mseLiveFlvPlayback)
return Message.error("浏览器不支持播放 flv 视频流");
this.initLiveVideo();
getUrl(options).then((url) => {
this.url = url;
this.initLiveVideo();
@ -140,7 +138,7 @@ export class HttpLivePlayer {
},
{
autoCleanupSourceBuffer: true,
enableWorker: true, // 启用分离的线程进行转换
// enableWorker: true, // 启用分离的线程进行转换
enableStashBuffer: false, // 关闭IO隐藏缓冲区 如果您需要实时(最小延迟)来进行实时流播放,则设置为false
stashInitialSize: 128,
isLive: true,
@ -153,23 +151,23 @@ export class HttpLivePlayer {
this.player.load();
this.player.play();
this.container.addEventListener("progress", () => {
let end = player.buffered.end(0); //获取当前buffered值(缓冲区末尾)
let delta = end - player.currentTime; //获取buffered与当前播放位置的差值
// this.container.addEventListener("progress", () => {
// let end = this.player.buffered.end(0); //获取当前buffered值(缓冲区末尾)
// let delta = end - this.player.currentTime; //获取buffered与当前播放位置的差值
// 延迟过大,通过跳帧的方式更新视频
if (delta > 10 || delta < 0) {
this.player.currentTime = this.player.buffered.end(0) - 1;
return;
}
// // 延迟过大,通过跳帧的方式更新视频
// if (delta > 10 || delta < 0) {
// this.player.currentTime = this.player.buffered.end(0) - 1;
// return;
// }
// 追帧
if (delta > 1) {
this.container.playbackRate = 1.1;
} else {
this.container.playbackRate = 1;
}
});
// // 追帧
// if (delta > 1) {
// this.container.playbackRate = 1.1;
// } else {
// this.container.playbackRate = 1;
// }
// });
this.player.on(flvJs.Events.ERROR, (errorType, errorDetail, errorInfo) => {
console.log("errorType", errorType);
@ -222,8 +220,8 @@ export async function openLiveVideo(container, options) {
{
autoCleanupSourceBuffer: true,
enableWorker: true, // 启用分离的线程进行转换
enableStashBuffer: false, // 关闭IO隐藏缓冲区 如果您需要实时(最小延迟)来进行实时流播放,则设置为false
stashInitialSize: 128,
// enableStashBuffer: false, // 关闭IO隐藏缓冲区 如果您需要实时(最小延迟)来进行实时流播放,则设置为false
// stashInitialSize: 128,
isLive: true,
lazyLoad: true,
}

3
ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/DrivingGuidance/index.vue

@ -15,7 +15,8 @@
</div>
</div>
<DeviceControlDialog v-model="deviceControlVisible" :deviceId="dialogData.iotDeviceId || '8697-1'" />
<!-- <DeviceControlDialog v-model="deviceControlVisible" :deviceId="dialogData.iotDeviceId || '8697-1'" /> -->
<DeviceControlDialog v-model="deviceControlVisible" :deviceId="dialogData.iotDeviceId" />
</Dialog>
</template>

Loading…
Cancel
Save