-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathiframe.js
40 lines (39 loc) · 1.05 KB
/
iframe.js
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
'use strict';
var videos = document.getElementsByTagName("video");
for (var video of videos) {
video.classList.add("video-js");
var player = videojs(video,{
controls: true,
autoplay: false,
preload: 'metadata',
playbackRates: [0.5, 1, 1.5, 2],
sources:[
{
src: video.src,
type: video.type
}
],
userActions: {
hotkeys: function(event) {
// `spacebar` key
if (event.which === 32) {
if (this.paused()) {
this.play();
}
else
{
this.pause();
}
}
// `rightarrow` key
if (event.which === 39) {
this.currentTime(this.currentTime() + 5);
}
// `leftarrow` key
if (event.which === 37) {
this.currentTime(this.currentTime() - 5);
}
}
}
});
}