视频切换的问题

This commit is contained in:
aixianling
2024-08-23 18:09:52 +08:00
parent 397ab462e8
commit 10649673b2
2 changed files with 31 additions and 21 deletions

View File

@@ -78,7 +78,7 @@ Vue.prototype.$storeBoard = Vue.observable({
search: {}
})
Vue.component("HlsPlayer", {
render: (h) => h('div', {style: {width: '100%', height: '100%'}, on: {dbclick: () => this.player.play()}}),
render: (h) => h('div', {style: {width: '100%', height: '100%'}}),
props: {
id: {default: ""},
url: {default: "https://open.ys7.com/v3/openlive/155715496_1_1.m3u8?expire=1747359002&id=712960386311127040&t=c9c6ad362940b1fb4ea7a736cec78980aa9ad1d27d6e3eddf75788c0564e9d7b&ev=100"}
@@ -88,22 +88,29 @@ Vue.component("HlsPlayer", {
player: null
}
},
mounted() {
const {EzuikitFlv} = window
if (EzuikitFlv && this.url) {
const {id} = this.$props
this.$el.id = id
this.player = new EzuikitFlv({
container: id,
url: this.url,
decoder: "/presource/datascreen/js/ezuikit-flv/decoder.js"
})
this.player.play()
this.$el.addEventListener('dblclick', () => {
this.player.fullScreen()
})
methods: {
play(url) {
const {EzuikitFlv} = window
if (EzuikitFlv && url && this.$el) {
const {id} = this.$props
this.$el.id = id
this.player = new EzuikitFlv({container: id, url, decoder: "/presource/datascreen/js/ezuikit-flv/decoder.js"})
this.player.play()
this.$el.onclick = () => this.player.fullScreen()
}
}
},
watch: {
url: {
handler(url, old) {
if (old) this.player?.destroy()
this.play(url)
}
}
},
mounted() {
this.play(this.url)
},
beforeDestroy() {
this.player?.destroy()
}
@@ -162,7 +169,7 @@ Vue.component("scrollTable", {
}
},
mounted() {
this.initScroll()
this.initScroll()
// this.autoScroll()
},
beforeDestroy() {