summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/mx/primitives/mx.youtube.js
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2014-07-14 13:05:57 -0400
committerJules Laplace <jules@okfoc.us>2014-07-14 13:05:57 -0400
commit9825b711480eb5b6022ce6b56b8a6914c5f43e52 (patch)
tree6e905143994c1787e7ee14dc2783e8fc2352c7b4 /public/assets/javascripts/mx/primitives/mx.youtube.js
parent3aac2d44b49d28c4a3e99d74d6d7769e985c2d02 (diff)
pick initial frame
Diffstat (limited to 'public/assets/javascripts/mx/primitives/mx.youtube.js')
-rw-r--r--public/assets/javascripts/mx/primitives/mx.youtube.js21
1 files changed, 15 insertions, 6 deletions
diff --git a/public/assets/javascripts/mx/primitives/mx.youtube.js b/public/assets/javascripts/mx/primitives/mx.youtube.js
index cc0ec0a..a31a24d 100644
--- a/public/assets/javascripts/mx/primitives/mx.youtube.js
+++ b/public/assets/javascripts/mx/primitives/mx.youtube.js
@@ -56,9 +56,9 @@ MX.Youtube = MX.Object3D.extend({
width: this.width,
height: this.height,
events: {
- onReady: $.proxy(this.ready, this),
- onError: $.proxy(this.error, this),
- onStateChange: $.proxy(this.statechange, this),
+ onReady: this.ready.bind(this),
+ onError: this.error.bind(this),
+ onStateChange: this.statechange.bind(this),
},
playerVars: {
autohide: 1,
@@ -93,10 +93,11 @@ MX.Youtube = MX.Object3D.extend({
this.finished()
break
case 1: // play
- this.paused = false
+ if (this.paused) {
+ this.pause()
+ }
break
case 2: // pause
- this.paused = true
break
case 3: // buffering
break
@@ -106,15 +107,20 @@ MX.Youtube = MX.Object3D.extend({
},
play: function(){
+ this.paused = false
this.player.playVideo()
},
pause: function(){
+ this.paused = true
this.player.pauseVideo()
},
seek: function(n, allowSeekAhead){
- allowSeekAhead = typeof allowSeekAhead == "boolean" ? allowSeekAhead : true
+ if (n < 1) {
+ n = n * this.duration()
+ }
+ allowSeekAhead = typeof allowSeekAhead == "boolean" ? allowSeekAhead : true
this.player.seekTo(n, true) // set to false if seeking manually
},
@@ -124,6 +130,9 @@ MX.Youtube = MX.Object3D.extend({
finished: function(){
console.log("youtube finished")
+ if (this.media.bound) {
+ $(".playButton").removeClass('playing')
+ }
}
})