-
Notifications
You must be signed in to change notification settings - Fork 7
/
index.html
128 lines (102 loc) · 2.9 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
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
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Video.js BIF</title>
<meta name="description" content="Video.js plugin for supporting BIF.">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="apple-touch-icon" href="apple-touch-icon.png">
<!-- Place favicon.ico in the root directory -->
<link href="node_modules/video.js/dist/video-js.css" rel="stylesheet">
<style>
.bif
{
bottom: 1.75em;
position: absolute;
transform: translateX(-50%);
width: 10em;
}
.bif-image
{
display: block;
width: 100%;
}
.bif-time
{
background: black;
display: inline-block;
font-size: 0.6em;
line-height: normal;
overflow: hidden;
padding: 5px 10px;
}
.bif-image + .bif-time
{
display: block;
}
.vjs-mouse-display::after
{
display: none !important;
}
</style>
</head>
<body>
<video id="player" class="video-js vjs-default-skin" width="600" height="250" controls>
<source src="http://distribution.bbb3d.renderfarming.net/video/mp4/bbb_sunflower_1080p_60fps_normal.mp4" type="video/mp4" />
<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>
<p>
<label>
File: <input id="file" type="file" />
</label>
</p>
<p>
<label>
Frame Number: <input id="frame_number" min="0" type="number" />
</label>
</p>
<p>
<img id="frame" />
</p>
<script src="node_modules/video.js/dist/video.js"></script>
<script src="videojs.bif.js"></script>
<script>
const file = document.getElementById('file');
const frame = document.getElementById('frame');
const frameNumber = document.getElementById('frame_number');
file.addEventListener('change', (event) => {
const file = event.target.files[0];
if (!file) {
return;
}
const reader = new FileReader();
reader.addEventListener('load', (event) => {
videojs('player').ready(function () {
this.bif({
data: event.target.response,
});
});
});
reader.readAsArrayBuffer(file);
});
frameNumber.addEventListener('change', (event) => {
const { BIFMouseTimeDisplay } = videojs('player').controlBar.progressControl.seekBar;
if (!BIFMouseTimeDisplay.hasImages()) {
return;
}
const time = event.target.value;
frame.src = BIFMouseTimeDisplay.BIFParser.getImageDataAtSecond(time);
});
// initialize the plugin
videojs('player').ready(function () {
this.bif({
src: 'https://dmadisney.akamaized.net/extra_unencrypted/bif/02/ABC123_1464745270159_3000k_hd_video-SD.bif',
});
});
</script>
</body>
</html>