ovenplayer 0.10.46 → 0.10.48
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/LICENSE +1 -1
- package/README.md +22 -22
- package/dist/ovenplayer.js +1 -1
- package/dist/ovenplayer.js.map +1 -1
- package/package.json +4 -4
- package/src/js/api/Configurator.js +272 -270
- package/src/js/api/caption/Loader.js +67 -67
- package/src/js/api/caption/Manager.js +143 -141
- package/src/js/api/constants.js +622 -621
- package/src/js/api/provider/html5/Provider.js +570 -563
- package/src/js/api/provider/html5/providers/WebRTCLoader.js +1 -1
- package/src/js/view/components/controls/settingPanel/captionPanel.js +42 -42
- package/src/js/view/components/controls/settingPanel/main.js +321 -321
- package/src/js/view/components/helpers/contextPanel.js +44 -38
- package/src/js/view/components/helpers/contextPanelTemplate.js +19 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ovenplayer",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.48",
|
|
4
4
|
"description": "OvenPlayer is Open-Source HTML5 Player. OvenPlayer supports WebRTC Signaling from OvenMediaEngine for Sub-Second Latency Streaming.",
|
|
5
5
|
"main": "dist/ovenplayer.js",
|
|
6
6
|
"scripts": {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
12
|
-
"url": "git+https://github.com/
|
|
12
|
+
"url": "git+https://github.com/OvenMediaLabs/OvenPlayer.git"
|
|
13
13
|
},
|
|
14
14
|
"keywords": [
|
|
15
15
|
"Sub-Second Latency Streaming",
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
"Video",
|
|
23
23
|
"Player"
|
|
24
24
|
],
|
|
25
|
-
"author": "
|
|
25
|
+
"author": "OvenMedia Labs Inc.",
|
|
26
26
|
"license": "MIT",
|
|
27
27
|
"bugs": {
|
|
28
|
-
"url": "https://github.com/
|
|
28
|
+
"url": "https://github.com/OvenMediaLabs/OvenPlayer/issues"
|
|
29
29
|
},
|
|
30
30
|
"homepage": "https://www.ovenmediaengine.com/ovenplayer",
|
|
31
31
|
"devDependencies": {
|
|
@@ -1,270 +1,272 @@
|
|
|
1
|
-
import _ from "utils/underscore";
|
|
2
|
-
import deepMerge from "utils/deepMerge";
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
CONTENT_TIME_MODE_CHANGED, SYSTEM_TEXT
|
|
6
|
-
} from "api/constants";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @brief This initializes the input options.
|
|
10
|
-
* @param options
|
|
11
|
-
*
|
|
12
|
-
* */
|
|
13
|
-
const Configurator = function (options, provider) {
|
|
14
|
-
|
|
15
|
-
const composeSourceOptions = function (options) {
|
|
16
|
-
const Defaults = {
|
|
17
|
-
mediaContainer: "",
|
|
18
|
-
playbackRates: [2, 1.5, 1, 0.5, 0.25],
|
|
19
|
-
playbackRate: 1,
|
|
20
|
-
mute: false,
|
|
21
|
-
volume: 100,
|
|
22
|
-
loop: false,
|
|
23
|
-
controls: true,
|
|
24
|
-
autoStart: false,
|
|
25
|
-
autoFallback: true,
|
|
26
|
-
timecode: true,
|
|
27
|
-
sourceIndex: -1,
|
|
28
|
-
browser: "",
|
|
29
|
-
hidePlaylistIcon: false,
|
|
30
|
-
rtmpBufferTime: 1,
|
|
31
|
-
rtmpBufferTimeMax: 3,
|
|
32
|
-
adClient: "googleima",
|
|
33
|
-
currentProtocolOnly: false,
|
|
34
|
-
systemText: null,
|
|
35
|
-
lang: "en",
|
|
36
|
-
loadingRetryCount: 0,
|
|
37
|
-
expandFullScreenUI: true,
|
|
38
|
-
fullscreenOption: null,
|
|
39
|
-
showBigPlayButton: true,
|
|
40
|
-
doubleTapToSeek: false,
|
|
41
|
-
showZoomSettings: false,
|
|
42
|
-
legacyUI: false,
|
|
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
|
-
playbackRates = playbackRates
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
config.
|
|
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
|
-
config.
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
spec.playlist =
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
1
|
+
import _ from "utils/underscore";
|
|
2
|
+
import deepMerge from "utils/deepMerge";
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
CONTENT_TIME_MODE_CHANGED, SYSTEM_TEXT
|
|
6
|
+
} from "api/constants";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @brief This initializes the input options.
|
|
10
|
+
* @param options
|
|
11
|
+
*
|
|
12
|
+
* */
|
|
13
|
+
const Configurator = function (options, provider) {
|
|
14
|
+
|
|
15
|
+
const composeSourceOptions = function (options) {
|
|
16
|
+
const Defaults = {
|
|
17
|
+
mediaContainer: "",
|
|
18
|
+
playbackRates: [2, 1.5, 1, 0.5, 0.25],
|
|
19
|
+
playbackRate: 1,
|
|
20
|
+
mute: false,
|
|
21
|
+
volume: 100,
|
|
22
|
+
loop: false,
|
|
23
|
+
controls: true,
|
|
24
|
+
autoStart: false,
|
|
25
|
+
autoFallback: true,
|
|
26
|
+
timecode: true,
|
|
27
|
+
sourceIndex: -1,
|
|
28
|
+
browser: "",
|
|
29
|
+
hidePlaylistIcon: false,
|
|
30
|
+
rtmpBufferTime: 1,
|
|
31
|
+
rtmpBufferTimeMax: 3,
|
|
32
|
+
adClient: "googleima",
|
|
33
|
+
currentProtocolOnly: false,
|
|
34
|
+
systemText: null,
|
|
35
|
+
lang: "en",
|
|
36
|
+
loadingRetryCount: 0,
|
|
37
|
+
expandFullScreenUI: true,
|
|
38
|
+
fullscreenOption: null,
|
|
39
|
+
showBigPlayButton: true,
|
|
40
|
+
doubleTapToSeek: false,
|
|
41
|
+
showZoomSettings: false,
|
|
42
|
+
legacyUI: false,
|
|
43
|
+
contextItems: [],
|
|
44
|
+
parseStream: {
|
|
45
|
+
enabled: false
|
|
46
|
+
},
|
|
47
|
+
autoMuteRetryOnNotAllowed: false,
|
|
48
|
+
};
|
|
49
|
+
const serialize = function (val) {
|
|
50
|
+
if (val === undefined) {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
if (typeof val === 'string' && val.length < 6) {
|
|
54
|
+
const lowercaseVal = val.toLowerCase();
|
|
55
|
+
if (lowercaseVal === 'true') {
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
if (lowercaseVal === 'false') {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
if (!isNaN(Number(val)) && !isNaN(parseFloat(val))) {
|
|
62
|
+
return Number(val);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return val;
|
|
66
|
+
}
|
|
67
|
+
const deserialize = function (options) {
|
|
68
|
+
Object.keys(options).forEach((key) => {
|
|
69
|
+
if (key === 'id') {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
options[key] = serialize(options[key]);
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
deserialize(options);
|
|
77
|
+
let config = Object.assign({}, Defaults, options);
|
|
78
|
+
let userCustumSystemText = [];
|
|
79
|
+
if (config.systemText) {
|
|
80
|
+
userCustumSystemText = _.isArray(config.systemText) ? config.systemText : [config.systemText];
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
for (let i = 0; i < userCustumSystemText.length; i++) {
|
|
84
|
+
if (userCustumSystemText[i].lang) {
|
|
85
|
+
let currentSystemText = _.findWhere(SYSTEM_TEXT, { "lang": userCustumSystemText[i].lang });
|
|
86
|
+
if (currentSystemText) {
|
|
87
|
+
//validate & update
|
|
88
|
+
deepMerge(currentSystemText, userCustumSystemText[i]);
|
|
89
|
+
} else {
|
|
90
|
+
//create
|
|
91
|
+
currentSystemText = _.findWhere(SYSTEM_TEXT, { "lang": "en" });
|
|
92
|
+
currentSystemText.lang = userCustumSystemText[i].lang;
|
|
93
|
+
const newMerged = deepMerge({}, currentSystemText, userCustumSystemText[i]);
|
|
94
|
+
SYSTEM_TEXT.push(newMerged);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
config.systemText = _.findWhere(SYSTEM_TEXT, { "lang": config.lang });
|
|
99
|
+
|
|
100
|
+
let playbackRates = config.playbackRates;
|
|
101
|
+
|
|
102
|
+
playbackRates = playbackRates.filter(rate => _.isNumber(rate) && rate >= 0.25 && rate <= 4).map(rate => Math.round(rate * 4) / 4);
|
|
103
|
+
|
|
104
|
+
if (playbackRates.indexOf(1) < 0) {
|
|
105
|
+
playbackRates.push(1);
|
|
106
|
+
}
|
|
107
|
+
playbackRates.sort();
|
|
108
|
+
|
|
109
|
+
config.playbackRates = playbackRates;
|
|
110
|
+
|
|
111
|
+
config.rtmpBufferTime = config.rtmpBufferTime > 10 ? 10 : config.rtmpBufferTime;
|
|
112
|
+
config.rtmpBufferTimeMax = config.rtmpBufferTimeMax > 50 ? 50 : config.rtmpBufferTimeMax;
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
if (config.playbackRates.indexOf(config.playbackRate) < 0) {
|
|
116
|
+
config.playbackRate = 1;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const configPlaylist = config.playlist;
|
|
120
|
+
if (!configPlaylist) {
|
|
121
|
+
const obj = _.pick(config, [
|
|
122
|
+
'title',
|
|
123
|
+
'description',
|
|
124
|
+
'type',
|
|
125
|
+
'image',
|
|
126
|
+
'file',
|
|
127
|
+
'sources',
|
|
128
|
+
'tracks',
|
|
129
|
+
'host',
|
|
130
|
+
'application',
|
|
131
|
+
'stream',
|
|
132
|
+
'adTagUrl'
|
|
133
|
+
]);
|
|
134
|
+
|
|
135
|
+
config.playlist = [obj];
|
|
136
|
+
} else if (_.isArray(configPlaylist.playlist)) {
|
|
137
|
+
config.feedData = configPlaylist;
|
|
138
|
+
config.playlist = configPlaylist.playlist;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
delete config.duration;
|
|
142
|
+
return config;
|
|
143
|
+
};
|
|
144
|
+
OvenPlayerConsole.log("Configurator loaded.", options);
|
|
145
|
+
let spec = composeSourceOptions(options);
|
|
146
|
+
|
|
147
|
+
//spec.isFullscreen = false; //IE 11 can't check current fullscreen state.
|
|
148
|
+
|
|
149
|
+
const that = {};
|
|
150
|
+
that.getConfig = () => {
|
|
151
|
+
return spec;
|
|
152
|
+
};
|
|
153
|
+
that.getAdClient = () => {
|
|
154
|
+
return spec.adClient;
|
|
155
|
+
};
|
|
156
|
+
that.setConfig = (config, value) => {
|
|
157
|
+
spec[config] = value;
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
that.getContainer = () => {
|
|
161
|
+
return spec.mediaContainer;
|
|
162
|
+
};
|
|
163
|
+
/*that.isFullscreen = () => {
|
|
164
|
+
return spec.isFullscreen;
|
|
165
|
+
}
|
|
166
|
+
that.setFullscreen = (isFullscreen) => {
|
|
167
|
+
return spec.isFullscreen = isFullscreen;
|
|
168
|
+
}*/
|
|
169
|
+
|
|
170
|
+
that.getPlaybackRate = () => {
|
|
171
|
+
return spec.playbackRate;
|
|
172
|
+
};
|
|
173
|
+
that.setPlaybackRate = (playbackRate) => {
|
|
174
|
+
spec.playbackRate = playbackRate;
|
|
175
|
+
return playbackRate;
|
|
176
|
+
};
|
|
177
|
+
that.getZoomFactor = () => {
|
|
178
|
+
return spec.zoomFactor;
|
|
179
|
+
};
|
|
180
|
+
that.setZoomFactor = (zoomFactor) => {
|
|
181
|
+
spec.zoomFactor = zoomFactor;
|
|
182
|
+
return zoomFactor;
|
|
183
|
+
};
|
|
184
|
+
that.getQualityLabel = () => {
|
|
185
|
+
return spec.qualityLabel;
|
|
186
|
+
};
|
|
187
|
+
that.setQualityLabel = (newLabel) => {
|
|
188
|
+
spec.qualityLabel = newLabel;
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
that.isCurrentProtocolOnly = () => {
|
|
192
|
+
return spec.currentProtocolOnly;
|
|
193
|
+
};
|
|
194
|
+
/*that.getSourceLabel = () => {
|
|
195
|
+
return spec.sourceLabel;
|
|
196
|
+
};
|
|
197
|
+
that.setSourceLabel = (newLabel) => {
|
|
198
|
+
spec.sourceLabel = newLabel;
|
|
199
|
+
};*/
|
|
200
|
+
|
|
201
|
+
that.getSourceIndex = () => {
|
|
202
|
+
return spec.sourceIndex;
|
|
203
|
+
};
|
|
204
|
+
that.setSourceIndex = (index) => {
|
|
205
|
+
spec.sourceIndex = index;
|
|
206
|
+
};
|
|
207
|
+
that.setTimecodeMode = (timecode) => {
|
|
208
|
+
if (spec.timecode !== timecode) {
|
|
209
|
+
spec.timecode = timecode;
|
|
210
|
+
provider.trigger(CONTENT_TIME_MODE_CHANGED, timecode);
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
that.isTimecodeMode = () => {
|
|
214
|
+
return spec.timecode;
|
|
215
|
+
};
|
|
216
|
+
that.getRtmpBufferTime = () => {
|
|
217
|
+
return spec.rtmpBufferTime;
|
|
218
|
+
};
|
|
219
|
+
that.getRtmpBufferTimeMax = () => {
|
|
220
|
+
return spec.rtmpBufferTimeMax;
|
|
221
|
+
};
|
|
222
|
+
that.setMute = (mute) => {
|
|
223
|
+
spec.mute = mute;
|
|
224
|
+
};
|
|
225
|
+
that.isMute = () => {
|
|
226
|
+
return spec.mute;
|
|
227
|
+
};
|
|
228
|
+
that.getVolume = () => {
|
|
229
|
+
return spec.volume;
|
|
230
|
+
};
|
|
231
|
+
that.setVolume = (volume) => {
|
|
232
|
+
spec.volume = volume;
|
|
233
|
+
};
|
|
234
|
+
that.isLoop = () => {
|
|
235
|
+
return spec.loop;
|
|
236
|
+
};
|
|
237
|
+
that.isAutoStart = () => {
|
|
238
|
+
return spec.autoStart;
|
|
239
|
+
};
|
|
240
|
+
that.isControls = () => {
|
|
241
|
+
return spec.controls;
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
that.getPlaybackRates = () => {
|
|
245
|
+
return spec.playbackRates;
|
|
246
|
+
};
|
|
247
|
+
that.getBrowser = () => {
|
|
248
|
+
return spec.browser;
|
|
249
|
+
};
|
|
250
|
+
that.getSystemText = () => {
|
|
251
|
+
return spec.systemText;
|
|
252
|
+
};
|
|
253
|
+
that.getLanguage = () => {
|
|
254
|
+
return spec.lang;
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
that.getPlaylist = () => {
|
|
258
|
+
return spec.playlist;
|
|
259
|
+
};
|
|
260
|
+
that.setPlaylist = (playlist) => {
|
|
261
|
+
if (_.isArray(playlist)) {
|
|
262
|
+
spec.playlist = playlist;
|
|
263
|
+
} else {
|
|
264
|
+
spec.playlist = [playlist];
|
|
265
|
+
}
|
|
266
|
+
return spec.playlist;
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
return that;
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
export default Configurator;
|