From ad1d435370f45b035e569e7130dd86ffee25e2b1 Mon Sep 17 00:00:00 2001 From: Joe <1712833832@qq.com> Date: Mon, 5 Feb 2024 10:19:04 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=86=E9=A2=91=E4=BF=AE=E6=94=B9=E6=8F=90?= =?UTF-8?q?=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/Video/videoStream.js | 35 ++----------------- 1 file changed, 2 insertions(+), 33 deletions(-) diff --git a/ruoyi-ui/src/views/JiHeExpressway/components/Video/videoStream.js b/ruoyi-ui/src/views/JiHeExpressway/components/Video/videoStream.js index f48bca3f..b2946f6d 100644 --- a/ruoyi-ui/src/views/JiHeExpressway/components/Video/videoStream.js +++ b/ruoyi-ui/src/views/JiHeExpressway/components/Video/videoStream.js @@ -108,34 +108,13 @@ export class HttpLivePlayer { return Message.error("浏览器不支持播放 flv 视频流"); this.initLiveVideo(); + getUrl(options).then((url) => { this.url = url; this.initLiveVideo(); }); } - // async getUrl({ camId, url, pileNum } = {}) { - // this.url = url; - - // if (pileNum) { - // const { code, data } = await getNearCamera(pileNum).catch(() => ({})); - // if (code != 200 || !data?.length) return; - - // camId = data[0].camId; - // } - - // if (camId) { - // const { code, data } = await getCameraStream(camId).catch(() => ({})); - // if (code != 200) return; - - // url = data.liveUrl; - // } - - // if (!url) return Promise.reject("获取 url 失败!"); - - // this.url = url; - // } - destroy() { if (!this.player) return; @@ -148,11 +127,9 @@ export class HttpLivePlayer { initLiveVideo() { this.destroy(); - + this.player = null; this.lastDecodedFrames = null; - console.log(this.url); - if (!this.url) return; this.player = flvJs.createPlayer( @@ -160,8 +137,6 @@ export class HttpLivePlayer { type: "flv", url: this.url, isLive: true, - hasVideo: true, - hasAudio: false, }, { autoCleanupSourceBuffer: true, @@ -200,12 +175,6 @@ export class HttpLivePlayer { console.log("errorType", errorType); console.log("errorDetail", errorDetail); console.log("errorInfo", errorInfo); - // 视频出错后销毁重建 - this.player.pause(); - this.player.unload(); - this.player.detachMediaElement(); - this.destroy(); - this.player = null; this.initLiveVideo(); });