Created
November 30, 2018 15:54
-
-
Save jefBinomed/9123aea93c7bfa89d7a67ff455a1c009 to your computer and use it in GitHub Desktop.
2018-countdown-videoplayer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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