ovenplayer 0.10.0 → 0.10.5

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,10 +1,10 @@
1
1
  {
2
2
  "name": "ovenplayer",
3
- "version": "0.10.0",
3
+ "version": "0.10.5",
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": {
7
- "watch": "webpack --config webpack.config.js --watch",
7
+ "watch": "webpack --config webpack.development.js --watch",
8
8
  "build": "webpack --config webpack.config.js"
9
9
  },
10
10
  "repository": {
@@ -45,4 +45,4 @@
45
45
  "core-js": "^3.16.3",
46
46
  "whatwg-fetch": "^3.6.2"
47
47
  }
48
- }
48
+ }
@@ -1,14 +1,14 @@
1
- <?xml version="1.0" standalone="no"?>
2
- <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
- <svg xmlns="http://www.w3.org/2000/svg">
4
- <metadata>Copyright (C) 2020 by original authors @ fontello.com</metadata>
5
- <defs>
6
- <font id="seek-icons" horiz-adv-x="1000" >
7
- <font-face font-family="seek-icons" font-weight="400" font-stretch="normal" units-per-em="1000" ascent="850" descent="-150" />
8
- <missing-glyph horiz-adv-x="1000" />
9
- <glyph glyph-name="op-seek-back" unicode="&#xe920;" d="M523 716v97l-150-138 150-137v111c155-11 277-141 277-299 0-166-134-300-300-300s-300 134-300 300c0 18-15 33-33 33s-34-15-34-33c0-202 165-367 367-367s367 165 367 367c0 194-153 354-344 366z" horiz-adv-x="1000" />
10
-
11
- <glyph glyph-name="op-seek-forward" unicode="&#xe921;" d="M833 383c-18 0-33-15-33-33 0-166-134-300-300-300s-300 134-300 300c0 158 123 288 277 299v-111l150 137-150 138v-97c-191-12-344-172-344-366 0-202 165-367 367-367s367 165 367 367c0 18-15 33-34 33z" horiz-adv-x="1000" />
12
- </font>
13
- </defs>
1
+ <?xml version="1.0" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg xmlns="http://www.w3.org/2000/svg">
4
+ <metadata>Copyright (C) 2020 by original authors @ fontello.com</metadata>
5
+ <defs>
6
+ <font id="seek-icons" horiz-adv-x="1000" >
7
+ <font-face font-family="seek-icons" font-weight="400" font-stretch="normal" units-per-em="1000" ascent="850" descent="-150" />
8
+ <missing-glyph horiz-adv-x="1000" />
9
+ <glyph glyph-name="op-seek-back" unicode="&#xe920;" d="M523 716v97l-150-138 150-137v111c155-11 277-141 277-299 0-166-134-300-300-300s-300 134-300 300c0 18-15 33-33 33s-34-15-34-33c0-202 165-367 367-367s367 165 367 367c0 194-153 354-344 366z" horiz-adv-x="1000" />
10
+
11
+ <glyph glyph-name="op-seek-forward" unicode="&#xe921;" d="M833 383c-18 0-33-15-33-33 0-166-134-300-300-300s-300 134-300 300c0 158 123 288 277 299v-111l150 137-150 138v-97c-191-12-344-172-344-366 0-202 165-367 367-367s367 165 367 367c0 18-15 33-34 33z" horiz-adv-x="1000" />
12
+ </font>
13
+ </defs>
14
14
  </svg>
package/src/js/api/Api.js CHANGED
@@ -1,16 +1,17 @@
1
+ import OvenPlayerSDK from "ovenplayer.sdk"
1
2
  import CaptionManager from "api/caption/Manager";
2
3
  import Configurator from "api/Configurator";
3
4
  import EventEmitter from "api/EventEmitter";
4
- import LazyCommandExecutor from "api/LazyCommandExecutor";
5
5
  import MediaManager from "api/media/Manager";
6
6
  import PlaylistManager from "api/playlist/Manager";
7
7
  import ProviderController from "api/provider/Controller";
