panlinlin
2021-04-13 123ce171d2b8ca97d9f4011a33ce4e5e8d1cc339
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<template>
    <div id="player">
        <div id="easyplayer"></div>
    </div>
</template>
 
<script>
export default {
    name: 'player',
    data() {
        return {
            easyPlayer: null
        };
    },
    props: ['videoUrl', 'error', 'hasaudio'],
    mounted () {
       this.$nextTick(() =>{
           console.log("初始化时的地址为: " + this.videoUrl)
            this.easyPlayer = new WasmPlayer(null, 'easyplayer', this.eventcallbacK)
            this.easyPlayer.play(this.videoUrl, 1)
        })
    },
    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();
    },
}
</script>
 
<style>
    .LodingTitle {
        min-width: 70px;
    }
    /* 隐藏logo */
    /* .iconqingxiLOGO {
        display: none !important;
    } */
 
</style>