修复集成新版本Jessibuca后的播放问题

This commit is contained in:
lin
2025-10-26 21:15:44 +08:00
parent d117a0d83a
commit d6042c4e16
2 changed files with 23 additions and 36 deletions

View File

@@ -54,29 +54,13 @@ export default {
forceNoOffscreen: false 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() { created() {
const paramUrl = decodeURIComponent(this.$route.params.url) const paramUrl = decodeURIComponent(this.$route.params.url)
this.$nextTick(() => { console.log(paramUrl)
if (typeof (this.videoUrl) === 'undefined' || typeof (paramUrl) !== 'undefined') { if (!this.videoUrl && paramUrl) {
this.videoUrl = paramUrl this.videoUrl = paramUrl
} }
this.btnDom = document.getElementById('buttonsBox') this.btnDom = document.getElementById('buttonsBox')
})
}, },
mounted() {}, mounted() {},
destroyed() { destroyed() {
@@ -94,8 +78,6 @@ export default {
if (jessibucaPlayer[this._uid]) { if (jessibucaPlayer[this._uid]) {
jessibucaPlayer[this._uid].destroy() jessibucaPlayer[this._uid].destroy()
} }
console.log(1111)
console.log(this.$refs.container.dataset['jessibuca'])
if (this.$refs.container.dataset['jessibuca']) { if (this.$refs.container.dataset['jessibuca']) {
this.$refs.container.dataset['jessibuca'] = undefined this.$refs.container.dataset['jessibuca'] = undefined
} }
@@ -214,26 +196,24 @@ export default {
this.quieting = jessibuca.quieting this.quieting = jessibuca.quieting
}) })
}, },
playBtnClick: function(event) { playBtnClick: function() {
this.play(this.videoUrl) this.play(this.videoUrl)
}, },
play: function(url) { play: function(url) {
this.videoUrl = url
console.log('Jessibuca -> url: ', url) console.log('Jessibuca -> url: ', url)
if (jessibucaPlayer[this._uid]) { if (!jessibucaPlayer[this._uid]) {
this.destroy() this.create()
} }
this.create() jessibucaPlayer[this._uid].play(url)
this.$nextTick(() => {
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) // jessibucaPlayer[this._uid].play(url)
} else { })
jessibucaPlayer[this._uid].on('load', () => { }
// jessibucaPlayer[this._uid].play(url)
})
}
})
}, },
pause: function() { pause: function() {

View File

@@ -425,6 +425,13 @@ export default {
console.log(this.player[tab.name][0]) console.log(this.player[tab.name][0])
this.activePlayer = tab.name this.activePlayer = tab.name
this.videoUrl = this.getUrlByStreamInfo() 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) { openDialog: function(tab, deviceId, channelId, param) {
if (this.showVideoDialog) { if (this.showVideoDialog) {