wvp-gb28181-project/web_src/src/components/dialog/easyPlayer.vue

65 lines
1.6 KiB
Vue
Raw Normal View History

2021-04-12 11:51:47 +08:00
<template>
<div id="player">
<div id="easyplayer"></div>
</div>
</template>
<script>
export default {
name: 'player',
data() {
return {
easyPlayer: null
};
},
props: ['videoUrl', 'error', 'hasaudio'],
mounted () {
2021-05-06 10:44:16 +08:00
let paramUrl = decodeURIComponent(this.$route.params.url)
2021-04-12 11:51:47 +08:00
this.$nextTick(() =>{
2021-05-06 10:44:16 +08:00
if (typeof (this.videoUrl) == "undefined") {
this.videoUrl = paramUrl;
}
console.log("初始化时的地址为: " + this.videoUrl)
this.easyPlayer = new WasmPlayer(null, 'easyplayer', this.eventcallbacK)
this.easyPlayer.play(this.videoUrl, 1)
2021-04-12 11:51:47 +08:00
})
},
watch:{
videoUrl(newData, oldData){
this.easyPlayer.destroy()
this.easyPlayer = new WasmPlayer(null, 'easyplayer', this.eventcallbacK)
this.easyPlayer.play(newData, 1)
},
immediate:true
},
methods: {
play: function (url) {
this.easyPlayer = new WasmPlayer(null, 'easyplayer', this.eventcallbacK)
this.easyPlayer.play(url, 1)
},
pause: function () {
this.easyPlayer.destroy();
},
eventcallbacK: function(type, message) {
console.log("player 事件回调")
console.log(type)
console.log(message)
}
},
destroyed() {
this.easyPlayer.destroy();
},
2021-04-12 11:51:47 +08:00
}
</script>
<style>
.LodingTitle {
min-width: 70px;
}
/* 隐藏logo */
/* .iconqingxiLOGO {
display: none !important;
} */
</style>