-
Notifications
You must be signed in to change notification settings - Fork 0
/
video.js.html
49 lines (45 loc) · 1.37 KB
/
video.js.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>videoJs</title>
<link href="https://vjs.zencdn.net/7.6.6/video-js.css" rel="stylesheet" />
<!-- If you'd like to support IE8 (for Video.js versions prior to v7) -->
<script src="https://vjs.zencdn.net/ie8/1.1.2/videojs-ie8.min.js"></script>
</head>
<body>
<section id="videoPlayer">
<video id="my-video" width="600" height="300" class="video-js vjs-default-skin vjs-big-play-centered" poster="">
<source src='http://81.70.101.129:10000/sms/34020000002020000001/hls/34020000002000000001_34020000001320000001/live.m3u8' type="application/x-mpegURL" id="target">
</video>
</section>
<script src="https://vjs.zencdn.net/7.6.6/video.js"></script>
<script type="text/javascript">
var player = videojs('my-video', {
"poster": "",
"controls": "true",
// autoplay: 'muted',
muted: true
}, function () {
console.log('播放器创建好了。')
this.play();
this.on('play', function () {
console.log('正在播放');
});
//暂停--播放完毕后也会暂停
this.on('pause', function () {
console.log("暂停中")
});
// 结束
this.on('ended', function () {
console.log('结束');
})
this.on('error', (error) => {
console.log('播放错误', error)
this.dispose();
player = null;
})
});
</script>
</body>
</html>