diff options
| author | Jules Laplace <jules@okfoc.us> | 2014-08-13 13:25:44 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2014-08-13 13:25:44 -0400 |
| commit | 14228e82f4836b1bffa3389aa9e8d12959aa3810 (patch) | |
| tree | a3e04c419eadaec4d26d5a1b7f69529e78b83298 | |
| parent | 0d971464a2af8ec795664fb3e6f50b888dcccf53 (diff) | |
embed privacy check
6 files changed, 23 insertions, 20 deletions
diff --git a/public/assets/javascripts/mx/primitives/mx.video.js b/public/assets/javascripts/mx/primitives/mx.video.js index 7c0cd33..12d3dcb 100644 --- a/public/assets/javascripts/mx/primitives/mx.video.js +++ b/public/assets/javascripts/mx/primitives/mx.video.js @@ -22,8 +22,6 @@ MX.Video = MX.Object3D.extend({ this.el.classList.add("mx-scenery") this.paused = !! this.media.autoplay this.muted = app.muted || !! this.media.mute - - this.load() }, load: function(ops){ diff --git a/public/assets/javascripts/mx/primitives/mx.vimeo.js b/public/assets/javascripts/mx/primitives/mx.vimeo.js index 5b22821..4922519 100644 --- a/public/assets/javascripts/mx/primitives/mx.vimeo.js +++ b/public/assets/javascripts/mx/primitives/mx.vimeo.js @@ -23,8 +23,6 @@ MX.Vimeo = MX.Object3D.extend({ this.paused = !! this.media.autoplay this.muted = app.muted || !! this.media.mute this.started = false - - this.load() }, load: function (ops) { @@ -42,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() @@ -91,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 } @@ -109,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) } }, diff --git a/public/assets/javascripts/mx/primitives/mx.youtube.js b/public/assets/javascripts/mx/primitives/mx.youtube.js index 7846649..873348f 100644 --- a/public/assets/javascripts/mx/primitives/mx.youtube.js +++ b/public/assets/javascripts/mx/primitives/mx.youtube.js @@ -22,8 +22,6 @@ MX.Youtube = MX.Object3D.extend({ this.el.classList.add("mx-scenery") this.paused = !! this.media.autoplay this.muted = app.muted || !! this.media.mute - - this.load() }, load: function (ops) { diff --git a/public/assets/javascripts/rectangles/engine/scenery/types/video.js b/public/assets/javascripts/rectangles/engine/scenery/types/video.js index 79cfb1c..a8df875 100644 --- a/public/assets/javascripts/rectangles/engine/scenery/types/video.js +++ b/public/assets/javascripts/rectangles/engine/scenery/types/video.js @@ -34,7 +34,8 @@ Scenery.types.video = Scenery.types.base.extend(function(base){ y: this.scale * this.media.height/2, backface: false, }) - scene.add( this.mx ) + scene.add(this.mx) + this.mx.load() }, play: function(){ diff --git a/public/assets/javascripts/ui/lib/ModalView.js b/public/assets/javascripts/ui/lib/ModalView.js index 957a54d..937c1e9 100644 --- a/public/assets/javascripts/ui/lib/ModalView.js +++ b/public/assets/javascripts/ui/lib/ModalView.js @@ -11,9 +11,10 @@ var ModalView = View.extend({ }, show: function(){ - $(".mediaDrawer").removeClass("active"); - this.$el.addClass("active"); - $("body").addClass("noOverflow"); + $(".mediaDrawer").removeClass("active") + $(".fileUpload").removeClass("active") + this.$el.addClass("active") + $("body").addClass("noOverflow") }, hide: function(){ diff --git a/public/assets/javascripts/ui/lib/Parser.js b/public/assets/javascripts/ui/lib/Parser.js index dfff7b2..8867c0b 100644 --- a/public/assets/javascripts/ui/lib/Parser.js +++ b/public/assets/javascripts/ui/lib/Parser.js @@ -84,8 +84,14 @@ var Parser = { type: 'GET', url: 'http://vimeo.com/api/v2/video/' + id + '.json', success: function(result){ + console.log(result) + // embed_privacy: "nowhere" if (result.length == 0) { return done(id, "", 640, 360) } var res = result[0] + if (res.embed_privacy != "anywhere") { + AlertModal.alert("Sorry, the author of this video has marked it private, preventing it from being embedded.", function(){}) + return + } done({ token: id, thumbnail: res.thumbnail_large, |