8
- import {READY, ERRORS, ERROR, CONTENT_TIME_MODE_CHANGED, INIT_UNKNWON_ERROR, INIT_UNSUPPORT_ERROR, DESTROY, PLAYER_PLAY, NETWORK_UNSTABLED, PLAYER_WEBRTC_NETWORK_SLOW, PLAYER_WEBRTC_UNEXPECTED_DISCONNECT, PLAYER_WEBRTC_SET_LOCAL_DESC_ERROR,
8
+ import {READY, ERRORS, ERROR, CONTENT_COMPLETE, CONTENT_META, INIT_UNKNWON_ERROR, INIT_UNSUPPORT_ERROR, DESTROY, PLAYER_PLAY, NETWORK_UNSTABLED, PLAYER_WEBRTC_NETWORK_SLOW, PLAYER_WEBRTC_UNEXPECTED_DISCONNECT, PLAYER_WEBRTC_SET_LOCAL_DESC_ERROR,
9
9
  PLAYER_FILE_ERROR, PROVIDER_DASH, PROVIDER_HLS, PROVIDER_WEBRTC, PROVIDER_HTML5, PROVIDER_RTMP, ALL_PLAYLIST_ENDED} from "api/constants";
10
- import {version} from 'version';
10
+
11
11
  import {ApiRtmpExpansion} from 'api/ApiExpansions';
12
12
  import {analUserAgent} from "utils/browser";
13
13
  import {pickCurrentSource} from "api/provider/utils";
14
+ import {version} from "../version";
14
15
 
15
16
  /**
16
17
  * @brief This object connects UI to the provider.
@@ -22,7 +23,6 @@ const Api = function(container){
22
23
  const that = {};
23
24
  EventEmitter(that);
24
25
 
25
- console.log("[OvenPlayer] v."+ version);
26
26
  OvenPlayerConsole.log("API loaded.");
27
27
 
28
28
  let playlistManager = PlaylistManager(that);
@@ -31,11 +31,8 @@ const Api = function(container){
31
31
  let mediaManager = MediaManager(container, userAgentObject);
32
32
  let currentProvider = "";
33
33
  let playerConfig = "";
34
- let lazyQueue = "";
35
34
  let captionManager = "";
36
35
 
37
- let webrtcRetryInterval = 1000;
38
-
39
36
  const runNextPlaylist = function(index){
40
37
  OvenPlayerConsole.log("runNextPlaylist");
41
38
  let nextPlaylistIndex = index; // || playlistManager.getCurrentPlaylistIndex() + 1;
@@ -48,39 +45,16 @@ const Api = function(container){
48
45
  playerConfig.setVolume(currentProvider.getVolume());
49
46
 
50
47
  if(hasNextPlaylist){
51
- //that.pause();
52
- lazyQueue = LazyCommandExecutor(that, ['play','seek','stop']);
48
+
53
49
  playlistManager.setCurrentPlaylist(nextPlaylistIndex);
54
50
  initProvider();
55
51
 
56
-
57
- if(!playerConfig.isAutoStart()){
58
- //Anyway nextplaylist runs autoStart!.
59
- that.play();
60
- }
61
52
  }else{
62
53
  //All Playlist Ended.
63
54
  that.trigger(ALL_PLAYLIST_ENDED, null);
64
55
  }
65
56
  };
66
57
  const initProvider = function(lastPlayPosition){
67
- const pickQualityFromSource = (sources) =>{
68
- var quality = 0;
69
- if (sources) {
70
- for (var i = 0; i < sources.length; i++) {
71
- if (sources[i].default) {
72
- quality = i;
73
- }
74
- if (playerConfig.getSourceIndex() === i ) {
75
- return i;
76
- }
77
- /*if (playerConfig.getSourceLabel() && sources[i].label === playerConfig.getSourceLabel() ) {
78
- return i;
79
- }*/
80
- }
81
- }
82
- return quality;
83
- };
84
58
 
