diff options
Diffstat (limited to 'js')
-rwxr-xr-x | js/document/views/design.js | 25 |
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 |