lineClassDetail.vue
2.9 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<template >
<div class="lineclass">
<nav-bar class="lineclassnavbar">
<div slot="left" class="lineclassback" @click="goBack">
<img src="../../assets/img/back3.png" alt=""/>
</div>
<div slot="center" class="lineclasscenter">
{{detail.name}}
</div>
<div slot="right"></div>
</nav-bar>
<div class="video">
<video-player ref="videoPlayer"
class="vjs-custom-skin"
:options="playerOptions"
@play="onPlayerPlay($event)"
@ready="onPlayerReady($event)">
</video-player>
<!-- <div id="id_test_video" style="width:100%; height:auto;"></div> -->
</div>
</div>
</template>
<script>
import '@/assets/style/lineClassDetail.css'
export default {
data () {
return {
id: '',
msg: '',
detail: '',
playerOptions: {
autoplay: true,
controls: true,
notSupportedMessage: '此视频暂无法播放,请稍后再试',
controlBar: {
timeDivider: false,
durationDisplay: false
}
// poster: 'https://surmon-china.github.io/vue-quill-editor/static/images/surmon-5.jpg'
}
}
},
mounted () {
this.id = this.$route.query.id
// this.getDetail()
},
computed: {
player () {
return this.$refs.videoPlayer.player
}
},
methods: {
onPlayerPlay (player) {
console.log('player play!', player)
},
onPlayerReady (player) {
console.log('player ready!', player)
this.player.play()
},
playVideo: function (source) {
const video = {
withCredentials: false,
type: 'application/x-mpegURL',
src: source
}
this.player.reset()
this.player.src(video)
this.player.play()
},
goBack () {
this.$router.go(-1)
},
async getDetail () {
const params = {
id: this.id
}
const reslist = await this.api.lineclassdetail(params)
if (reslist.code == 1) {
this.detail = reslist.data.detail
this.playVideo(this.detail.playback_url)
}
}
}
}
</script>
<style scoped lang="scss">
.vcp-player .marker{
position: absolute;
font-size: 20px;
color: rgba(255, 255, 255, .5);
top: 0;
right: 5px;
}
.left{
width: 0.6rem !important;
}
.lineclassback{
width: 0.6rem !important;
}
.lineclasscenter{
text-align: left;
width: 7.6rem;
}
.player {
position: absolute !important;
width: 100%;
height: 100%;
}
.vjs-custom-skin {
width: 100% !important;
height: 100% !important;
}
.vjs-custom-skin /deep/ .video-js {
width: 100%;
height: 100%;
}
.vjs-custom-skin /deep/ .video-js .vjs-big-play-button{
top: 50% !important;
left: 50% !important;
transform: translate(-50%,-50%) !important;
}
</style>