diff options
author | Jose Antonio Marquez | 2012-06-28 18:39:07 -0700 |
---|---|---|
committer | Jose Antonio Marquez | 2012-06-28 18:39:07 -0700 |
commit | 4bfc0b9221734c75f305dbeefe8e49a9d73b766b (patch) | |
tree | ca8f43d9c1e332454246ea5b64e6ccc9b3c91bd6 /js | |
parent | 2f1ad000aeda418696d6ed74202db5e6565ab671 (diff) | |
download | ninja-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')
-rwxr-xr-x | js/components/tools-properties/tag-properties.reel/tag-properties.js | 14 | ||||
-rwxr-xr-x | js/controllers/elements/video-controller.js | 13 |
2 files changed, 13 insertions, 14 deletions
diff --git a/js/components/tools-properties/tag-properties.reel/tag-properties.js b/js/components/tools-properties/tag-properties.reel/tag-properties.js index f14183e0..ab745049 100755 --- a/js/components/tools-properties/tag-properties.reel/tag-properties.js +++ b/js/components/tools-properties/tag-properties.reel/tag-properties.js | |||
@@ -54,7 +54,6 @@ var TagProperties = exports.TagProperties = Montage.create(ToolProperties, { | |||
54 | this.divElement.addEventListener("click", this, false); | 54 | this.divElement.addEventListener("click", this, false); |
55 | this.imageElement.addEventListener("click", this, false); | 55 | this.imageElement.addEventListener("click", this, false); |
56 | this.videoElement.addEventListener("click", this, false); | 56 | this.videoElement.addEventListener("click", this, false); |
57 | this.videoElement.addEventListener("canplay", this, false); | ||
58 | this.canvasElement.addEventListener("click", this, false); | 57 | this.canvasElement.addEventListener("click", this, false); |
59 | this.customElement.addEventListener("click", this, false); | 58 | this.customElement.addEventListener("click", this, false); |
60 | } | 59 | } |
@@ -100,19 +99,6 @@ var TagProperties = exports.TagProperties = Montage.create(ToolProperties, { | |||
100 | } | 99 | } |
101 | } | 100 | } |
102 | }, | 101 | }, |
103 | |||
104 | handleCanplay: { | ||
105 | value: function (e) { | ||
106 | //TODO: Figure out why the video must be seeked to the end before pausing | ||
107 | var time = Math.ceil(this.duration); | ||
108 | //Trying to display the last frame (doing minus 2 seconds if long video) | ||
109 | if (time > 2) this.currentTime = time - 2; | ||
110 | else if (time > 1) this.currentTime = time - 1; | ||
111 | else this.currentTime = time || 0; | ||
112 | //Pauing video | ||
113 | this.pause(); | ||
114 | } | ||
115 | }, | ||
116 | 102 | ||
117 | _selectedElement: { | 103 | _selectedElement: { |
118 | value: "div", enumerable: false | 104 | value: "div", enumerable: false |
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": |