|
|
@ -10,6 +10,11 @@ import { HttpLivePlayer, openLiveVideo } from "./videoStream.js" |
|
|
|
|
|
|
|
export default { |
|
|
|
name: 'Video', |
|
|
|
data() { |
|
|
|
return { |
|
|
|
player: null |
|
|
|
} |
|
|
|
}, |
|
|
|
props: { |
|
|
|
camId: { |
|
|
|
type: String, |
|
|
@ -31,18 +36,30 @@ export default { |
|
|
|
default: 0 |
|
|
|
} |
|
|
|
}, |
|
|
|
watch: { |
|
|
|
camId: { |
|
|
|
handler(newV) { |
|
|
|
this.playVideo(); |
|
|
|
}, |
|
|
|
immediate: true |
|
|
|
} |
|
|
|
}, |
|
|
|
async mounted() { |
|
|
|
// setTimeout(() => { |
|
|
|
// this.$nextTick(() => { |
|
|
|
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.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 }) |
|
|
|
this.player = new HttpLivePlayer(this.$refs.videoContainerRef, { camId: this.camId, url: this.url, pileNum: this.pileNum, rangeIndex: this.rangeIndex }); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|