flvvideo.vue
2.18 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<template>
<div class="ocxbox">
<video id="flvvideo" autoplay style="width: 100%; height: 100%" class="fvideo"></video>
<div class="control" hidden>
<!-- <span :class="{'el-icon-full-screen':!furllstatus,'el-icon-circle-close':furllstatus,'videostatus':true, 'full-icon':true}" @click="fullvideo" id="full"></span> -->
</div>
</div>
</template>
<script>
export default {
data() {
return {
show: true,
videostatus: false,
furllstatus: false,
player: "",
};
},
computed: {},
methods: {
initflv() {
if (flvjs.isSupported()) {
this.player = flv.createPlayer({
type: "flv",
});
}
},
startFunc(url) {
let playerel = document.getElementById("flvvideo");
// if (typeof player !== "undefined") {
// if (this.player != null) {
// // this.player.unload();
// // this.player.detachMediaElement();
// // this.player.destroy();
// // this.player = null;
// this.flv_destroy();
// }
// }
this.player = flvjs.createPlayer({
type: "flv",
isLive: true,
hasAudio: false,
url: url,
});
this.player.attachMediaElement(playerel);
this.player.load();
this.player.play();
},
flv_start() {
this.player.play();
},
flv_pause() {
this.player.pause();
},
flv_destroy() {
this.player.pause();
this.player.unload();
this.player.detachMediaElement();
this.player.destroy();
this.player = null;
},
},
mounted() {},
};
</script>
<style lang="stylus">
.ocxbox {
height: 100%;
position: relative;
.fvideo {
height: 100%;
width: 100%;
}
.control {
position: absolute;
bottom: 0;
height: 40px;
width: 100%;
background: rgba(255, 255, 255, 0.2);
display: none;
.videostatus {
cursor: pointer;
color: #fff;
font-size: 30px;
line-height: 40px;
padding-left: 10px;
}
.full-icon {
float: right;
margin-right: 20px;
font-size: 25px;
}
}
}
.ocxbox:hover {
.control {
// display block
cursor: pointer;
}
}
</style>