85
59
  return providerController.loadProviders(playlistManager.getCurrentPlayList()).then(Providers => {
86
60
 
@@ -124,32 +98,38 @@ const Api = function(container){
124
98
 
125
99
  // Chrome >=80 on Android misses h246 in SDP when first time after web page loaded.
126
100
  // So wait until browser get h264 capabilities and create answer SDP.
127
- if (userAgentObject.os === 'Android' && userAgentObject.browser === 'Chrome') {
101
+ // if (userAgentObject.os === 'Android' && userAgentObject.browser === 'Chrome') {
102
+ //
103
+ // if (data && data.code && data.code === PLAYER_WEBRTC_SET_LOCAL_DESC_ERROR) {
104
+ //
105
+ // setTimeout(function () {
106
+ //
107
+ // that.setCurrentSource(that.getCurrentSource());
108
+ // }, webrtcRetryInterval);
109
+ //
110
+ // return;
111
+ // }
112
+ // }
113
+
114
+ if (playerConfig.getConfig().autoFallback && that.getCurrentSource() + 1 < that.getSources().length) {
128
115
 
129
- if (data && data.code && data.code === PLAYER_WEBRTC_SET_LOCAL_DESC_ERROR) {
130
-
131
- setTimeout(function () {
132
-
133
- that.setCurrentSource(that.getCurrentSource());
134
- }, webrtcRetryInterval);
135
-
136
- return;
137
- }
138
- }
139
-
140
- if (playerConfig.getConfig().autoFallback && playerConfig.getSourceIndex() + 1 < that.getSources().length) {
141
- //this sequential has available source.
142
116
  that.pause();
143
- that.setCurrentSource(playerConfig.getSourceIndex() + 1);
117
+ that.setCurrentSource(that.getCurrentSource() + 1);
144
118
 
145
119
  return;
146
120
  }
147
121
  }
148
122
 
149
- if(name === "complete"){
123
+ if(name === CONTENT_COMPLETE){
150
124
  runNextPlaylist(playlistManager.getCurrentPlaylistIndex() + 1);
151
125
  }
152
126
 
127
+ if (name === CONTENT_META) {
128
+ if (playerConfig.isAutoStart()) {
129
+ that.play();
130
+ }
131
+ }
132
+
153
133
  that.trigger(name, data);
154
134
  });
155
135
 
@@ -158,14 +138,9 @@ const Api = function(container){
158
138
  //provider's preload() have to made Promise. Cuz it overcomes 'flash loading timing problem'.
159
139
  currentProvider.preload(playlistManager.getCurrentSources(), lastPlayPosition).then(function(){
160
140
 
161
- that.trigger(READY);
162
-
163
- lazyQueue.flush();
164
- //This is no reason to exist anymore.
165
- lazyQueue.destroy();
166
141
 
167
142
  }).catch((error) => {
168
- lazyQueue.off();
143
+
169
144
  if(error && error.code && ERRORS.codes[error.code]){
170
145
  that.trigger(ERROR, ERRORS.codes[error.code]);
171
146
  }else {
@@ -183,13 +158,6 @@ const Api = function(container){
183
158
  tempError.error = error;
184
159
  that.trigger(ERROR, tempError);
185
160
  }
186
-
187
- //xxx : If you init empty sources. (I think this is strange case.)
188
- //This works for this case.
189
- //player = OvenPlayer.create("elId", {});
190
- //player.load(soruces);
191
- lazyQueue.off();
192
- //lazyQueue.removeAndExcuteOnce("load");
193
161
  });
194
162
  };
195
163
 
@@ -200,11 +168,11 @@ const Api = function(container){
200
168
  * @returns
201
169
  **/
202
170
  that.init = (options) =>{
203
- //It collects the commands and executes them at the time when they are executable.
204
- lazyQueue = LazyCommandExecutor(that, [
205
- 'load','play','pause','seek','stop', 'getDuration', 'getPosition', 'getVolume'
206
- , 'getMute', 'getBuffer', 'getState' , 'getQualityLevels'
207
- ]);
171
+
172
+ if (!options) {
173
+ options = {};
174
+ }
175
+
208
176
  options.mediaContainer = container;
209
177
  options.browser = userAgentObject;
210
178
  playerConfig = Configurator(options, that);
@@ -220,6 +188,10 @@ const Api = function(container){
220
188
  OvenPlayerConsole.log("API : init() sources : " , playlistManager.getCurrentSources());
221
189
 
222
190
  initProvider();
191
+
192
+ setTimeout(function () {
193
+ that.trigger(READY);
194
+ });
223
195
  };
224
196
  that.getProviderName = () => {
225
197
  if(currentProvider){
@@ -304,9 +276,11 @@ const Api = function(container){
304
276
  };
305
277
  that.load = (playlist) => {
306
278
  OvenPlayerConsole.log("API : load() ", playlist);
307
- lazyQueue = LazyCommandExecutor(that, ['play','seek','stop']);
308
279
 
309
280
  if(playlist){
281
+
282
+ playerConfig.setSourceIndex(0);
283
+
310
284
  if(currentProvider){
311
285
  currentProvider.setCurrentQuality(0);
312
286
  }
@@ -327,8 +301,15 @@ const Api = function(container){
327
301
  that.play = () => {
328
302
  if(!currentProvider){return null;}
329
303
  OvenPlayerConsole.log("API : play() ");
330
- currentProvider.play();
331
- }
304
+
305
+ if (!currentProvider.metaLoaded() && !playerConfig.isAutoStart()) {
306
+ that.once(CONTENT_META, function () {
307
+ currentProvider.play();
308
+ });
309
+ } else {
310
+ currentProvider.play();
311
+ }
312
+ };
332
313
  that.pause = () => {
333
314
  if(!currentProvider){return null;}
334
315
 
@@ -385,23 +366,8 @@ const Api = function(container){
385
366
 
386
367
  OvenPlayerConsole.log("API : setCurrentSource() ", index);
387
368
 
388
- // let sources = currentProvider.getSources();
389
- // let currentSource = sources[currentProvider.getCurrentSource()];
390
- // let newSource = sources[index];
391
-
392
- // let isSameProvider = providerController.isSameProvider(currentSource, newSource);
393
- // // provider.serCurrentQuality -> playerConfig setting -> load
394
- // let resultSourceIndex = currentProvider.setCurrentSource(index, isSameProvider);
395
- //
396
- // if(!newSource){
397
- // return null;
398
- // }
399
- //
400
- // OvenPlayerConsole.log("API : setCurrentQuality() isSameProvider", isSameProvider);
401
-
402
369
  let lastPlayPosition = currentProvider.getPosition();
403
370
  playerConfig.setSourceIndex(index);
404
- lazyQueue = LazyCommandExecutor(that, ['play','seek']);
405
371
 
406
372
  initProvider(lastPlayPosition);
407
373
 
@@ -488,10 +454,6 @@ const Api = function(container){
488
454
 
489
455
  OvenPlayerConsole.log("API : remove() ");
490
456
 
491
- if (lazyQueue) {
492
- lazyQueue.destroy();
493
- }
494
-
495
457
  if(captionManager){
496
458
  captionManager.destroy();
497
459
  captionManager = null;
@@ -513,9 +475,8 @@ const Api = function(container){
513
475
  providerController = null;
514
476
  playlistManager = null;
515
477
  playerConfig = null;
516
- lazyQueue = null;
517
478
 
518
- OvenPlayerConsole.log("API : remove() - lazyQueue, currentProvider, providerController, playlistManager, playerConfig, api event destroed. ");
479
+ OvenPlayerConsole.log("API : remove() - currentProvider, providerController, playlistManager, playerConfig, api event destroed. ");
519
480
  OvenPlayerSDK.removePlayer(that.getContainerId());
520
481
  if(OvenPlayerSDK.getPlayerList().length === 0){
521
482
  OvenPlayerConsole.log("OvenPlayerSDK.playerList", OvenPlayerSDK.getPlayerList());
@@ -523,7 +484,7 @@ const Api = function(container){
523
484
  };
524
485
 
525
486
  that.getVersion = () => {
526
- return "v."+version;
487
+ return version;
527
488
  };
528
489
 
529
490
  return that;
@@ -203,7 +203,9 @@ const Configurator = function(options, provider){
203
203
  that.getRtmpBufferTimeMax = () => {
204
204
  return spec.rtmpBufferTimeMax;
205
205
  };
206
-
206
+ that.setMute = (mute) =>{
207
+ spec.mute = mute;
208
+ };
207
209
  that.isMute = () =>{
208
210
  return spec.mute;
209
211
  };
@@ -15,6 +15,7 @@ import {
15
15
  AD_CLIENT_GOOGLEIMA, AD_CLIENT_VAST,
16
16
  PLAYBACK_RATE_CHANGED, CONTENT_MUTE, PROVIDER_HTML5, PROVIDER_WEBRTC, PROVIDER_DASH, PROVIDER_HLS
17
17
  } from "api/constants";
18
+ import {CONTENT_META} from "../../constants";
18
19
 
19
20
  /**
20
21
  * @brief Core For Html5 Video.
@@ -75,6 +76,7 @@ const Provider = function (spec, playerConfig, onExtendedLoad){
75
76
  // sourceElement.src = source.file;
76
77
 
77
78
  const sourceChanged = (source.file !== previousSource);
79
+
78
80
  if (sourceChanged) {
79
81
 
80
82
  elVideo.src = source.file;
@@ -88,28 +90,13 @@ const Provider = function (spec, playerConfig, onExtendedLoad){
88
90
  elVideo.load();
89
91
  }
90
92
 
91
-
92
- if(lastPlayPosition && lastPlayPosition > 0){
93
- that.seek(lastPlayPosition);
94
- }
95
-
96
93
  }
97
94
 
98
- if(lastPlayPosition > 0){
99
- that.seek(lastPlayPosition);
100
- if(!playerConfig.isAutoStart()){
101
- // that.play();
95
+ that.on(CONTENT_META, function () {
96
+ if (lastPlayPosition > 0) {
97
+ that.seek(lastPlayPosition);
102
98
  }
103
-
104
- }
105
-
106
- if(playerConfig.isAutoStart()){
107
-
108
- // that.play();
109
- }
110
- /*that.trigger(CONTENT_SOURCE_CHANGED, {
111
- currentSource: spec.currentSource
112
- });*/
99
+ });
113
100
  }
114
101
 
115
102
  };
@@ -166,7 +153,6 @@ const Provider = function (spec, playerConfig, onExtendedLoad){
166
153
  //}
167
154
 
168
155
  OvenPlayerConsole.log("Provider : triggerSatatus", newState);
169
-
170
156
  switch (newState) {
171
157
  case STATE_COMPLETE :
172
158
  that.trigger(PLAYER_COMPLETE);
@@ -188,6 +174,7 @@ const Provider = function (spec, playerConfig, onExtendedLoad){
188
174
  prevState: spec.state,
189
175
  newstate: STATE_PLAYING
190
176
  });
177
+ break;
191
178
  case STATE_AD_PLAYING :
192
179
  that.trigger(PLAYER_PLAY, {
193
180
  prevState: spec.state,
@@ -231,12 +218,11 @@ const Provider = function (spec, playerConfig, onExtendedLoad){
231
218
  return false;
232
219
  }
233
220
  elVideo.volume = volume/100;
221
+ playerConfig.setVolume(volume);
234
222
  };
235
223
  that.getVolume = () =>{
236
- if(!elVideo){
237
- return 0;
238
- }
239
- return elVideo.volume*100;
224
+
225
+ return playerConfig.getVolume();
240
226
  };
241
227
  that.setMute = (state) =>{
242
228
  if(!elVideo){
@@ -244,27 +230,29 @@ const Provider = function (spec, playerConfig, onExtendedLoad){
244
230
  }
245
231
  if (typeof state === 'undefined') {
246
232
 
247
- elVideo.muted = !elVideo.muted;
233
+ const muted = playerConfig.isMute();
234
+
235
+ elVideo.muted = !muted;
236
+ playerConfig.setMute(!muted);
248
237
 
249
238
  that.trigger(CONTENT_MUTE, {
250
- mute: elVideo.muted
239
+ mute: playerConfig.isMute()
251
240
  });
252
241
 
253
242
  } else {
254
243
 
255
244
  elVideo.muted = state;
245
+ playerConfig.setMute(state);
256
246
 
257
247
  that.trigger(CONTENT_MUTE, {
258
- mute: elVideo.muted
248
+ mute: playerConfig.isMute()
259
249
  });
260
250
  }
261
251
  return elVideo.muted;
262
252
  };
263
253
  that.getMute = () =>{
264
- if(!elVideo){
265
- return false;
266
- }
267
- return elVideo.muted;
254
+
255
+ return playerConfig.isMute();
268
256
  };
269
257
 
270
258
  that.preload = (sources, lastPlayPosition) =>{
@@ -353,9 +341,7 @@ const Provider = function (spec, playerConfig, onExtendedLoad){
353
341
  OvenPlayerConsole.log("Provider : video play success (ie)");
354
342
  isPlayingProcessing = false;
355
343
  }
356
-
357
344
  }
358
-
359
345
  }
360
346
 
361
347
  };
@@ -40,44 +40,29 @@ const Dash = function (element, playerConfig, adTagUrl) {
40
40
  let prevLLLiveDuration = null;
41
41
  let loadRetryer = null;
42
42
  let sourceOfFile = "";
43
- let runedAutoStart = false;
44
43
 
45
44
  try {
46
45
 
47
- if (dashjs.Version < "2.6.5") {
46
+ if (dashjs.Version < "3.0.0") {
48
47
  throw ERRORS.codes[INIT_DASH_UNSUPPORT];
49
48
  }
50
49
 
51
50
  const coveredSetAutoSwitchQualityFor = function (isAuto) {
52
51
 
53
- if (dashjs.Version >= '3.0.0') {
54
- dash.updateSettings({
55
- streaming: {
56
- abr: {
57
- autoSwitchBitrate: {
58
- video: isAuto
59
- }
52
+ dash.updateSettings({
53
+ streaming: {
54
+ abr: {
55
+ autoSwitchBitrate: {
56
+ video: isAuto
60
57
  }
61
58
  }
62
- });
63
- } else if (dashjs.Version > "2.9.0") {
64
- dash.setAutoSwitchQualityFor("video", isAuto);
65
- } else {
66
- dash.setAutoSwitchQualityFor(isAuto);
67
- }
59
+ }
60
+ });
68
61
  };
69
62
 
70
63
  const coveredGetAutoSwitchQualityFor = function () {
71
- let result = "";
72
64
 
73
- if (dashjs.Version >= '3.0.0') {
74
- result = dash.getSettings().streaming.abr.autoSwitchBitrate.video;
75
- } else if (dashjs.Version > "2.9.0") {
76
- result = dash.getAutoSwitchQualityFor("video");
77
- } else {
78
- result = dash.getAutoSwitchQualityFor();
79
- }
80
- return result;
65
+ return dash.getSettings().streaming.abr.autoSwitchBitrate.video;
81
66
  };
82
67
 
83
68
  const liveDelayReducingCallback = function () {
@@ -125,127 +110,71 @@ const Dash = function (element, playerConfig, adTagUrl) {
125
110
 
126
111
  OvenPlayerConsole.log("DASH : Attach File : ", source, "lastPlayPosition : " + lastPlayPosition);
127
112
 
128
- that.trigger(DASH_PREPARED, dash);
129
-
130
113
  coveredSetAutoSwitchQualityFor(true);
131
114
  sourceOfFile = source.file;
132
115
 
133
- dash.off(dashjs.MediaPlayer.events.PLAYBACK_PLAYING, liveDelayReducingCallback);
116
+ // dash.off(dashjs.MediaPlayer.events.PLAYBACK_PLAYING, liveDelayReducingCallback);
134
117
 
135
118
  if (source.lowLatency === true) {
136
119
 
137
120
  prevLLLiveDuration = null;
138
121
 
139
- if (dashjs.Version >= '3.0.0') {
140
-
141
- dash.updateSettings({
142
- streaming: {
143
- lowLatencyEnabled: source.lowLatency
144
- }
145
- });
146
-
147
- } else {
148
-
149
- dash.setLowLatencyEnabled(source.lowLatency);
150
- }
151
-
152
- if (playerConfig.getConfig().lowLatencyMpdLiveDelay && typeof(playerConfig.getConfig().lowLatencyMpdLiveDelay) === 'number') {
153
-
154
- if (dashjs.Version >= '3.0.0') {
155
-
156
- dash.updateSettings({
157
- streaming: {
158
- liveDelay: playerConfig.getConfig().lowLatencyMpdLiveDelay
159
- }
160
- });
161
- } else {
162
- dash.setLiveDelay(playerConfig.getConfig().lowLatencyMpdLiveDelay);
122
+ dash.updateSettings({
123
+ streaming: {
124
+ lowLatencyEnabled: source.lowLatency
163
125
  }
164
- }
165
-
166
- dash.on(dashjs.MediaPlayer.events.PLAYBACK_PLAYING, liveDelayReducingCallback);
167
-
168
- } else {
126
+ });
169
127
 
170
- if (dashjs.Version >= '3.0.0') {
128
+ if (playerConfig.getConfig().lowLatencyMpdLiveDelay && typeof(playerConfig.getConfig().lowLatencyMpdLiveDelay) === 'number') {
171
129
 
172
130
  dash.updateSettings({
173
131
  streaming: {
174
- lowLatencyEnabled: false,
175
- liveDelay: undefined
132
+ liveDelay: playerConfig.getConfig().lowLatencyMpdLiveDelay
176
133
  }
177
134
  });
178
-
179
- } else {
180
-
181
- dash.setLowLatencyEnabled(false);
182
- dash.setLiveDelay();
183
135
  }
184
136
 
185
- }
137
+ // dash.on(dashjs.MediaPlayer.events.PLAYBACK_PLAYING, liveDelayReducingCallback);
186
138
 
187
- if (dashjs.Version >= '3.0.0') {
139
+ } else {
188
140
 
189
141
  dash.updateSettings({
190
- debug: {
191
- logLevel: dashjs.Debug.LOG_LEVEL_NONE
192
- },
193
142
  streaming: {
194
- retryAttempts: {
195
- MPD: 0
196
- }
143
+ lowLatencyEnabled: false,
144
+ liveDelay: undefined
197
145
  }
198
146
  });
199
147
 
200
- } else {
148
+ }
201
149
 
202
- dash.getDebug().setLogToBrowserConsole(false);
150
+ dash.updateSettings({
151
+ debug: {
152
+ logLevel: dashjs.Debug.LOG_LEVEL_NONE
153
+ }
154
+ });
155
+
156
+ let dashConfigFromPlayerConfig = playerConfig.getConfig().dashConfig;
157
+
158
+ if (dashConfigFromPlayerConfig) {
159
+ dash.updateSettings(dashConfigFromPlayerConfig);
203
160
  }
204
161
 
162
+ that.trigger(DASH_PREPARED, dash);
163
+
205
164
  dash.attachSource(sourceOfFile);
206
165
 
207
166
  seekPosition_sec = lastPlayPosition;
208
-
209
167
  });
210
168
 
211
169
  superPlay_func = that.super('play');
212
170
  superDestroy_func = that.super('destroy');
213
171
  OvenPlayerConsole.log("DASH PROVIDER LOADED.");
214
172
 
215
- let loadingRetryCount = playerConfig.getConfig().loadingRetryCount;
216
-
217
173
  dash.on(dashjs.MediaPlayer.events.ERROR, function (error) {
218
174
 
219
- // Handle mpd load error.
220
- if (error &&
221
- (
222
- error.error.code === dashjs.MediaPlayer.errors.DOWNLOAD_ERROR_ID_MANIFEST_CODE ||
223
- error.error.code === dashjs.MediaPlayer.errors.MANIFEST_LOADER_LOADING_FAILURE_ERROR_CODE
224
- )) {
225
-
226
- if (loadingRetryCount > 0) {
227
-
228
- that.setState(STATE_LOADING);
229
-
230
- if (loadRetryer) {
231
- clearTimeout(loadRetryer);
232
- loadRetryer = null;
233
- }
234
-
235
- loadingRetryCount = loadingRetryCount - 1;
236
-
237
- loadRetryer = setTimeout(function () {
238
-
239
-
240
- dash.attachSource(sourceOfFile);
241
- }, 1000);
242
- } else {
243
-
244
- let tempError = ERRORS.codes[PLAYER_UNKNWON_NETWORK_ERROR];
245
- tempError.error = error;
246
- errorTrigger(tempError, that);
247
- }
248
- }
175
+ let tempError = ERRORS.codes[PLAYER_UNKNWON_NETWORK_ERROR];
176
+ tempError.error = error;
177
+ errorTrigger(tempError, that);
249
178
  });
250
179
 
251
180
  dash.on(dashjs.MediaPlayer.events.QUALITY_CHANGE_REQUESTED, function (event) {
@@ -294,12 +223,6 @@ const Dash = function (element, playerConfig, adTagUrl) {
294
223
  dash.seek(seekPosition_sec);
295
224
  }
296
225
 
297
- if (playerConfig.isAutoStart() && !runedAutoStart) {
298
- OvenPlayerConsole.log("DASH : AUTOPLAY()!");
299
- that.play();
300
- runedAutoStart = true;
301
- }
302
-
303
226
  });
304
227
 
305
228
  that.play = (mutedPlay) => {