Skip to content

Commit

Permalink
Merge pull request #122 from scarsellifi/vimeo
Browse files Browse the repository at this point in the history
Vimeo - add vimeoPlayer and vimeo.html demo

This addresses issue #118
  • Loading branch information
maboa authored Sep 14, 2022
2 parents b433d13 + 44de545 commit ec65375
Show file tree
Hide file tree
Showing 2 changed files with 292 additions and 1 deletion.
32 changes: 31 additions & 1 deletion js/hyperaudio-lite.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,35 @@ function soundcloudPlayer(instance) {
}
}

function vimeoPlayer(instance) {
const tag = document.createElement('script');


const iframe = document.querySelector('iframe');
this.player = new Vimeo.Player(iframe);
this.player.setCurrentTime(0)
this.player.ready().then(instance.checkPlayHead);

this.getTime = () => {
return new Promise((resolve) => {
resolve(this.player.getCurrentTime());
});
}

this.setTime = (seconds) => {
this.player.setCurrentTime(seconds);
}

this.play = () => {
this.player.play();
}

this.pause = () => {
this.player.pause();
}
}


function youtubePlayer(instance) {
const tag = document.createElement('script');
tag.id = 'iframe-demo';
Expand Down Expand Up @@ -105,7 +134,8 @@ function youtubePlayer(instance) {
const hyperaudioPlayerOptions = {
"native": nativePlayer,
"soundcloud": soundcloudPlayer,
"youtube": youtubePlayer
"youtube": youtubePlayer,
"vimeo": vimeoPlayer
}

function hyperaudioPlayer(playerType, instance) {
Expand Down
Loading

0 comments on commit ec65375

Please sign in to comment.