bigscreen-player 5.5.0 → 5.5.3

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.
@@ -1,5 +1,5 @@
1
1
  import { fromXML, generateISD, renderHTML } from 'smp-imsc';
2
- import { b as TimeUtils, L as LoadUrl, a as DebugTool, P as Plugins, U as Utils, D as DOMHelpers } from './main-f63b6e0d.js';
2
+ import { b as TimeUtils, L as LoadUrl, a as DebugTool, P as Plugins, U as Utils, D as DOMHelpers } from './main-bf9fddfc.js';
3
3
 
4
4
  function IMSCSubtitles (mediaPlayer, autoStart, parentElement, mediaSources, defaultStyleOpts) {
5
5
  const SEGMENTS_TO_KEEP = 3;
@@ -76,9 +76,9 @@ function IMSCSubtitles (mediaPlayer, autoStart, parentElement, mediaSources, def
76
76
  stop();
77
77
  }
78
78
  },
79
- onError: (statusCode) => {
79
+ onError: ({statusCode, ...rest} = {}) => {
80
80
  DebugTool.info('Error loading subtitles data: ' + statusCode);
81
- loadErrorFailover(statusCode);
81
+ loadErrorFailover({statusCode, ...rest});
82
82
  },
83
83
  onTimeout: () => {
84
84
  DebugTool.info('Request timeout loading subtitles');
@@ -100,13 +100,13 @@ function IMSCSubtitles (mediaPlayer, autoStart, parentElement, mediaSources, def
100
100
  }
101
101
  }
102
102
 
103
- function loadErrorFailover (statusCode) {
103
+ function loadErrorFailover (opts) {
104
104
  const errorCase = () => { DebugTool.info('No more CDNs available for subtitle failover'); };
105
105
 
106
106
  if ((liveSubtitles && loadErrorLimit()) || !liveSubtitles) {
107
107
  stop();
108
108
  segments = [];
109
- mediaSources.failoverSubtitles(start, errorCase, statusCode);
109
+ mediaSources.failoverSubtitles(start, errorCase, opts);
110
110
  }
111
111
  }
112
112
 
@@ -1,4 +1,4 @@
1
- import { D as DOMHelpers, a as DebugTool, P as Plugins, L as LoadUrl, T as TransportControlPosition } from './main-f63b6e0d.js';
1
+ import { D as DOMHelpers, a as DebugTool, P as Plugins, L as LoadUrl, T as TransportControlPosition } from './main-bf9fddfc.js';
2
2
 
3
3
  /**
4
4
  * Safely checks if an attribute exists on an element.
@@ -364,10 +364,10 @@ function LegacySubtitles (mediaPlayer, autoStart, parentElement, mediaSources) {
364
364
  createContainer(responseXML);
365
365
  }
366
366
  },
367
- onError: (statusCode) => {
367
+ onError: ({statusCode, ...rest} = {}) => {
368
368
  const errorCase = () => { DebugTool.info('Failed to load from subtitles file from all available CDNs'); };
369
369
  DebugTool.info('Error loading subtitles data: ' + statusCode);
370
- mediaSources.failoverSubtitles(loadSubtitles, errorCase, statusCode);
370
+ mediaSources.failoverSubtitles(loadSubtitles, errorCase, {statusCode, ...rest});
371
371
  },
372
372
  onTimeout: () => {
373
373
  DebugTool.info('Request timeout loading subtitles');
@@ -34,8 +34,8 @@ function PluginData (args) {
34
34
  this.isInitialPlay = args.isInitialPlay;
35
35
  this.cdn = args.cdn;
36
36
  this.newCdn = args.newCdn;
37
- this.timeStamp = new Date(),
38
- this.code = args.code,
37
+ this.timeStamp = new Date();
38
+ this.code = args.code;
39
39
  this.message = args.message;
40
40
  }
41
41
 
@@ -2420,7 +2420,7 @@ function Html5 () {
2420
2420
  }
2421
2421
 
2422
2422
  function onError () {
2423
- reportError('Media element error code: ' + mediaElement.error.code, {code: mediaElement.error.code, message: mediaElement.error.message });
2423
+ reportError('Media element error code: ' + mediaElement.error.code, { code: mediaElement.error.code, message: mediaElement.error.message });
2424
2424
  }
2425
2425
 
2426
2426
  function onSourceError () {
@@ -5454,7 +5454,7 @@ function BasicStrategy (mediaSources, windowType, mediaKind, playbackElement, is
5454
5454
  }
5455
5455
  }
5456
5456
 
5457
- function publishError(mediaError) {
5457
+ function publishError (mediaError) {
5458
5458
  if (errorCallback) {
5459
5459
  errorCallback(mediaError);
5460
5460
  }
@@ -5730,12 +5730,12 @@ function StrategyPicker (windowType, isUHD) {
5730
5730
  return resolve(NativeStrategy)
5731
5731
  }
5732
5732
 
5733
- return import('./msestrategy-d0305f42.js').then(({default: MSEStrategy}) => resolve(MSEStrategy))
5733
+ return import('./msestrategy-f8f8e9fc.js').then(({default: MSEStrategy}) => resolve(MSEStrategy))
5734
5734
  .catch(() => {
5735
5735
  reject({error: 'strategyDynamicLoadError'});
5736
5736
  })
5737
5737
  } else if (window.bigscreenPlayer.playbackStrategy === PlaybackStrategy.MSE) {
5738
- return import('./msestrategy-d0305f42.js').then(({default: MSEStrategy}) => resolve(MSEStrategy))
5738
+ return import('./msestrategy-f8f8e9fc.js').then(({default: MSEStrategy}) => resolve(MSEStrategy))
5739
5739
  .catch(() => {
5740
5740
  reject({error: 'strategyDynamicLoadError'});
5741
5741
  })
@@ -6045,10 +6045,10 @@ function PlayerComponent (playbackElement, bigscreenPlayerData, mediaSources, wi
6045
6045
  duration: getDuration()
6046
6046
  },
6047
6047
  timeUpdate: opts && opts.timeUpdate,
6048
- isBufferingTimeoutError: (opts && opts.isBufferingTimeoutError || false),
6048
+ isBufferingTimeoutError: (opts && opts.isBufferingTimeoutError || false)
6049
6049
  };
6050
6050
 
6051
- if(opts && opts.code > -1 && opts.message ) {
6051
+ if (opts && opts.code > -1 && opts.message) {
6052
6052
  stateUpdateData.code = opts.code;
6053
6053
  stateUpdateData.message = opts.message;
6054
6054
  }
@@ -6127,7 +6127,7 @@ function CallCallbacks (callbacks, data) {
6127
6127
  callbacks.forEach((callback) => DeferExceptions(() => callback(data)));
6128
6128
  }
6129
6129
 
6130
- var version = "5.5.0";
6130
+ var version = "5.5.3";
6131
6131
 
6132
6132
  var sourceList;
6133
6133
  var source;
@@ -6740,7 +6740,7 @@ function LoadUrl (url, opts) {
6740
6740
  }
6741
6741
  } else {
6742
6742
  if (opts.onError) {
6743
- opts.onError(xhr.status);
6743
+ opts.onError({errorType: 'NON_200_ERROR', statusCode: xhr.status});
6744
6744
  }
6745
6745
  }
6746
6746
  }
@@ -6757,9 +6757,9 @@ function LoadUrl (url, opts) {
6757
6757
  }
6758
6758
  }
6759
6759
  xhr.send(opts.data || null);
6760
- } catch (ex) {
6760
+ } catch ({ name }) {
6761
6761
  if (opts.onError) {
6762
- opts.onError(xhr.status);
6762
+ opts.onError({errorType: name, statusCode: xhr.status});
6763
6763
  }
6764
6764
  }
6765
6765
  }
@@ -6938,14 +6938,14 @@ function MediaSources () {
6938
6938
  }
6939
6939
  }
6940
6940
 
6941
- function failoverSubtitles (postFailoverAction, failoverErrorAction, statusCode) {
6941
+ function failoverSubtitles (postFailoverAction, failoverErrorAction, {statusCode, ...rest} = {}) {
6942
6942
  if (subtitlesSources.length > 1) {
6943
- Plugins.interface.onSubtitlesLoadError({status: statusCode, severity: PluginEnums.STATUS.FAILOVER, cdn: getCurrentSubtitlesCdn()});
6943
+ Plugins.interface.onSubtitlesLoadError({status: statusCode, severity: PluginEnums.STATUS.FAILOVER, cdn: getCurrentSubtitlesCdn(), subtitlesSources: subtitlesSources.length, ...rest});
6944
6944
  subtitlesSources.shift();
6945
6945
  updateDebugOutput();
6946
6946
  if (postFailoverAction) { postFailoverAction(); }
6947
6947
  } else {
6948
- Plugins.interface.onSubtitlesLoadError({status: statusCode, severity: PluginEnums.STATUS.FATAL, cdn: getCurrentSubtitlesCdn()});
6948
+ Plugins.interface.onSubtitlesLoadError({status: statusCode, severity: PluginEnums.STATUS.FATAL, cdn: getCurrentSubtitlesCdn(), subtitlesSources: subtitlesSources.length, ...rest});
6949
6949
  if (failoverErrorAction) { failoverErrorAction(); }
6950
6950
  }
6951
6951
  }
@@ -7028,7 +7028,7 @@ function MediaSources () {
7028
7028
  };
7029
7029
 
7030
7030
  const onManifestLoadError = () => {
7031
- failover(load, failoverError, {isBufferingTimeoutError: false, code: PluginEnums.ERROR_CODES.MANIFEST, message: PluginEnums.ERROR_MESSAGES.MANIFEST });
7031
+ failover(load, failoverError, { isBufferingTimeoutError: false, code: PluginEnums.ERROR_CODES.MANIFEST, message: PluginEnums.ERROR_MESSAGES.MANIFEST });
7032
7032
  };
7033
7033
 
7034
7034
  function load () {
@@ -7307,14 +7307,14 @@ function Subtitles (mediaPlayer, autoStart, playbackElement, defaultStyleOpts, m
7307
7307
  let subtitlesContainer;
7308
7308
 
7309
7309
  if (useLegacySubs) {
7310
- import('./legacysubtitles-9cf8b751.js').then(({default: LegacySubtitles}) => {
7310
+ import('./legacysubtitles-03f02149.js').then(({default: LegacySubtitles}) => {
7311
7311
  subtitlesContainer = LegacySubtitles(mediaPlayer, autoStart, playbackElement, mediaSources, defaultStyleOpts);
7312
7312
  callback(subtitlesEnabled);
7313
7313
  }).catch(() => {
7314
7314
  Plugins.interface.onSubtitlesDynamicLoadError();
7315
7315
  });
7316
7316
  } else {
7317
- import('./imscsubtitles-26f24b02.js').then(({default: IMSCSubtitles}) => {
7317
+ import('./imscsubtitles-7c1dc134.js').then(({default: IMSCSubtitles}) => {
7318
7318
  subtitlesContainer = IMSCSubtitles(mediaPlayer, autoStart, playbackElement, mediaSources, defaultStyleOpts);
7319
7319
  callback(subtitlesEnabled);
7320
7320
  }).catch(() => {
package/dist/esm/main.js CHANGED
@@ -1 +1 @@
1
- export { B as BigscreenPlayer, c as LiveSupport, d as MediaKinds, M as MediaState, f as MockBigscreenPlayer, g as PauseTriggers, h as PlaybackStrategy, i as TransferFormat, T as TransportControlPosition, W as WindowTypes } from './main-f63b6e0d.js';
1
+ export { B as BigscreenPlayer, c as LiveSupport, d as MediaKinds, M as MediaState, f as MockBigscreenPlayer, g as PauseTriggers, h as PlaybackStrategy, i as TransferFormat, T as TransportControlPosition, W as WindowTypes } from './main-bf9fddfc.js';
@@ -1,4 +1,4 @@
1
- import { D as DOMHelpers, W as WindowTypes, c as LiveSupport, M as MediaState, a as DebugTool, P as Plugins, d as MediaKinds, U as Utils, b as TimeUtils, e as DynamicWindowUtils } from './main-f63b6e0d.js';
1
+ import { U as Utils, D as DOMHelpers, W as WindowTypes, c as LiveSupport, M as MediaState, a as DebugTool, P as Plugins, d as MediaKinds, b as TimeUtils, e as DynamicWindowUtils } from './main-bf9fddfc.js';
2
2
  import { MediaPlayer } from 'dashjs/index_mediaplayerOnly';
3
3
 
4
4
  function filter (manifest, representationOptions) {
@@ -111,8 +111,6 @@ var ManifestModifier = {
111
111
  };
112
112
 
113
113
  function MSEStrategy (mediaSources, windowType, mediaKind, playbackElement, isUHD, customPlayerSettings) {
114
- const LIVE_DELAY_SECONDS = 1.1;
115
-
116
114
  let mediaPlayer;
117
115
  let mediaElement;
118
116
 
@@ -141,6 +139,18 @@ function MSEStrategy (mediaSources, windowType, mediaKind, playbackElement, isUH
141
139
  }
142
140
  };
143
141
 
142
+ let playerSettings = Utils.merge({
143
+ debug: {
144
+ logLevel: 2
145
+ },
146
+ streaming: {
147
+ liveDelay: 1.1,
148
+ bufferToKeep: 4,
149
+ bufferTimeAtTopQuality: 12,
150
+ bufferTimeAtTopQualityLongForm: 15
151
+ }
152
+ }, customPlayerSettings);
153
+
144
154
  const DashJSEvents = {
145
155
  LOG: 'log',
146
156
  ERROR: 'error',
@@ -235,7 +245,7 @@ function MSEStrategy (mediaSources, windowType, mediaKind, playbackElement, isUH
235
245
  }
236
246
 
237
247
  // It is possible audio could play back even if the video codec is not supported. Resetting here prevents this.
238
- if(event.error.code === DashJSEvents.UNSUPPORTED_CODEC) {
248
+ if (event.error.code === DashJSEvents.UNSUPPORTED_CODEC) {
239
249
  mediaPlayer.reset();
240
250
  }
241
251
  }
@@ -360,7 +370,6 @@ function MSEStrategy (mediaSources, windowType, mediaKind, playbackElement, isUH
360
370
 
361
371
  failoverInfo.serviceLocation = event.baseUrl.serviceLocation;
362
372
  mediaSources.failover(log, log, failoverInfo);
363
-
364
373
  }
365
374
 
366
375
  function onServiceLocationAvailable (event) {
@@ -425,7 +434,7 @@ function MSEStrategy (mediaSources, windowType, mediaKind, playbackElement, isUH
425
434
  }
426
435
 
427
436
  function getClampedTime (time, range) {
428
- return Math.min(Math.max(time, range.start), range.end - LIVE_DELAY_SECONDS)
437
+ return Math.min(Math.max(time, range.start), range.end - playerSettings.streaming.liveDelay)
429
438
  }
430
439
 
431
440
  function load (mimeType, playbackTime) {
@@ -455,17 +464,6 @@ function MSEStrategy (mediaSources, windowType, mediaKind, playbackElement, isUH
455
464
 
456
465
  function setUpMediaPlayer (playbackTime) {
457
466
  mediaPlayer = MediaPlayer().create();
458
- const playerSettings = Utils.merge({
459
- debug: {
460
- logLevel: 2
461
- },
462
- streaming: {
463
- liveDelay: LIVE_DELAY_SECONDS,
464
- bufferToKeep: 4,
465
- bufferTimeAtTopQuality: 12,
466
- bufferTimeAtTopQualityLongForm: 15
467
- }
468
- }, customPlayerSettings);
469
467
  mediaPlayer.updateSettings(playerSettings);
470
468
  mediaPlayer.initialize(mediaElement, null, true);
471
469
  modifySource(playbackTime);
@@ -527,7 +525,7 @@ function MSEStrategy (mediaSources, windowType, mediaKind, playbackElement, isUH
527
525
  if (dvrInfo) {
528
526
  return {
529
527
  start: dvrInfo.range.start - timeCorrection,
530
- end: dvrInfo.range.end - timeCorrection
528
+ end: dvrInfo.range.end - timeCorrection - playerSettings.streaming.liveDelay
531
529
  }
532
530
  }
533
531
  }
@@ -562,7 +560,7 @@ function MSEStrategy (mediaSources, windowType, mediaKind, playbackElement, isUH
562
560
 
563
561
  function calculateSeekOffset (time) {
564
562
  function getClampedTimeForLive (time) {
565
- return Math.min(Math.max(time, 0), mediaPlayer.getDVRWindowSize() - LIVE_DELAY_SECONDS)
563
+ return Math.min(Math.max(time, 0), mediaPlayer.getDVRWindowSize() - playerSettings.streaming.liveDelay)
566
564
  }
567
565
 
568
566
  if (windowType === WindowTypes.SLIDING) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bigscreen-player",
3
- "version": "5.5.0",
3
+ "version": "5.5.3",
4
4
  "description": "Simplified media playback for bigscreen devices.",
5
5
  "main": "dist/esm/main.js",
6
6
  "browser": "dist/esm/main.js",