-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
63 lines (46 loc) · 1.78 KB
/
index.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
56
57
58
59
60
61
62
63
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<!-- Video.js -->
<link href="video-js.min.css" rel="stylesheet">
<script src="video.min.js"></script>
<title>Video Sample</title>
<style type="text/css">
#my-player{
width: 800px;
height: 450px;
}
</style>
</head>
<body>
<video id="my-player" class="video-js" loop muted preload="auto">
<source src="1080p.mp4" type="video/mp4"></source>
<p class="vjs-no-js">
To view this video please enable JavaScript, and consider upgrading to a web browser that <a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a>
</p>
</video>
<script>
// Initialize video tag ID
var player = videojs('my-player');
var options = {};
// Create timestamp array
var timestamp = [0,6,11];
// When load video file
var player = videojs('my-player', options, function onPlayerReady() {
// alert('Your player is ready!');
// Get a random start timestamp from the array
var currentTime = timestamp[Math.floor(Math.random() * timestamp.length)];
alert(currentTime + "秒からスタート");
// Set the random start timestamp as a propaty on a Video.js player
this.currentTime(currentTime);
// Play
this.play();
});
</script>
<p><a href="https://github.com/videojs/video.js/" target="_blank">video.js</a></p>
</body>
</html>