aboutsummaryrefslogtreecommitdiff
path: root/js/controllers/elements/video-controller.js
diff options
context:
space:
mode:
authorPierre Frisch2011-12-22 07:25:50 -0800
committerValerio Virgillito2012-01-27 11:18:17 -0800
commitb89a7ee8b956c96a1dcee995ea840feddc5d4b27 (patch)
tree0f3136ab0ecdbbbed6a83576581af0a53124d6f1 /js/controllers/elements/video-controller.js
parent2401f05d1f4b94d45e4568b81fc73e67b969d980 (diff)
downloadninja-b89a7ee8b956c96a1dcee995ea840feddc5d4b27.tar.gz
First commit of Ninja to ninja-internal
Signed-off-by: Valerio Virgillito <rmwh84@motorola.com>
Diffstat (limited to 'js/controllers/elements/video-controller.js')
-rw-r--r--js/controllers/elements/video-controller.js56
1 files changed, 56 insertions, 0 deletions
diff --git a/js/controllers/elements/video-controller.js b/js/controllers/elements/video-controller.js
new file mode 100644
index 00000000..c36752f5
--- /dev/null
+++ b/js/controllers/elements/video-controller.js
@@ -0,0 +1,56 @@
1/* <copyright>
2This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
4(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5</copyright> */
6
7var Montage = require("montage/core/core").Montage,
8 ElementController = require("js/controllers/elements/element-controller").ElementController;
9
10exports.VideoController = Montage.create(ElementController, {
11 getProperty: {
12 value: function(el, prop) {
13 switch(prop) {
14 case "src":
15 case "poster":
16 case "autoplay":
17 case "controls":
18 case "loop":
19 case "muted":
20 return el.getAttribute(prop);
21 default:
22 return ElementController.getProperty(el, prop);
23 }
24 }
25 },
26
27 setProperty: {
28 value: function(el, p, value) {
29 switch(p) {
30 case "src":
31 el.setAttribute(p, value);
32 break;
33 case "poster":
34 el.setAttribute(p, value);
35 break;
36 case "autoplay":
37 value ? el.setAttribute(p, "autoplay") : el.removeAttribute(p);
38 break;
39 case "preload":
40 value ? el.setAttribute(p, "preload") : el.removeAttribute(p);
41 break;
42 case "controls":
43 value ? el.setAttribute(p, "controls") : el.removeAttribute(p);
44 break;
45 case "loop":
46 value ? el.setAttribute(p, "loop") : el.removeAttribute(p);
47 break;
48 case "muted":
49 value ? el.setAttribute(p, "muted") : el.removeAttribute(p);
50 break;
51 default:
52 ElementController.setProperty(el, p, value);
53 }
54 }
55 }
56}); \ No newline at end of file