-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.html
55 lines (47 loc) · 1.65 KB
/
test.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
50
51
52
53
54
55
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>videojs-contrib-hls embed</title>
<script src="//cdn.bootcss.com/jquery/3.1.1/jquery.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/video.js/5.10.2/alt/video-js-cdn.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/video.js/5.10.2/video.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/videojs-contrib-hls/3.0.2/videojs-contrib-hls.js"></script>
</head>
<body>
<h1>Video.js Example Embed</h1>
<div id="show"></div>
<!--
<video id="my_video_1" class="video-js vjs-default-skin" controls preload="auto" width="640" height="268"
data-setup='{}'>
<source src="http://solutions.brightcove.com/jwhisenant/hls/apple/bipbop/bipbopall.m3u8" type="application/x-mpegURL">
</video>
-->
<script>
var url = 'http://solutions.brightcove.com/jwhisenant/hls/apple/bipbop/bipbopall.m3u8';
var id = 'my_video_1';
var play = function(id, url){
try{
videojs(id).src({
src: url,
type: 'application/x-mpegURL'
});
}catch (e){
console.error("play error", e);
}
}
var show = function(){
$("#show").empty();
var html = "";
html = '<video id="'+id+'" class="video-js vjs-default-skin" controls preload="auto" width="640" height="268" data-setup="{}"> </video>'
html += '<button type="button" class="btn btn-primary">刷新</button>'
$("#show").append(html);
play(id, url);
}
$("#show").on('click', '.btn-primary', function () {
show();
})
show();
</script>
</body>
</html>