index.vue
5 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<template>
<div>
<div class="box">
<div class="first_item"></div>
<!--商品列表-->
<div class="item">
<div @click="link(1)">
</div>
<div @click="link(2)">
</div>
</div>
<!--视频-->
<div>
<div class="video_box">
<video-player class="video-player vjs-custom-skin" @play="onPlayerPlay($event)"
ref="videoPlayer"
:playsinline="playsinline"
:options="playerOptions"
x5-playsinline
webkit-playsinline>
</video-player>
</div>
</div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<!--视频-->
<div>
<div class="video_box">
<video-player class="video-player vjs-custom-skin" @play="onPlayerPlay($event)"
ref="videoPlayer"
:playsinline="playsinline"
:options="playerOptions"
x5-playsinline
webkit-playsinline>
</video-player>
</div>
</div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
</div>
</template>
<script>
import { videoPlayer } from 'vue-video-player';
import 'video.js/dist/video-js.css';
import '../../../static/css/video.css';
export default {
name: 'index',
data () {
return {
playsinline: true,
playerOptions: {
events: [],
playbackRates: [0.5, 1.0, 1.5, 2.0], // 播放速度
autoplay: false, // 如果true,浏览器准备好时开始回放。
controls: true, // 控制条
preload: 'auto', // 视频预加载
muted: false, // 默认情况下将会消除任何音频。
loop: false, // 导致视频一结束就重新开始。
language: 'zh-CN',
controlBar: {
timeDivider: true,
durationDisplay: true
},
aspectRatio: '16:9', // 将播放器置于流畅模式,并在计算播放器的动态大小时使用该值。值应该代表一个比例 - 用冒号分隔的两个数字(例如"16:9"或"4:3")
fluid: true, // 当true时,Video.js player将拥有流体大小。换句话说,它将按比例缩放以适应其容器。
sources: [{
type: "video/mp4",
src: "http://wjj.ys2.cnliveimg.com/769/shop/video/2019/03/03/5c7bebffe2a35.MP4"
}],
hls: true, // 启用hls?
poster: './static/img/index/video1.png', // 你的封面地址
width: document.documentElement.clientWidth || document.body.clientWidth,
notSupportedMessage: '此视频暂无法播放,请稍后再试' // 允许覆盖Video.js无法播放媒体源时显示的默认信息。
}
}
},
components:{
videoPlayer
},
created(){
document.title = '崇学向上'
},
methods: {
link(index){
if(index==='1'){
window.location.href = "https://wjjshop.cnlive.com/html/mall/1/#/pages/main/detail/detail?id=9520356&uid=10515293"
}else{
window.location.href = "https://wjjshop.cnlive.com/html/mall/1/#/pages/main/detail/detail?id=9520356&uid=10515293"
}
},
/**
* 视频播放
* @param {object} $event [播放器对象]
*/
onPlayerPlay($event) {
if(this.isiPhone.value && window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.CNDSPlayer) {
window.webkit.messageHandlers.CNDSPlayer.postMessage({body: {
playUrl:"https://v.youku.com/v_show/id_XNDQyOTAxNjE2MA==.html?s=e438e14b3fa94613a1bb&scm=20140719.manual.15319.show_e438e14b3fa94613a1bb",
// playUrl: this.playerOptions.sources[0].src, // 视频URL
isLive: 0 // 0录播1直播
}});
}
},
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style rel="stylesheet/less" lang="less" scoped>
@import "index";
</style>