aboutsummaryrefslogtreecommitdiff
path: root/js/controllers/elements
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-06-28 18:39:07 -0700
committerJose Antonio Marquez2012-06-28 18:39:07 -0700
commit4bfc0b9221734c75f305dbeefe8e49a9d73b766b (patch)
treeca8f43d9c1e332454246ea5b64e6ccc9b3c91bd6 /js/controllers/elements
parent2f1ad000aeda418696d6ed74202db5e6565ab671 (diff)
downloadninja-4bfc0b9221734c75f305dbeefe8e49a9d73b766b.tar.gz
Relocating code
I added the fix in the wrong location before, this is more proper, still needs to be moved to where the video element is created or added to the DOM (in this spot the event is added every time src is changed).
Diffstat (limited to 'js/controllers/elements')
-rwxr-xr-xjs/controllers/elements/video-controller.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/js/controllers/elements/video-controller.js b/js/controllers/elements/video-controller.js
index c36752f5..44ba5aa1 100755
--- a/js/controllers/elements/video-controller.js
+++ b/js/controllers/elements/video-controller.js
@@ -28,6 +28,19 @@ exports.VideoController = Montage.create(ElementController, {
28 value: function(el, p, value) { 28 value: function(el, p, value) {
29 switch(p) { 29 switch(p) {
30 case "src": 30 case "src":
31
32 //TODO: Move this to the location where the element is created
33 el.addEventListener('canplay', function(e) {
34 //TODO: Figure out why the video must be seeked to the end before pausing
35 var time = Math.ceil(this.duration);
36 //Trying to display the last frame (doing minus 2 seconds if long video)
37 if (time > 2) this.currentTime = time - 2;
38 else if (time > 1) this.currentTime = time - 1;
39 else this.currentTime = time || 0;
40 //Pauing video
41 this.pause();
42 }, false);
43
31 el.setAttribute(p, value); 44 el.setAttribute(p, value);
32 break; 45 break;
33 case "poster": 46 case "poster":