-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
107 lines (98 loc) · 2.21 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/**
* @file mofron-comp-video/index.js
* @brief video component for mofron
* @license MIT
*/
const cmputl = mofron.util.component;
module.exports = class extends mofron.class.Component {
/**
* initialize component
*
* @param (mixed) string: video src
* key-value: component config
* @type private
*/
constructor (p1) {
try {
super();
this.modname("Video");
this.shortForm('src');
/* init config */
if (0 < arguments.length) {
this.config(p1);
}
} catch (e) {
console.error(e.stack);
throw e;
}
}
initDomConts (prm) {
try {
let tag = 'video';
if (undefined !== prm) {
tag = prm;
}
super.initDomConts(tag);
} catch (e) {
console.error(e.stack);
throw e;
}
}
src (prm) {
try {
return this.childDom().attrs('src', prm);
} catch (e) {
console.error(e.stack);
throw e;
}
}
controls (prm) {
try {
return this.childDom().attrs('controls', prm);
} catch (e) {
console.error(e.stack);
throw e;
}
}
autoplay (prm) {
try {
return this.childDom().attrs('autoplay', prm);
} catch (e) {
console.error(e.stack);
throw e;
}
}
attrs (prm) {
try {
if (true === Array.isArray(prm)) {
for (let pidx in prm) {
this.attrs(prm[pidx]);
}
return;
}
let set_attr = {};
set_attr[prm] = true;
this.childDom().attrs(set_attr);
} catch (e) {
console.error(e.stack);
throw e;
}
}
play () {
try {
this.childDom().getRawDom().play();
} catch (e) {
console.error(e.stack);
throw e;
}
}
volume (prm) {
try {
return this.childDom().props('volume', prm);
} catch (e) {
console.error(e.stack);
throw e;
}
}
}
/* end of file */