aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorJose Antonio Marquez Russo2012-06-29 14:45:16 -0700
committerJose Antonio Marquez Russo2012-06-29 14:45:16 -0700
commitdeadb791e6afc9cc4e81a0d9c6a0b52f0c6d1372 (patch)
tree214cbde421bf142e1f4b8c650b3f800444ec6930 /js
parent20e945e1f6f6e44cc11de97063299698d4b8f881 (diff)
parent8a9ac2255b9161102be21fca23ba892665fe75ab (diff)
downloadninja-deadb791e6afc9cc4e81a0d9c6a0b52f0c6d1372.tar.gz
Merge pull request #41 from mencio/video-fix
Fixing the video bug
Diffstat (limited to 'js')
-rwxr-xr-xjs/document/views/design.js25
1 files changed, 11 insertions, 14 deletions
diff --git a/js/document/views/design.js b/js/document/views/design.js
index fea607ef..b7c50a7c 100755
--- a/js/document/views/design.js
+++ b/js/document/views/design.js
@@ -313,20 +313,17 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, {
313 if (videotags.length > 0) { 313 if (videotags.length > 0) {
314 //Looping through all video tags 314 //Looping through all video tags
315 for (i = 0; i < videotags.length; i++) { 315 for (i = 0; i < videotags.length; i++) {
316 //Stopping all videos from playing 316 //Stopping all videos from playing on open
317 if (videotags[i].getAttribute && videotags[i].getAttribute('autoplay') !== null) { 317 videotags[i].addEventListener('canplay', function(e) {
318 //Stopping the video on open 318 //TODO: Figure out why the video must be seeked to the end before pausing
319 videotags[i].addEventListener('canplay', function(e) { 319 var time = Math.ceil(this.duration);
320 //TODO: Figure out why the video must be seeked to the end before pausing 320 //Trying to display the last frame (doing minus 2 seconds if long video)
321 var time = Math.ceil(this.duration); 321 if (time > 2) this.currentTime = time - 2;
322 //Trying to display the last frame (doing minus 2 seconds if long video) 322 else if (time > 1) this.currentTime = time - 1;
323 if (time > 2) this.currentTime = time - 2; 323 else this.currentTime = time || 0;
324 else if (time > 1) this.currentTime = time - 1; 324 //Pauing video
325 else this.currentTime = time || 0; 325 this.pause();
326 //Pauing video 326 }, false);
327 this.pause();
328 }, false);
329 }
330 } 327 }
331 } 328 }
332 // Assign the modelGenerator reference from the template to our own modelGenerator 329 // Assign the modelGenerator reference from the template to our own modelGenerator