Skip to content

Instantly share code, notes, and snippets.

@jefBinomed
Created November 30, 2018 15:54
Show Gist options
  • Save jefBinomed/9123aea93c7bfa89d7a67ff455a1c009 to your computer and use it in GitHub Desktop.
Save jefBinomed/9123aea93c7bfa89d7a67ff455a1c009 to your computer and use it in GitHub Desktop.
2018-countdown-videoplayer
'use strict'
/**
* Class for playing video
*
*/
export class VideoPlayer {
constructor(parentElt, callBackEnd) {
this.videoElt = document.createElement('video');
parentElt.appendChild(this.videoElt);
this.videoName = 'MotionDevfest2017_HQ.mp4';
this.callBackEnd = callBackEnd;
}
/**
* Play the video
*/
playVideo() {
this.videoElt.pause();
this.videoElt.src = `./assets/video/${this.videoName}`;
this.videoElt.play();
this.videoElt.onended = this.callBackEnd.bind(this);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment