From d6042c4e165a40ca925505d444f8d422ed140749 Mon Sep 17 00:00:00 2001 From: lin <648540858@qq.com> Date: Sun, 26 Oct 2025 21:15:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=9B=86=E6=88=90=E6=96=B0?= =?UTF-8?q?=E7=89=88=E6=9C=ACJessibuca=E5=90=8E=E7=9A=84=E6=92=AD=E6=94=BE?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/views/common/jessibuca.vue | 52 +++++++++------------------ web/src/views/dialog/devicePlayer.vue | 7 ++++ 2 files changed, 23 insertions(+), 36 deletions(-) diff --git a/web/src/views/common/jessibuca.vue b/web/src/views/common/jessibuca.vue index de5ce3aa4..60580c6c9 100755 --- a/web/src/views/common/jessibuca.vue +++ b/web/src/views/common/jessibuca.vue @@ -54,29 +54,13 @@ export default { forceNoOffscreen: false } }, - watch: { - // videoUrl: { - // handler(val, _) { - // if (typeof val !== 'undefined' && val !== 'undefined') { - // console.log(22222111) - // console.log(val) - // this.$nextTick(() => { - // - // this.play(val) - // }) - // } - // }, - // immediate: true - // } - }, created() { const paramUrl = decodeURIComponent(this.$route.params.url) - this.$nextTick(() => { - if (typeof (this.videoUrl) === 'undefined' || typeof (paramUrl) !== 'undefined') { - this.videoUrl = paramUrl - } - this.btnDom = document.getElementById('buttonsBox') - }) + console.log(paramUrl) + if (!this.videoUrl && paramUrl) { + this.videoUrl = paramUrl + } + this.btnDom = document.getElementById('buttonsBox') }, mounted() {}, destroyed() { @@ -94,8 +78,6 @@ export default { if (jessibucaPlayer[this._uid]) { jessibucaPlayer[this._uid].destroy() } - console.log(1111) - console.log(this.$refs.container.dataset['jessibuca']) if (this.$refs.container.dataset['jessibuca']) { this.$refs.container.dataset['jessibuca'] = undefined } @@ -214,26 +196,24 @@ export default { this.quieting = jessibuca.quieting }) }, - playBtnClick: function(event) { + playBtnClick: function() { this.play(this.videoUrl) }, play: function(url) { + this.videoUrl = url console.log('Jessibuca -> url: ', url) - if (jessibucaPlayer[this._uid]) { - this.destroy() + if (!jessibucaPlayer[this._uid]) { + this.create() } - this.create() - this.$nextTick(() => { - jessibucaPlayer[this._uid].play(url) + jessibucaPlayer[this._uid].play(url) - if (jessibucaPlayer[this._uid].hasLoaded()) { + if (jessibucaPlayer[this._uid].hasLoaded()) { + // jessibucaPlayer[this._uid].play(url) + } else { + jessibucaPlayer[this._uid].on('load', () => { // jessibucaPlayer[this._uid].play(url) - } else { - jessibucaPlayer[this._uid].on('load', () => { - // jessibucaPlayer[this._uid].play(url) - }) - } - }) + }) + } }, pause: function() { diff --git a/web/src/views/dialog/devicePlayer.vue b/web/src/views/dialog/devicePlayer.vue index dd62d73d7..48bbaa03f 100755 --- a/web/src/views/dialog/devicePlayer.vue +++ b/web/src/views/dialog/devicePlayer.vue @@ -425,6 +425,13 @@ export default { console.log(this.player[tab.name][0]) this.activePlayer = tab.name this.videoUrl = this.getUrlByStreamInfo() + if (this.$refs[this.activePlayer]) { + this.$refs[this.activePlayer].play(this.videoUrl) + } else { + this.$nextTick(() => { + this.$refs[this.activePlayer].play(this.videoUrl) + }) + } }, openDialog: function(tab, deviceId, channelId, param) { if (this.showVideoDialog) {