|
|
@ -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(() => { |
|
|
|
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 }) |
|
|
|
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.player = new HttpLivePlayer(this.$refs.videoContainerRef, { camId: this.camId, url: this.url, pileNum: this.pileNum, rangeIndex: this.rangeIndex }); |
|
|
|
} |
|
|
|
} |
|
|
|
// }) |
|
|
|
// }) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|