diff options
| author | Jules Laplace <jules@okfoc.us> | 2014-07-14 15:21:12 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2014-07-14 15:21:12 -0400 |
| commit | 9fe187effeaf4a2e6205e2f1f52b32b8823f4f10 (patch) | |
| tree | dee1dca9684bffa271ec4715412fa9f0538a9bc6 /public/assets/javascripts/mx/primitives/mx.video.js | |
| parent | 9825b711480eb5b6022ce6b56b8a6914c5f43e52 (diff) | |
muting, autoplay, loop
Diffstat (limited to 'public/assets/javascripts/mx/primitives/mx.video.js')
| -rw-r--r-- | public/assets/javascripts/mx/primitives/mx.video.js | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/public/assets/javascripts/mx/primitives/mx.video.js b/public/assets/javascripts/mx/primitives/mx.video.js index f92fe9f..c5dd749 100644 --- a/public/assets/javascripts/mx/primitives/mx.video.js +++ b/public/assets/javascripts/mx/primitives/mx.video.js @@ -30,6 +30,7 @@ MX.Video = MX.Object3D.extend({ this.player = document.createElement('video') this.player.addEventListener("loadedmetadata", this.ready.bind(this)) this.player.addEventListener("error", this.error.bind(this)) + this.player.addEventListener("ended", this.finished.bind(this)) this.player.width = this.width this.player.height = this.height this.player.src = this.media.url @@ -68,13 +69,25 @@ MX.Video = MX.Object3D.extend({ this.player.currentTime = n }, + mute: function(){ + this.player.muted = true + }, + + unmute: function(){ + this.player.muted = false + }, + duration: function(){ return this.player.duration }, finished: function(){ console.log("video finished") - if (this.media.bound) { + if (this.media.loop) { + this.seek(0) + this.play() + } + else if (this.bound) { $(".playButton").removeClass('playing') } }, |
