2021-04-12 11:51:47 +08:00
|
|
|
<template>
|
2021-06-01 17:05:07 +08:00
|
|
|
<div id="easyplayer"></div>
|
2021-04-12 11:51:47 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
name: 'player',
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
easyPlayer: null
|
|
|
|
};
|
|
|
|
},
|
2021-06-01 17:05:07 +08:00
|
|
|
props: ['videoUrl', 'error', 'hasaudio', 'height'],
|
2021-04-12 11:51:47 +08:00
|
|
|
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)
|
2021-06-01 17:05:07 +08:00
|
|
|
this.play(this.videoUrl)
|
2021-04-12 11:51:47 +08:00
|
|
|
})
|
|
|
|
},
|
|
|
|
watch:{
|
|
|
|
videoUrl(newData, oldData){
|
2021-06-01 17:05:07 +08:00
|
|
|
this.play(newData)
|
2021-04-12 11:51:47 +08:00
|
|
|
},
|
|
|
|
immediate:true
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
play: function (url) {
|
2021-06-01 17:05:07 +08:00
|
|
|
console.log(this.height)
|
|
|
|
if (this.easyPlayer != null) {
|
|
|
|
this.easyPlayer.destroy();
|
|
|
|
}
|
|
|
|
if (typeof (this.height) == "undefined") {
|
|
|
|
this.height = false
|
|
|
|
}
|
|
|
|
this.easyPlayer = new WasmPlayer(null, 'easyplayer', this.eventcallbacK, {Height: this.height})
|
2021-04-12 11:51:47 +08:00
|
|
|
this.easyPlayer.play(url, 1)
|
|
|
|
},
|
|
|
|
pause: function () {
|
2021-06-01 17:05:07 +08:00
|
|
|
this.easyPlayer.destroy();
|
|
|
|
this.easyPlayer = null
|
2021-04-12 11:51:47 +08:00
|
|
|
},
|
|
|
|
eventcallbacK: function(type, message) {
|
2021-06-01 17:05:07 +08:00
|
|
|
// console.log("player 事件回调")
|
|
|
|
// console.log(type)
|
|
|
|
// console.log(message)
|
2021-04-12 11:51:47 +08:00
|
|
|
}
|
|
|
|
},
|
2021-04-13 15:08:09 +08:00
|
|
|
destroyed() {
|
|
|
|
this.easyPlayer.destroy();
|
|
|
|
},
|
2021-04-12 11:51:47 +08:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
.LodingTitle {
|
|
|
|
min-width: 70px;
|
|
|
|
}
|
|
|
|
/* 隐藏logo */
|
|
|
|
/* .iconqingxiLOGO {
|
|
|
|
display: none !important;
|
|
|
|
} */
|
|
|
|
|
|
|
|
</style>
|