From 7843f42b29f8272ff02c5e50e328158faac07da0 Mon Sep 17 00:00:00 2001 From: hui <770260999@qq.com> Date: Tue, 19 Mar 2024 21:42:11 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../JiHeExpressway/components/Video/Video.vue | 31 ++++++++++++++----- .../components/Dialogs/SmartDevice/index.vue | 4 +-- ruoyi-ui/vue.config.js | 3 +- 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/ruoyi-ui/src/views/JiHeExpressway/components/Video/Video.vue b/ruoyi-ui/src/views/JiHeExpressway/components/Video/Video.vue index 24faf33c..ce4b9d86 100644 --- a/ruoyi-ui/src/views/JiHeExpressway/components/Video/Video.vue +++ b/ruoyi-ui/src/views/JiHeExpressway/components/Video/Video.vue @@ -10,6 +10,11 @@ import { HttpLivePlayer, openLiveVideo } from "./videoStream.js" export default { name: 'Video', + data(){ + return { + player:null + } + }, props: { camId: { type: String, @@ -32,18 +37,30 @@ export default { default: 0 } }, + watch:{ + camId:{ + handler(newV){ + this.playVideo(); + }, + immediate: true + } + }, async mounted() { // setTimeout(() => { // this.$nextTick(() => { - if (this.videoType == 'flv') { - // 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, rangeIndex: this.rangeIndex }); - - this.$once("hook:beforeDestroy", () => player?.destroy()); - } + this.playVideo(); + this.$once("hook:beforeDestroy", () => this.player?.destroy()); // }) // }) - + }, + methods:{ + playVideo() { + this.player?.destroy(); + if (this.videoType == 'flv') { + // const player = await openLiveVideo(this.$refs.videoContainerRef, { camId: this.camId, url: this.url, pileNum: this.pileNum }) + this.player = new HttpLivePlayer(this.$refs.videoContainerRef, { camId: this.camId, url: this.url, pileNum: this.pileNum, rangeIndex: this.rangeIndex }); + } + } } } diff --git a/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/SmartDevice/index.vue b/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/SmartDevice/index.vue index 5f8bf7dd..c621f52f 100644 --- a/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/SmartDevice/index.vue +++ b/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/SmartDevice/index.vue @@ -15,9 +15,9 @@ -