Skip to content

Commit 3f4f56f

Browse files
authored
Merge pull request #131 from hyperaudio/130-videojs-bc
130 videojs bc
2 parents 14359b2 + e9c73c2 commit 3f4f56f

File tree

2 files changed

+1037
-2
lines changed

2 files changed

+1037
-2
lines changed

js/hyperaudio-lite.js

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*! (C) The Hyperaudio Project. MIT @license: en.wikipedia.org/wiki/MIT_License. */
2-
/*! Version 2.0.19 */
2+
/*! Version 2.0.20 */
33

44
'use strict';
55

@@ -53,9 +53,32 @@ function soundcloudPlayer(instance) {
5353
}
5454
}
5555

56-
function vimeoPlayer(instance) {
56+
function videojsPlayer(instance) {
5757
const tag = document.createElement('script');
5858

59+
this.player = videojs.getPlayer(instance.player.id);
60+
61+
this.getTime = () => {
62+
return new Promise((resolve) => {
63+
resolve(this.player.currentTime());
64+
});
65+
}
66+
67+
this.setTime = (seconds) => {
68+
this.player.currentTime(seconds);
69+
}
70+
71+
this.play = () => {
72+
this.player.play();
73+
}
74+
75+
this.pause = () => {
76+
this.player.pause();
77+
}
78+
}
79+
80+
function vimeoPlayer(instance) {
81+
const tag = document.createElement('script');
5982

6083
const iframe = document.querySelector('iframe');
6184
this.player = new Vimeo.Player(iframe);
@@ -135,6 +158,7 @@ const hyperaudioPlayerOptions = {
135158
"native": nativePlayer,
136159
"soundcloud": soundcloudPlayer,
137160
"youtube": youtubePlayer,
161+
"videojs": videojsPlayer,
138162
"vimeo": vimeoPlayer
139163
}
140164

0 commit comments

Comments
 (0)