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.
Files changed (34) hide show
  1. package/dist/ovenplayer.js +1 -1
  2. package/dist/ovenplayer.js.map +1 -1
  3. package/package.json +49 -49
  4. package/src/js/api/Configurator.js +1 -1
  5. package/src/js/api/ads/vast/Ad.js +237 -237
  6. package/src/js/api/caption/Loader.js +1 -1
  7. package/src/js/api/caption/Manager.js +1 -1
  8. package/src/js/api/caption/parser/VttParser.js +1541 -1542
  9. package/src/js/api/playlist/Manager.js +229 -229
  10. package/src/js/api/provider/html5/providers/Dash.js +286 -286
  11. package/src/js/api/provider/html5/providers/Hls.js +110 -2
  12. package/src/js/api/provider/html5/providers/WebRTC.js +2 -1
  13. package/src/js/api/provider/html5/providers/WebRTCLoader.js +35 -2
  14. package/src/js/api/provider/utils.js +69 -69
  15. package/src/js/ovenplayer.sdk.js +143 -143
  16. package/src/js/utils/likeA$.js +241 -242
  17. package/src/js/utils/resize-sensor.js +145 -168
  18. package/src/js/utils/strings.js +104 -104
  19. package/src/js/view/components/controls/settingPanel/audioTrackPanel.js +57 -57
  20. package/src/js/view/components/controls/settingPanel/main.js +1 -1
  21. package/src/js/view/components/controls/settingPanel/mainTemplate.js +29 -29
  22. package/src/js/view/components/controls/settingPanel/qualityPanel.js +68 -68
  23. package/src/js/view/components/controls/settingPanel/subtitleTrackPanel.js +56 -56
  24. package/src/js/view/components/helpers/captionViewer.js +97 -15
  25. package/src/js/view/components/helpers/captionViewerTemplate.js +1 -2
  26. package/src/js/view/components/helpers/waterMark.js +69 -69
  27. package/src/js/view/engine/OvenTemplate.js +158 -158
  28. package/src/js/view/global/PanelManager.js +47 -47
  29. package/src/stylesheet/ovenplayer.less +52 -21
  30. package/src/js/utils/adapter.js +0 -4944
  31. package/src/js/utils/captions/vttCue.js +0 -308
  32. package/src/js/utils/captions/vttRegion.js +0 -136
  33. package/src/js/utils/polyfills/dom.js +0 -634
  34. package/src/js/utils/underscore.js +0 -6
