diff options
10 files changed, 57 insertions, 16 deletions
diff --git a/public/assets/javascripts/mx/primitives/mx.video.js b/public/assets/javascripts/mx/primitives/mx.video.js index b28204d..cdb92c8 100644 --- a/public/assets/javascripts/mx/primitives/mx.video.js +++ b/public/assets/javascripts/mx/primitives/mx.video.js @@ -83,6 +83,10 @@ MX.Video = MX.Object3D.extend({ this.muted = false }, + setLoop: function(state){ + this.media.loop = state + }, + duration: function(){ return this.player.duration }, diff --git a/public/assets/javascripts/mx/primitives/mx.vimeo.js b/public/assets/javascripts/mx/primitives/mx.vimeo.js index 7a5327e..7bc0a26 100644 --- a/public/assets/javascripts/mx/primitives/mx.vimeo.js +++ b/public/assets/javascripts/mx/primitives/mx.vimeo.js @@ -21,15 +21,17 @@ MX.Vimeo = MX.Object3D.extend({ this.el.classList.add("video") this.paused = !! this.media.autoplay this.muted = app.muted || !! this.media.mute + this.started = false this.load() }, load: function (ops) { var uid = 'player-' + Uid () + var loop = this.media.loop ? 'loop=1' : "" var preload = document.createElement("iframe") preload.id = uid - preload.setAttribute("src", "//player.vimeo.com/video/" + this.media.token + "?api=1&badge=0&controls=0branding=0&byline=0&player_id=" + uid) + preload.setAttribute("src", "//player.vimeo.com/video/" + this.media.token + "?api=1&badge=0&controls=0branding=0&byline=0&portrait=0&title=0&" + loop + "&player_id=" + uid) preload.style.backgroundImage = "url(" + this.media.thumbnail + ")" preload.style.width = this.media.width + "px" preload.style.height = this.media.height + "px" @@ -44,6 +46,7 @@ MX.Vimeo = MX.Object3D.extend({ 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)) @@ -65,6 +68,9 @@ MX.Vimeo = MX.Object3D.extend({ if (this.media.autoplay) { this.play() } + else { + this.pause() + } }, error: function(err){ @@ -90,6 +96,11 @@ MX.Vimeo = MX.Object3D.extend({ return } + if (! this.started || n === 0) { + return + } + console.log("fukballz", n) + if (n < 1) { n = n * this.duration() } @@ -97,9 +108,10 @@ MX.Vimeo = MX.Object3D.extend({ if (this.paused) { this.paused = false this.play() + this.pause() setTimeout(function(){ this.pause() - }.bind(this), 1000) + }.bind(this), 100) } }, @@ -117,6 +129,11 @@ MX.Vimeo = MX.Object3D.extend({ this.muted = false }, + setLoop: function(state){ + this.media.loop = state + this.player.api('setLoop', state) + }, + onPlay: function(){ if (this.paused) { this.pause() @@ -130,11 +147,12 @@ MX.Vimeo = MX.Object3D.extend({ }, finished: function(){ - if (this.media.loop) { - this.seek(0) - this.play() - } - else if (this.bound) { +// if (this.media.loop) { +// this.seek(0) +// this.play() +// } +// else if (this.bound) { + if (! this.media.loop && this.bound) { $(".playButton").removeClass('playing') } } diff --git a/public/assets/javascripts/mx/primitives/mx.youtube.js b/public/assets/javascripts/mx/primitives/mx.youtube.js index 47d5507..5514359 100644 --- a/public/assets/javascripts/mx/primitives/mx.youtube.js +++ b/public/assets/javascripts/mx/primitives/mx.youtube.js @@ -31,6 +31,7 @@ MX.Youtube = MX.Object3D.extend({ var preload = document.createElement("div") preload.id = uid preload.style.backgroundImage = "url(" + this.media.thumbnail + ")" + preload.style.backgroundSize = "cover" preload.style.width = this.media.width + "px" preload.style.height = this.media.height + "px" preload.style.pointerEvents = "none" @@ -47,7 +48,11 @@ MX.Youtube = MX.Object3D.extend({ }.bind(this), 300) } else { - this.build(uid) + // not sure why i need to wait here.. + // stopped working until i added the setTimeout + setTimeout(function(){ + this.build(uid) + }.bind(this), 20) } }, @@ -67,6 +72,7 @@ MX.Youtube = MX.Object3D.extend({ disablekb: 1, controls: 0, enablejsapi: 1, + origin: window.location.origin, fs: 0, modestbranding: 1, iv_load_policy: 3, // no annotations @@ -84,6 +90,9 @@ MX.Youtube = MX.Object3D.extend({ if (this.media.autoplay) { this.play() } + else { + this.pause() + } if (this.media.mute) { this.mute() @@ -123,6 +132,7 @@ MX.Youtube = MX.Object3D.extend({ }, pause: function(){ + console.log(this, bzbz = this.player) this.paused = true this.player.pauseVideo() }, @@ -150,7 +160,11 @@ MX.Youtube = MX.Object3D.extend({ this.muted = false }, - finished: function(){ + setLoop: function(state){ + this.media.loop = state + }, + + finished: function(){ console.log("youtube finished") if (this.media.loop) { this.seek(0) @@ -164,5 +178,5 @@ MX.Youtube = MX.Object3D.extend({ }) window.onYouTubePlayerAPIReady = function(){ - // console.log("youtube api ready") + // console.log("youtube api ready") } diff --git a/public/assets/javascripts/rectangles/engine/scenery/_scenery.js b/public/assets/javascripts/rectangles/engine/scenery/_scenery.js index 1493fc6..abd14ba 100644 --- a/public/assets/javascripts/rectangles/engine/scenery/_scenery.js +++ b/public/assets/javascripts/rectangles/engine/scenery/_scenery.js @@ -25,7 +25,6 @@ var Scenery = new function(){ scene_media = new Scenery.types.video ({ media: media, wall: wall, id: id }) break } - base.list[scene_media.id] = scene_media return scene_media } diff --git a/public/assets/javascripts/rectangles/engine/scenery/types/_object.js b/public/assets/javascripts/rectangles/engine/scenery/types/_object.js index 65f3a94..7202ce0 100644 --- a/public/assets/javascripts/rectangles/engine/scenery/types/_object.js +++ b/public/assets/javascripts/rectangles/engine/scenery/types/_object.js @@ -10,7 +10,7 @@ Scenery.types.base = Fiber.extend(function(base){ this.media = opt.media this.dimensions = new vec2(this.media.width, this.media.height) this.scale = this.media.scale - + if (opt.wall) { this.set_wall(opt.wall) } diff --git a/public/assets/javascripts/rectangles/engine/scenery/types/video.js b/public/assets/javascripts/rectangles/engine/scenery/types/video.js index d3e2e76..79cfb1c 100644 --- a/public/assets/javascripts/rectangles/engine/scenery/types/video.js +++ b/public/assets/javascripts/rectangles/engine/scenery/types/video.js @@ -73,6 +73,10 @@ Scenery.types.video = Scenery.types.base.extend(function(base){ this.mx.seek(n) }, + setLoop: function(shouldLoop){ + this.mx.setLoop(shouldLoop) + }, + mute: function(muted){ if (muted) { this.mx.mute() diff --git a/public/assets/javascripts/ui/builder/BuilderInfo.js b/public/assets/javascripts/ui/builder/BuilderInfo.js index 9bbd385..ee6c81a 100644 --- a/public/assets/javascripts/ui/builder/BuilderInfo.js +++ b/public/assets/javascripts/ui/builder/BuilderInfo.js @@ -32,7 +32,6 @@ var BuilderInfo = View.extend({ this.$viewHeight.unitVal( data.viewHeight || app.defaults.viewHeight ) this.$units.val( "ft" ) this.$unitName.html( "ft" ) - this.$resolution.val( app.defaults.footResolution ) }, toggle: function(state){ diff --git a/public/assets/javascripts/ui/editor/MediaEditor.js b/public/assets/javascripts/ui/editor/MediaEditor.js index a075e6b..f4e8071 100644 --- a/public/assets/javascripts/ui/editor/MediaEditor.js +++ b/public/assets/javascripts/ui/editor/MediaEditor.js @@ -47,7 +47,7 @@ var MediaEditor = FormView.extend({ if (this.scenery) { this.unbind() } - +console.log(scenery) this.bind(scenery) this.$el.addClass("active") @@ -105,7 +105,7 @@ var MediaEditor = FormView.extend({ }, setLoop: function(){ var checked = this.$loop.prop('checked') - this.scenery.media.loop = checked + this.scenery.setLoop(checked) }, setMute: function(){ var checked = this.$mute.prop('checked') diff --git a/views/home.ejs b/views/home.ejs index 97d59dc..45a6e6f 100755 --- a/views/home.ejs +++ b/views/home.ejs @@ -25,6 +25,9 @@ <h1>Room Showcase</h1> <table class="showcase"> + [[ include projects/list-projects ]] + + <tr> <td class="border room1"> <a href="/" class="roomName">Pace Gallery • 7.1.14</a> diff --git a/views/projects/list-projects.ejs b/views/projects/list-projects.ejs index 2c12af0..205e778 100644 --- a/views/projects/list-projects.ejs +++ b/views/projects/list-projects.ejs @@ -1,5 +1,5 @@ [[ if (projects.length) { ]] - <h1>[[- profile.username ]] has [[- projects.length ]] project[[- projects.length != 1 && "s" ]]</h1> + <h1>[[- profile.username ]] has [[- projects.length ]] project[[- projects.length != 1 ? "s" : "" ]]</h1> <table> <tr> |
