diff options
Diffstat (limited to 'public/assets/javascripts/mx/primitives/mx.vimeo.js')
| -rw-r--r-- | public/assets/javascripts/mx/primitives/mx.vimeo.js | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/public/assets/javascripts/mx/primitives/mx.vimeo.js b/public/assets/javascripts/mx/primitives/mx.vimeo.js index 64d9103..4922519 100644 --- a/public/assets/javascripts/mx/primitives/mx.vimeo.js +++ b/public/assets/javascripts/mx/primitives/mx.vimeo.js @@ -19,11 +19,10 @@ MX.Vimeo = MX.Object3D.extend({ ops.className && this.el.classList.add(ops.className) this.backface && this.el.classList.add("backface-visible") this.el.classList.add("video") + this.el.classList.add("mx-scenery") this.paused = !! this.media.autoplay this.muted = app.muted || !! this.media.mute this.started = false - - this.load() }, load: function (ops) { @@ -41,23 +40,24 @@ MX.Vimeo = MX.Object3D.extend({ this.el.appendChild(preload) this.player = $f(preload) - this.player.addEvent('ready', this.ready.bind(this)) + this.player.addEvent('ready', $.proxy(this.ready, this)) }, ready: function(){ console.log("vimeo ready") + this.started = true // wait until ready before binding events. other events: play, pause - this.player.addEvent('play', this.onPlay.bind(this)) - this.player.addEvent('pause', this.onPause.bind(this)) - this.player.addEvent('finish', this.finished.bind(this)) + this.player.addEvent('play', $.proxy(this.onPlay, this)) + this.player.addEvent('pause', $.proxy(this.onPause, this)) + this.player.addEvent('finish', $.proxy(this.finished, this)) // this is async on vimeo so call it asap - this.player.api('getDuration', function(n){ + this.player.api('getDuration', $.proxy(function(n){ console.log("vimeo duration", n) this.player.duration = n - }.bind(this)) + }, this)) if (this.media.mute) { this.mute() @@ -90,9 +90,9 @@ MX.Vimeo = MX.Object3D.extend({ seek: function(n){ // defer seek until we have duration if (! this.duration()) { - setTimeout(function(){ + setTimeout($.proxy(function(){ this.seek(n) - }.bind(this), 300) + }, this), 300) return } @@ -108,9 +108,9 @@ MX.Vimeo = MX.Object3D.extend({ this.paused = false this.play() this.pause() - setTimeout(function(){ + setTimeout($.proxy(function(){ this.pause() - }.bind(this), 100) + }, this), 100) } }, |
