ovenplayer 0.10.49 → 0.10.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ovenplayer.js +1 -1
- package/dist/ovenplayer.js.map +1 -1
- package/package.json +49 -49
- package/src/js/api/Configurator.js +1 -1
- package/src/js/api/ads/vast/Ad.js +237 -237
- package/src/js/api/caption/Loader.js +1 -1
- package/src/js/api/caption/Manager.js +1 -1
- package/src/js/api/caption/parser/VttParser.js +1541 -1542
- package/src/js/api/playlist/Manager.js +229 -229
- package/src/js/api/provider/html5/providers/Dash.js +286 -286
- package/src/js/api/provider/html5/providers/Hls.js +110 -2
- package/src/js/api/provider/html5/providers/WebRTC.js +2 -1
- package/src/js/api/provider/html5/providers/WebRTCLoader.js +35 -2
- package/src/js/api/provider/utils.js +69 -69
- package/src/js/ovenplayer.sdk.js +143 -143
- package/src/js/utils/likeA$.js +241 -242
- package/src/js/utils/resize-sensor.js +145 -168
- package/src/js/utils/strings.js +104 -104
- package/src/js/view/components/controls/settingPanel/audioTrackPanel.js +57 -57
- package/src/js/view/components/controls/settingPanel/main.js +1 -1
- package/src/js/view/components/controls/settingPanel/mainTemplate.js +29 -29
- package/src/js/view/components/controls/settingPanel/qualityPanel.js +68 -68
- package/src/js/view/components/controls/settingPanel/subtitleTrackPanel.js +56 -56
- package/src/js/view/components/helpers/captionViewer.js +97 -15
- package/src/js/view/components/helpers/captionViewerTemplate.js +1 -2
- package/src/js/view/components/helpers/waterMark.js +69 -69
- package/src/js/view/engine/OvenTemplate.js +158 -158
- package/src/js/view/global/PanelManager.js +47 -47
- package/src/stylesheet/ovenplayer.less +52 -21
- package/src/js/utils/adapter.js +0 -4944
- package/src/js/utils/captions/vttCue.js +0 -308
- package/src/js/utils/captions/vttRegion.js +0 -136
- package/src/js/utils/polyfills/dom.js +0 -634
- package/src/js/utils/underscore.js +0 -6
|
@@ -1,168 +1,145 @@
|
|
|
1
|
-
(function (
|
|
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
|
-
element.
|
|
71
|
-
|
|
72
|
-
if (
|
|
73
|
-
element.
|
|
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
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
var i = 0, j = element.length;
|
|
147
|
-
for (; i < j; i++) {
|
|
148
|
-
ResizeSensor.detach(element[i]);
|
|
149
|
-
}
|
|
150
|
-
} else {
|
|
151
|
-
ResizeSensor.detach(element);
|
|
152
|
-
}
|
|
153
|
-
};
|
|
154
|
-
ResizeSensor.detach = function (element) {
|
|
155
|
-
if (element.resizeSensor) {
|
|
156
|
-
if (element.hasChildNodes()) {
|
|
157
|
-
element.removeChild(element.resizeSensor);
|
|
158
|
-
}
|
|
159
|
-
delete element.resizeSensor;
|
|
160
|
-
delete element.resizedAttached;
|
|
161
|
-
}
|
|
162
|
-
};
|
|
163
|
-
return ResizeSensor;
|
|
164
|
-
}();
|
|
165
|
-
|
|
166
|
-
return ResizeSensor;
|
|
167
|
-
|
|
168
|
-
}));
|
|
1
|
+
export default (function () {
|
|
2
|
+
'use strict';
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @constructor
|
|
6
|
+
*/
|
|
7
|
+
function EventQueue() {
|
|
8
|
+
this.q = [];
|
|
9
|
+
this.add = function (ev) {
|
|
10
|
+
this.q.push(ev);
|
|
11
|
+
};
|
|
12
|
+
var i, j;
|
|
13
|
+
this.call = function () {
|
|
14
|
+
for (i = 0, j = this.q.length; i < j; i++) {
|
|
15
|
+
this.q[i].call();
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* @param {HTMLElement} element
|
|
21
|
+
* @param {String} prop
|
|
22
|
+
* @returns {String|Number}
|
|
23
|
+
*/
|
|
24
|
+
function getComputedStyle(element, prop) {
|
|
25
|
+
if (element.currentStyle) {
|
|
26
|
+
return element.currentStyle[prop];
|
|
27
|
+
} else if (window.getComputedStyle) {
|
|
28
|
+
return window.getComputedStyle(element, null).getPropertyValue(prop);
|
|
29
|
+
} else {
|
|
30
|
+
return element.style[prop];
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
*
|
|
35
|
+
* @param {HTMLElement} element
|
|
36
|
+
* @param {Function} resized
|
|
37
|
+
*/
|
|
38
|
+
function attachResizeEvent(element, resized) {
|
|
39
|
+
if (!element.resizedAttached) {
|
|
40
|
+
element.resizedAttached = new EventQueue();
|
|
41
|
+
element.resizedAttached.add(resized);
|
|
42
|
+
} else if (element.resizedAttached) {
|
|
43
|
+
element.resizedAttached.add(resized);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
element.resizeSensor = document.createElement('div');
|
|
47
|
+
element.resizeSensor.className = 'resize-sensor';
|
|
48
|
+
var style = 'position: absolute; left: 0; top: 0; right: 0; bottom: 0; overflow: hidden; z-index: -1; visibility: hidden; opacity: 0;direction: ltr;';
|
|
49
|
+
var styleChild = 'position: absolute; left: 0; top: 0; transition: 0s;';
|
|
50
|
+
element.resizeSensor.style.cssText = style;
|
|
51
|
+
element.resizeSensor.innerHTML = '<div class="resize-sensor-expand" style="' + style + '">' + '<div style="' + styleChild + '"></div>' + '</div>' + '<div class="resize-sensor-shrink" style="' + style + '">' + '<div style="' + styleChild + ' width: 200%; height: 200%"></div>' + '</div>';
|
|
52
|
+
element.appendChild(element.resizeSensor);
|
|
53
|
+
if (getComputedStyle(element, 'position') == 'static') {
|
|
54
|
+
element.style.position = 'relative';
|
|
55
|
+
}
|
|
56
|
+
var expand = element.resizeSensor.childNodes[0];
|
|
57
|
+
var expandChild = expand.childNodes[0];
|
|
58
|
+
var shrink = element.resizeSensor.childNodes[1];
|
|
59
|
+
var reset = function () {
|
|
60
|
+
expandChild.style.width = 100000 + 'px';
|
|
61
|
+
expandChild.style.height = 100000 + 'px';
|
|
62
|
+
expand.scrollLeft = 100000;
|
|
63
|
+
expand.scrollTop = 100000;
|
|
64
|
+
shrink.scrollLeft = 100000;
|
|
65
|
+
shrink.scrollTop = 100000;
|
|
66
|
+
};
|
|
67
|
+
reset();
|
|
68
|
+
var dirty = false;
|
|
69
|
+
var dirtyChecking = function () {
|
|
70
|
+
if (!element.resizedAttached)
|
|
71
|
+
return;
|
|
72
|
+
if (dirty) {
|
|
73
|
+
element.resizedAttached.call();
|
|
74
|
+
dirty = false;
|
|
75
|
+
}
|
|
76
|
+
window.requestAnimationFrame(dirtyChecking);
|
|
77
|
+
};
|
|
78
|
+
window.requestAnimationFrame(dirtyChecking);
|
|
79
|
+
var lastWidth, lastHeight;
|
|
80
|
+
var cachedWidth, cachedHeight;
|
|
81
|
+
//useful to not query offsetWidth twice
|
|
82
|
+
var onScroll = function () {
|
|
83
|
+
if ((cachedWidth = element.offsetWidth) != lastWidth || (cachedHeight = element.offsetHeight) != lastHeight) {
|
|
84
|
+
dirty = true;
|
|
85
|
+
lastWidth = cachedWidth;
|
|
86
|
+
lastHeight = cachedHeight;
|
|
87
|
+
}
|
|
88
|
+
reset();
|
|
89
|
+
};
|
|
90
|
+
var addEvent = function (el, name, cb) {
|
|
91
|
+
if (el.attachEvent) {
|
|
92
|
+
el.attachEvent('on' + name, cb);
|
|
93
|
+
} else {
|
|
94
|
+
el.addEventListener(name, cb);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
addEvent(expand, 'scroll', onScroll);
|
|
98
|
+
addEvent(shrink, 'scroll', onScroll);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Class for dimension change detection.
|
|
102
|
+
*
|
|
103
|
+
* @param {Element|Element[]|Elements|jQuery} element
|
|
104
|
+
* @param {Function} callback
|
|
105
|
+
*
|
|
106
|
+
* @constructor
|
|
107
|
+
*/
|
|
108
|
+
var ResizeSensor = function (element, callback) {
|
|
109
|
+
var me = this;
|
|
110
|
+
var elementType = Object.prototype.toString.call(element);
|
|
111
|
+
var isCollectionTyped = me._isCollectionTyped = '[object Array]' === elementType || '[object NodeList]' === elementType || '[object HTMLCollection]' === elementType || 'undefined' !== typeof jQuery && element instanceof window.jQuery || 'undefined' !== typeof Elements && element instanceof window.Elements;
|
|
112
|
+
me._element = element;
|
|
113
|
+
if (isCollectionTyped) {
|
|
114
|
+
var i = 0, j = element.length;
|
|
115
|
+
for (; i < j; i++) {
|
|
116
|
+
attachResizeEvent(element[i], callback);
|
|
117
|
+
}
|
|
118
|
+
} else {
|
|
119
|
+
attachResizeEvent(element, callback);
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
ResizeSensor.prototype.detach = function () {
|
|
123
|
+
var me = this;
|
|
124
|
+
var isCollectionTyped = me._isCollectionTyped;
|
|
125
|
+
var element = me._element;
|
|
126
|
+
if (isCollectionTyped) {
|
|
127
|
+
var i = 0, j = element.length;
|
|
128
|
+
for (; i < j; i++) {
|
|
129
|
+
ResizeSensor.detach(element[i]);
|
|
130
|
+
}
|
|
131
|
+
} else {
|
|
132
|
+
ResizeSensor.detach(element);
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
ResizeSensor.detach = function (element) {
|
|
136
|
+
if (element.resizeSensor) {
|
|
137
|
+
if (element.hasChildNodes()) {
|
|
138
|
+
element.removeChild(element.resizeSensor);
|
|
139
|
+
}
|
|
140
|
+
delete element.resizeSensor;
|
|
141
|
+
delete element.resizedAttached;
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
return ResizeSensor;
|
|
145
|
+
})();
|
package/src/js/utils/strings.js
CHANGED
|
@@ -1,104 +1,104 @@
|
|
|
1
|
-
import _ from '
|
|
2
|
-
|
|
3
|
-
export function trim(string) {
|
|
4
|
-
return string ? string.replace(/^\s+|\s+$/g, '') : "";
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* extractExtension
|
|
9
|
-
*
|
|
10
|
-
* @param {string} path for url
|
|
11
|
-
* @return {string} Extension
|
|
12
|
-
*/
|
|
13
|
-
export const extractExtension = function(path) {
|
|
14
|
-
if(!path || path.substr(0,4)=='rtmp') {
|
|
15
|
-
return "";
|
|
16
|
-
}
|
|
17
|
-
function getAzureFileFormat(path) {
|
|
18
|
-
let extension = "";
|
|
19
|
-
if ((/[(,]format=mpd-/i).test(path)) {
|
|
20
|
-
extension = 'mpd';
|
|
21
|
-
}else if ((/[(,]format=m3u8-/i).test(path)) {
|
|
22
|
-
extension = 'm3u8';
|
|
23
|
-
}
|
|
24
|
-
return extension;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
let azuredFormat = getAzureFileFormat(path);
|
|
28
|
-
if(azuredFormat) {
|
|
29
|
-
return azuredFormat;
|
|
30
|
-
}
|
|
31
|
-
path = path.split('?')[0].split('#')[0];
|
|
32
|
-
if(path.lastIndexOf('.') > -1) {
|
|
33
|
-
return path.substr(path.lastIndexOf('.') + 1, path.length).toLowerCase();
|
|
34
|
-
}else{
|
|
35
|
-
return "";
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* naturalHms
|
|
42
|
-
*
|
|
43
|
-
* @param {number | string} second The second
|
|
44
|
-
* @return {string} formatted String
|
|
45
|
-
*/
|
|
46
|
-
export function naturalHms(second) {
|
|
47
|
-
let secNum = parseInt(second, 10);
|
|
48
|
-
if(!second){
|
|
49
|
-
return "00:00";
|
|
50
|
-
}
|
|
51
|
-
let hours = Math.floor(secNum / 3600);
|
|
52
|
-
let minutes = Math.floor((secNum - (hours * 3600)) / 60);
|
|
53
|
-
let seconds = secNum - (hours * 3600) - (minutes * 60);
|
|
54
|
-
|
|
55
|
-
//if (hours > 0) {minutes = "0"+minutes;}
|
|
56
|
-
if (minutes < 10) {minutes = "0"+minutes;}
|
|
57
|
-
if (seconds < 10) {seconds = "0"+seconds;}
|
|
58
|
-
|
|
59
|
-
if (hours > 0) {
|
|
60
|
-
return hours+':'+minutes+':'+seconds;
|
|
61
|
-
} else {
|
|
62
|
-
return minutes+':'+seconds;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
export function hmsToSecond(str, frameRate) {
|
|
68
|
-
if(!str) {
|
|
69
|
-
return 0;
|
|
70
|
-
}
|
|
71
|
-
if(_.isNumber(str) && !_.isNaN(str)){
|
|
72
|
-
return str;
|
|
73
|
-
}
|
|
74
|
-
str = str.replace(',', '.');
|
|
75
|
-
let arr = str.split(':');
|
|
76
|
-
let arrLength = arr.length;
|
|
77
|
-
let sec = 0;
|
|
78
|
-
if (str.slice(-1) === 's'){
|
|
79
|
-
sec = parseFloat(str);
|
|
80
|
-
}else if (str.slice(-1) === 'm'){
|
|
81
|
-
sec = parseFloat(str) * 60;
|
|
82
|
-
}else if (str.slice(-1) === 'h'){
|
|
83
|
-
sec = parseFloat(str) * 3600;
|
|
84
|
-
}else if (arrLength > 1) {
|
|
85
|
-
var secIndex = arrLength - 1;
|
|
86
|
-
if (arrLength === 4) {
|
|
87
|
-
if (frameRate) {
|
|
88
|
-
sec = parseFloat(arr[secIndex]) / frameRate;
|
|
89
|
-
}
|
|
90
|
-
secIndex -= 1;
|
|
91
|
-
}
|
|
92
|
-
sec += parseFloat(arr[secIndex]);
|
|
93
|
-
sec += parseFloat(arr[secIndex - 1]) * 60;
|
|
94
|
-
if (arrLength >= 3) {
|
|
95
|
-
sec += parseFloat(arr[secIndex - 2]) * 3600;
|
|
96
|
-
}
|
|
97
|
-
} else {
|
|
98
|
-
sec = parseFloat(str);
|
|
99
|
-
}
|
|
100
|
-
if (_.isNaN(sec)) {
|
|
101
|
-
return 0;
|
|
102
|
-
}
|
|
103
|
-
return sec;
|
|
104
|
-
}
|
|
1
|
+
import _ from 'underscore';
|
|
2
|
+
|
|
3
|
+
export function trim(string) {
|
|
4
|
+
return string ? string.replace(/^\s+|\s+$/g, '') : "";
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* extractExtension
|
|
9
|
+
*
|
|
10
|
+
* @param {string} path for url
|
|
11
|
+
* @return {string} Extension
|
|
12
|
+
*/
|
|
13
|
+
export const extractExtension = function(path) {
|
|
14
|
+
if(!path || path.substr(0,4)=='rtmp') {
|
|
15
|
+
return "";
|
|
16
|
+
}
|
|
17
|
+
function getAzureFileFormat(path) {
|
|
18
|
+
let extension = "";
|
|
19
|
+
if ((/[(,]format=mpd-/i).test(path)) {
|
|
20
|
+
extension = 'mpd';
|
|
21
|
+
}else if ((/[(,]format=m3u8-/i).test(path)) {
|
|
22
|
+
extension = 'm3u8';
|
|
23
|
+
}
|
|
24
|
+
return extension;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
let azuredFormat = getAzureFileFormat(path);
|
|
28
|
+
if(azuredFormat) {
|
|
29
|
+
return azuredFormat;
|
|
30
|
+
}
|
|
31
|
+
path = path.split('?')[0].split('#')[0];
|
|
32
|
+
if(path.lastIndexOf('.') > -1) {
|
|
33
|
+
return path.substr(path.lastIndexOf('.') + 1, path.length).toLowerCase();
|
|
34
|
+
}else{
|
|
35
|
+
return "";
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* naturalHms
|
|
42
|
+
*
|
|
43
|
+
* @param {number | string} second The second
|
|
44
|
+
* @return {string} formatted String
|
|
45
|
+
*/
|
|
46
|
+
export function naturalHms(second) {
|
|
47
|
+
let secNum = parseInt(second, 10);
|
|
48
|
+
if(!second){
|
|
49
|
+
return "00:00";
|
|
50
|
+
}
|
|
51
|
+
let hours = Math.floor(secNum / 3600);
|
|
52
|
+
let minutes = Math.floor((secNum - (hours * 3600)) / 60);
|
|
53
|
+
let seconds = secNum - (hours * 3600) - (minutes * 60);
|
|
54
|
+
|
|
55
|
+
//if (hours > 0) {minutes = "0"+minutes;}
|
|
56
|
+
if (minutes < 10) {minutes = "0"+minutes;}
|
|
57
|
+
if (seconds < 10) {seconds = "0"+seconds;}
|
|
58
|
+
|
|
59
|
+
if (hours > 0) {
|
|
60
|
+
return hours+':'+minutes+':'+seconds;
|
|
61
|
+
} else {
|
|
62
|
+
return minutes+':'+seconds;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
export function hmsToSecond(str, frameRate) {
|
|
68
|
+
if(!str) {
|
|
69
|
+
return 0;
|
|
70
|
+
}
|
|
71
|
+
if(_.isNumber(str) && !_.isNaN(str)){
|
|
72
|
+
return str;
|
|
73
|
+
}
|
|
74
|
+
str = str.replace(',', '.');
|
|
75
|
+
let arr = str.split(':');
|
|
76
|
+
let arrLength = arr.length;
|
|
77
|
+
let sec = 0;
|
|
78
|
+
if (str.slice(-1) === 's'){
|
|
79
|
+
sec = parseFloat(str);
|
|
80
|
+
}else if (str.slice(-1) === 'm'){
|
|
81
|
+
sec = parseFloat(str) * 60;
|
|
82
|
+
}else if (str.slice(-1) === 'h'){
|
|
83
|
+
sec = parseFloat(str) * 3600;
|
|
84
|
+
}else if (arrLength > 1) {
|
|
85
|
+
var secIndex = arrLength - 1;
|
|
86
|
+
if (arrLength === 4) {
|
|
87
|
+
if (frameRate) {
|
|
88
|
+
sec = parseFloat(arr[secIndex]) / frameRate;
|
|
89
|
+
}
|
|
90
|
+
secIndex -= 1;
|
|
91
|
+
}
|
|
92
|
+
sec += parseFloat(arr[secIndex]);
|
|
93
|
+
sec += parseFloat(arr[secIndex - 1]) * 60;
|
|
94
|
+
if (arrLength >= 3) {
|
|
95
|
+
sec += parseFloat(arr[secIndex - 2]) * 3600;
|
|
96
|
+
}
|
|
97
|
+
} else {
|
|
98
|
+
sec = parseFloat(str);
|
|
99
|
+
}
|
|
100
|
+
if (_.isNaN(sec)) {
|
|
101
|
+
return 0;
|
|
102
|
+
}
|
|
103
|
+
return sec;
|
|
104
|
+
}
|
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Created by hoho on 2018. 7. 26..
|
|
3
|
-
*/
|
|
4
|
-
import OvenTemplate from 'view/engine/OvenTemplate';
|
|
5
|
-
import PanelManager from "view/global/PanelManager";
|
|
6
|
-
import LA$ from 'utils/likeA$';
|
|
7
|
-
import {
|
|
8
|
-
AUDIO_TRACK_CHANGED
|
|
9
|
-
} from "api/constants";
|
|
10
|
-
import _ from "
|
|
11
|
-
|
|
12
|
-
const AudioTrackPanel = function ($container, api, data) {
|
|
13
|
-
const $root = LA$(api.getContainerElement());
|
|
14
|
-
let panelManager = PanelManager();
|
|
15
|
-
|
|
16
|
-
data.setFront = function (isFront) {
|
|
17
|
-
if (isFront) {
|
|
18
|
-
$root.find("#" + data.id).removeClass("background");
|
|
19
|
-
} else {
|
|
20
|
-
$root.find("#" + data.id).addClass("background");
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
const onRendered = function ($current, template) {
|
|
24
|
-
api.on(AUDIO_TRACK_CHANGED, function (data) {
|
|
25
|
-
_.forEach($root.find("#" + template.data.id).find(".op-setting-item").get(), function (panel) {
|
|
26
|
-
let $panel = LA$(panel);
|
|
27
|
-
|
|
28
|
-
if ($panel.find(".op-setting-item-checked").hasClass("op-show")) {
|
|
29
|
-
$panel.find(".op-setting-item-checked").removeClass("op-show");
|
|
30
|
-
}
|
|
31
|
-
if (data.currentAudioTrack === parseInt($panel.attr("op-data-value"))) {
|
|
32
|
-
$panel.find(".op-setting-item-checked").addClass("op-show");
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
}, template);
|
|
36
|
-
};
|
|
37
|
-
const onDestroyed = function (template) {
|
|
38
|
-
api.off(AUDIO_TRACK_CHANGED, null, template);
|
|
39
|
-
};
|
|
40
|
-
const events = {
|
|
41
|
-
"click .op-setting-item": function (event, $current, template) {
|
|
42
|
-
event.preventDefault();
|
|
43
|
-
let value = LA$(event.currentTarget).attr("op-data-value");
|
|
44
|
-
api.setCurrentAudioTrack(parseInt(value));
|
|
45
|
-
panelManager.clear();
|
|
46
|
-
},
|
|
47
|
-
"click .op-setting-title": function (event, $current, template) {
|
|
48
|
-
event.preventDefault();
|
|
49
|
-
panelManager.removeLastItem();
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
return OvenTemplate($container, "AudioTrackPanel", api.getConfig(), data, events, onRendered, onDestroyed);
|
|
54
|
-
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
export default AudioTrackPanel;
|
|
1
|
+
/**
|
|
2
|
+
* Created by hoho on 2018. 7. 26..
|
|
3
|
+
*/
|
|
4
|
+
import OvenTemplate from 'view/engine/OvenTemplate';
|
|
5
|
+
import PanelManager from "view/global/PanelManager";
|
|
6
|
+
import LA$ from 'utils/likeA$';
|
|
7
|
+
import {
|
|
8
|
+
AUDIO_TRACK_CHANGED
|
|
9
|
+
} from "api/constants";
|
|
10
|
+
import _ from "underscore";
|
|
11
|
+
|
|
12
|
+
const AudioTrackPanel = function ($container, api, data) {
|
|
13
|
+
const $root = LA$(api.getContainerElement());
|
|
14
|
+
let panelManager = PanelManager();
|
|
15
|
+
|
|
16
|
+
data.setFront = function (isFront) {
|
|
17
|
+
if (isFront) {
|
|
18
|
+
$root.find("#" + data.id).removeClass("background");
|
|
19
|
+
} else {
|
|
20
|
+
$root.find("#" + data.id).addClass("background");
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
const onRendered = function ($current, template) {
|
|
24
|
+
api.on(AUDIO_TRACK_CHANGED, function (data) {
|
|
25
|
+
_.forEach($root.find("#" + template.data.id).find(".op-setting-item").get(), function (panel) {
|
|
26
|
+
let $panel = LA$(panel);
|
|
27
|
+
|
|
28
|
+
if ($panel.find(".op-setting-item-checked").hasClass("op-show")) {
|
|
29
|
+
$panel.find(".op-setting-item-checked").removeClass("op-show");
|
|
30
|
+
}
|
|
31
|
+
if (data.currentAudioTrack === parseInt($panel.attr("op-data-value"))) {
|
|
32
|
+
$panel.find(".op-setting-item-checked").addClass("op-show");
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}, template);
|
|
36
|
+
};
|
|
37
|
+
const onDestroyed = function (template) {
|
|
38
|
+
api.off(AUDIO_TRACK_CHANGED, null, template);
|
|
39
|
+
};
|
|
40
|
+
const events = {
|
|
41
|
+
"click .op-setting-item": function (event, $current, template) {
|
|
42
|
+
event.preventDefault();
|
|
43
|
+
let value = LA$(event.currentTarget).attr("op-data-value");
|
|
44
|
+
api.setCurrentAudioTrack(parseInt(value));
|
|
45
|
+
panelManager.clear();
|
|
46
|
+
},
|
|
47
|
+
"click .op-setting-title": function (event, $current, template) {
|
|
48
|
+
event.preventDefault();
|
|
49
|
+
panelManager.removeLastItem();
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
return OvenTemplate($container, "AudioTrackPanel", api.getConfig(), data, events, onRendered, onDestroyed);
|
|
54
|
+
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export default AudioTrackPanel;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import OvenTemplate from 'view/engine/OvenTemplate';
|
|
5
5
|
import PanelManager from "view/global/PanelManager";
|
|
6
6
|
import LA$ from 'utils/likeA$';
|
|
7
|
-
import _ from "
|
|
7
|
+
import _ from "underscore";
|
|
8
8
|
import sizeHumanizer from "utils/sizeHumanizer";
|
|
9
9
|
import SpeedPanel from "view/components/controls/settingPanel/speedPanel";
|
|
10
10
|
import ZoomPanel from "view/components/controls/settingPanel/zoomPanel";
|