From 0a6657514058935251366c770bfd85a419f60786 Mon Sep 17 00:00:00 2001 From: Kawandeep Virdee Date: Sun, 10 Nov 2013 13:23:50 -0500 Subject: movie comes to the top if it is playing --- assets/js/models/sample.js | 3 ++- assets/js/views/sample.js | 11 ++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/assets/js/models/sample.js b/assets/js/models/sample.js index c3c395c..c85a008 100644 --- a/assets/js/models/sample.js +++ b/assets/js/models/sample.js @@ -45,11 +45,12 @@ ClipPlay.Models.Sample = Backbone.Model.extend({ play: function() { console.log('playing'); //play then pause - this.set('playing',true); window.clearTimeout(this.get('timeout')); + this.set('playing',false); this.get('player').pause(); this.get('player').seekTo(this.get('start')); this.get('player').play(); + this.set('playing',true); var that = this; var length = Math.abs(this.get('stop') - this.get('start')); console.log(length); diff --git a/assets/js/views/sample.js b/assets/js/views/sample.js index 6d1f95a..0c49469 100644 --- a/assets/js/views/sample.js +++ b/assets/js/views/sample.js @@ -119,13 +119,22 @@ ClipPlay.Views.Sample = Marionette.ItemView.extend({ show_clip: function(){ var isPlaying = this.model.get('playing'); - console.log('playing :' + isPlaying); var $iframe_video = $('#video-sample-' + this.model.cid); if(isPlaying){ + var $frames = $('iframe'); + $frames.each(function(k,v){$(v).css({'z-index':-10})}) $iframe_video.css({'z-index':10}); } if(!isPlaying){ $iframe_video.css({'z-index':-10}); + + //if any others are playing, show them + this.collection.each(function(sample){ + if(sample.get('playing')){ + var $iframe = $('#video-sample-' + sample.cid); + $iframe.css({'z-index':10}); + } + }); } } }); -- cgit v1.2.3