@@ -1,168 +1,145 @@
1
- (function (root, factory) {
2
- if (typeof define === 'function' && define.amd) {
3
- // AMD. Register as an anonymous module.
4
- define([], function () {
5
- return (root.returnExportsGlobal = factory());
6
- });
7
- } else if (typeof exports === 'object') {
8
- // Node. Does not work with strict CommonJS, but
9
- // only CommonJS-like enviroments that support module.exports,
10
- // like Node.
11
- module.exports = factory();
12
- } else {
13
- root['ResizeSensor'] = factory();
14
- }
15
- }(this, function () {
16
-
17
- var ResizeSensor = function () {
18
- 'use strict';
19
- var requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || function (fn) {
20
- return window.setTimeout(fn, 20);
21
- };
22
- /**
23
- *
24
- * @constructor
25
- */
26
- function EventQueue() {
27
- this.q = [];
28
- this.add = function (ev) {
29
- this.q.push(ev);
30
- };
31
- var i, j;
32
- this.call = function () {
33
- for (i = 0, j = this.q.length; i < j; i++) {
34
- this.q[i].call();
35
- }
36
- };
37
- }
38
- /**
39
- * @param {HTMLElement} element
40
- * @param {String} prop
41
- * @returns {String|Number}
42
- */
43
- function getComputedStyle(element, prop) {
44
- if (element.currentStyle) {
45
- return element.currentStyle[prop];
46
- } else if (window.getComputedStyle) {
47
- return window.getComputedStyle(element, null).getPropertyValue(prop);
48
- } else {
49
- return element.style[prop];
50
- }
51
- }
52
- /**
53
- *
54
- * @param {HTMLElement} element
55
- * @param {Function} resized
56
- */
57
- function attachResizeEvent(element, resized) {
58
- if (!element.resizedAttached) {
59
- element.resizedAttached = new EventQueue();
60
- element.resizedAttached.add(resized);
61
- } else if (element.resizedAttached) {
62
- element.resizedAttached.add(resized);
63
- return;
64
- }
65
- element.resizeSensor = document.createElement('div');
66
- element.resizeSensor.className = 'resize-sensor';
67
- var style = 'position: absolute; left: 0; top: 0; right: 0; bottom: 0; overflow: hidden; z-index: -1; visibility: hidden; opacity: 0;direction: ltr;';
68
- var styleChild = 'position: absolute; left: 0; top: 0; transition: 0s;';
69
- element.resizeSensor.style.cssText = style;
70
- 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>';
71
- element.appendChild(element.resizeSensor);
72
- if (getComputedStyle(element, 'position') == 'static') {
73
- element.style.position = 'relative';
74
- }
75
- var expand = element.resizeSensor.childNodes[0];
76
- var expandChild = expand.childNodes[0];
77
- var shrink = element.resizeSensor.childNodes[1];
78
- var reset = function () {
79
- expandChild.style.width = 100000 + 'px';
80
- expandChild.style.height = 100000 + 'px';
81
- expand.scrollLeft = 100000;
82
- expand.scrollTop = 100000;
83
- shrink.scrollLeft = 100000;
84
- shrink.scrollTop = 100000;
85
- };
86
- reset();
87
- var dirty = false;
88
- var dirtyChecking = function () {
89
- if (!element.resizedAttached)
90
- return;
91
- if (dirty) {
92
- element.resizedAttached.call();
93
- dirty = false;
94
- }
95
- requestAnimationFrame(dirtyChecking);
96
- };
97
- requestAnimationFrame(dirtyChecking);
98
- var lastWidth, lastHeight;
99
- var cachedWidth, cachedHeight;
100
- //useful to not query offsetWidth twice
101
- var onScroll = function () {
102
- if ((cachedWidth = element.offsetWidth) != lastWidth || (cachedHeight = element.offsetHeight) != lastHeight) {
103
- dirty = true;
104
- lastWidth = cachedWidth;
105
- lastHeight = cachedHeight;
106
- }
107
- reset();
108
- };
109
- var addEvent = function (el, name, cb) {
110
- if (el.attachEvent) {
111
- el.attachEvent('on' + name, cb);
112
- } else {
113
- el.addEventListener(name, cb);
114
- }
115
- };
116
- addEvent(expand, 'scroll', onScroll);
117
- addEvent(shrink, 'scroll', onScroll);
118
- }
119
- /**
120
- * Class for dimension change detection.
121
- *
122
- * @param {Element|Element[]|Elements|jQuery} element
123
- * @param {Function} callback
124
- *
125
- * @constructor
126
- */
127
- var ResizeSensor = function (element, callback) {
128
- var me = this;
129
- var elementType = Object.prototype.toString.call(element);
130
- 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;
131
- me._element = element;
132
- if (isCollectionTyped) {
133
- var i = 0, j = element.length;
134
- for (; i < j; i++) {
135
- attachResizeEvent(element[i], callback);
136
- }
137
- } else {
138
- attachResizeEvent(element, callback);
139
- }
140
- };
141
- ResizeSensor.prototype.detach = function () {
142
- var me = this;
143
- var isCollectionTyped = me._isCollectionTyped;
144
- var element = me._element;
145
- if (isCollectionTyped) {
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
+ })();
@@ -1,104 +1,104 @@
1
- import _ from 'utils/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
+ 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 "utils/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;
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 "utils/underscore";
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";