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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ovenplayer",
3
- "version": "0.10.46",
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/AirenSoft/OvenPlayer.git"
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": "AirenSoft Co., Ltd.",
25
+ "author": "OvenMedia Labs Inc.",
26
26
  "license": "MIT",
27
27
  "bugs": {
28
- "url": "https://github.com/AirenSoft/OvenPlayer/issues"
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
- parseStream: {
44
- enabled: false
45
- }
46
- };
47
- const serialize = function (val) {
48
- if (val === undefined) {
49
- return null;
50
- }
51
- if (typeof val === 'string' && val.length < 6) {
52
- const lowercaseVal = val.toLowerCase();
53
- if (lowercaseVal === 'true') {
54
- return true;
55
- }
56
- if (lowercaseVal === 'false') {
57
- return false;
58
- }
59
- if (!isNaN(Number(val)) && !isNaN(parseFloat(val))) {
60
- return Number(val);
61
- }
62
- }
63
- return val;
64
- }
65
- const deserialize = function (options) {
66
- Object.keys(options).forEach((key) => {
67
- if (key === 'id') {
68
- return;
69
- }
70
- options[key] = serialize(options[key]);
71
- });
72
- }
73
-
74
- deserialize(options);
75
- let config = Object.assign({}, Defaults, options);
76
- let userCustumSystemText = [];
77
- if (config.systemText) {
78
- userCustumSystemText = _.isArray(config.systemText) ? config.systemText : [config.systemText];
79
- }
80
-
81
- for (let i = 0; i < userCustumSystemText.length; i++) {
82
- if (userCustumSystemText[i].lang) {
83
- let currentSystemText = _.findWhere(SYSTEM_TEXT, { "lang": userCustumSystemText[i].lang });
84
- if (currentSystemText) {
85
- //validate & update
86
- deepMerge(currentSystemText, userCustumSystemText[i]);
87
- } else {
88
- //create
89
- currentSystemText = _.findWhere(SYSTEM_TEXT, { "lang": "en" });
90
- currentSystemText.lang = userCustumSystemText[i].lang;
91
- const newMerged = deepMerge({}, currentSystemText, userCustumSystemText[i]);
92
- SYSTEM_TEXT.push(newMerged);
93
- }
94
- }
95
- }
96
- config.systemText = _.findWhere(SYSTEM_TEXT, { "lang": config.lang });
97
-
98
- let playbackRates = config.playbackRates;
99
-
100
- playbackRates = playbackRates.filter(rate => _.isNumber(rate) && rate >= 0.25 && rate <= 4).map(rate => Math.round(rate * 4) / 4);
101
-
102
- if (playbackRates.indexOf(1) < 0) {
103
- playbackRates.push(1);
104
- }
105
- playbackRates.sort();
106
-
107
- config.playbackRates = playbackRates;
108
-
109
- config.rtmpBufferTime = config.rtmpBufferTime > 10 ? 10 : config.rtmpBufferTime;
110
- config.rtmpBufferTimeMax = config.rtmpBufferTimeMax > 50 ? 50 : config.rtmpBufferTimeMax;
111
-
112
-
113
- if (config.playbackRates.indexOf(config.playbackRate) < 0) {
114
- config.playbackRate = 1;
115
- }
116
-
117
- const configPlaylist = config.playlist;
118
- if (!configPlaylist) {
119
- const obj = _.pick(config, [
120
- 'title',
121
- 'description',
122
- 'type',
123
- 'image',
124
- 'file',
125
- 'sources',
126
- 'tracks',
127
- 'host',
128
- 'application',
129
- 'stream',
130
- 'adTagUrl'
131
- ]);
132
-
133
- config.playlist = [obj];
134
- } else if (_.isArray(configPlaylist.playlist)) {
135
- config.feedData = configPlaylist;
136
- config.playlist = configPlaylist.playlist;
137
- }
138
-
139
- delete config.duration;
140
- return config;
141
- };
142
- OvenPlayerConsole.log("Configurator loaded.", options);
143
- let spec = composeSourceOptions(options);
144
-
145
- //spec.isFullscreen = false; //IE 11 can't check current fullscreen state.
146
-
147
- const that = {};
148
- that.getConfig = () => {
149
- return spec;
150
- };
151
- that.getAdClient = () => {
152
- return spec.adClient;
153
- };
154
- that.setConfig = (config, value) => {
155
- spec[config] = value;
156
- };
157
-
158
- that.getContainer = () => {
159
- return spec.mediaContainer;
160
- };
161
- /*that.isFullscreen = () => {
162
- return spec.isFullscreen;
163
- }
164
- that.setFullscreen = (isFullscreen) => {
165
- return spec.isFullscreen = isFullscreen;
166
- }*/
167
-
168
- that.getPlaybackRate = () => {
169
- return spec.playbackRate;
170
- };
171
- that.setPlaybackRate = (playbackRate) => {
172
- spec.playbackRate = playbackRate;
173
- return playbackRate;
174
- };
175
- that.getZoomFactor = () => {
176
- return spec.zoomFactor;
177
- };
178
- that.setZoomFactor = (zoomFactor) => {
179
- spec.zoomFactor = zoomFactor;
180
- return zoomFactor;
181
- };
182
- that.getQualityLabel = () => {
183
- return spec.qualityLabel;
184
- };
185
- that.setQualityLabel = (newLabel) => {
186
- spec.qualityLabel = newLabel;
187
- };
188
-
189
- that.isCurrentProtocolOnly = () => {
190
- return spec.currentProtocolOnly;
191
- };
192
- /*that.getSourceLabel = () => {
193
- return spec.sourceLabel;
194
- };
195
- that.setSourceLabel = (newLabel) => {
196
- spec.sourceLabel = newLabel;
197
- };*/
198
-
199
- that.getSourceIndex = () => {
200
- return spec.sourceIndex;
201
- };
202
- that.setSourceIndex = (index) => {
203
- spec.sourceIndex = index;
204
- };
205
- that.setTimecodeMode = (timecode) => {
206
- if (spec.timecode !== timecode) {
207
- spec.timecode = timecode;
208
- provider.trigger(CONTENT_TIME_MODE_CHANGED, timecode);
209
- }
210
- };
211
- that.isTimecodeMode = () => {
212
- return spec.timecode;
213
- };
214
- that.getRtmpBufferTime = () => {
215
- return spec.rtmpBufferTime;
216
- };
217
- that.getRtmpBufferTimeMax = () => {
218
- return spec.rtmpBufferTimeMax;
219
- };
220
- that.setMute = (mute) => {
221
- spec.mute = mute;
222
- };
223
- that.isMute = () => {
224
- return spec.mute;
225
- };
226
- that.getVolume = () => {
227
- return spec.volume;
228
- };
229
- that.setVolume = (volume) => {
230
- spec.volume = volume;
231
- };
232
- that.isLoop = () => {
233
- return spec.loop;
234
- };
235
- that.isAutoStart = () => {
236
- return spec.autoStart;
237
- };
238
- that.isControls = () => {
239
- return spec.controls;
240
- };
241
-
242
- that.getPlaybackRates = () => {
243
- return spec.playbackRates;
244
- };
245
- that.getBrowser = () => {
246
- return spec.browser;
247
- };
248
- that.getSystemText = () => {
249
- return spec.systemText;
250
- };
251
- that.getLanguage = () => {
252
- return spec.lang;
253
- };
254
-
255
- that.getPlaylist = () => {
256
- return spec.playlist;
257
- };
258
- that.setPlaylist = (playlist) => {
259
- if (_.isArray(playlist)) {
260
- spec.playlist = playlist;
261
- } else {
262
- spec.playlist = [playlist];
263
- }
264
- return spec.playlist;
265
- };
266
-
267
- return that;
268
- };
269
-
270
- export default Configurator;
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;