bigscreen-player 10.16.0 → 10.17.1

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 { U as Utils, a as DebugTool, P as Plugins, D as DOMHelpers } from './main-bfedf7e6.js';
2
+ import { U as Utils, a as DebugTool, P as Plugins, D as DOMHelpers } from './main-052c3a5e.js';
3
3
  import 'tslib';
4
4
 
5
5
  function EmbeddedSubtitles(mediaPlayer, parentElement, { autoStart = false, defaultStyleOpts = {} } = {}) {
@@ -1,5 +1,5 @@
1
1
  import { fromXML, generateISD, renderHTML } from 'smp-imsc';
2
- import { f as findSegmentTemplate, L as LoadUrl, a as DebugTool, P as Plugins, U as Utils, D as DOMHelpers } from './main-bfedf7e6.js';
2
+ import { f as findSegmentTemplate, L as LoadUrl, a as DebugTool, P as Plugins, U as Utils, D as DOMHelpers } from './main-052c3a5e.js';
3
3
  import 'tslib';
4
4
 
5
5
  const SEGMENTS_BUFFER_SIZE = 3;
@@ -1,4 +1,4 @@
1
- import { D as DOMHelpers, a as DebugTool, P as Plugins, L as LoadUrl, T as TransportControlPosition } from './main-bfedf7e6.js';
1
+ import { D as DOMHelpers, a as DebugTool, P as Plugins, L as LoadUrl, T as TransportControlPosition } from './main-052c3a5e.js';
2
2
  import 'tslib';
3
3
 
4
4
  /**
@@ -5710,7 +5710,7 @@ BasicStrategy.getLiveSupport = () => LiveSupport.SEEKABLE;
5710
5710
  function StrategyPicker() {
5711
5711
  return new Promise((resolve, reject) => {
5712
5712
  if (window.bigscreenPlayer.playbackStrategy === PlaybackStrategy.MSE) {
5713
- return import('./msestrategy-b3da415e.js')
5713
+ return import('./msestrategy-3f18d6e3.js')
5714
5714
  .then(({ default: MSEStrategy }) => resolve(MSEStrategy))
5715
5715
  .catch((reason) => {
5716
5716
  const error = new Error(isError(reason) ? reason.message : undefined);
@@ -5967,6 +5967,7 @@ function CallCallbacks(callbacks, data) {
5967
5967
  }
5968
5968
 
5969
5969
  let plugins = [];
5970
+ const pluginContext = {};
5970
5971
 
5971
5972
  function callOnAllPlugins(funcKey, evt) {
5972
5973
  const clonedEvent = Utils.deepClone(evt);
@@ -5978,8 +5979,37 @@ function callOnAllPlugins(funcKey, evt) {
5978
5979
  }
5979
5980
 
5980
5981
  var Plugins = {
5982
+ /**
5983
+ * @param {function (*): *} updater - a function which accepts the current context, and returns a new context
5984
+ */
5985
+ updateContext: (updater) => {
5986
+ const newContext = updater(Utils.deepClone(pluginContext));
5987
+
5988
+ if (typeof newContext !== "object") {
5989
+ throw new TypeError("context must be an object")
5990
+ }
5991
+
5992
+ // update object (preserving reference)
5993
+ for (const prop of Object.keys(pluginContext)) {
5994
+ delete pluginContext[prop];
5995
+ }
5996
+
5997
+ Object.assign(pluginContext, newContext);
5998
+
5999
+ // call context update handlers
6000
+ for (const plugin of plugins) {
6001
+ plugin.onContextUpdated?.(pluginContext);
6002
+ }
6003
+ },
6004
+
6005
+ /**
6006
+ * @param {*} plugin - an object
6007
+ */
5981
6008
  registerPlugin: (plugin) => {
5982
6009
  plugins.push(plugin);
6010
+
6011
+ // provide initial context
6012
+ plugin.onContextUpdated?.(pluginContext);
5983
6013
  },
5984
6014
 
5985
6015
  unregisterPlugin: (plugin) => {
@@ -6349,6 +6379,9 @@ function PlayerComponent(
6349
6379
  });
6350
6380
  }
6351
6381
 
6382
+ // Not an ideal place for this, but I've been warned of a possible playercomponent rewrite
6383
+ Plugins.updateContext((context) => ({ ...context, attemptCdnFailover }));
6384
+
6352
6385
  function clearFatalErrorTimeout() {
6353
6386
  if (fatalErrorTimeout !== null) {
6354
6387
  clearTimeout(fatalErrorTimeout);
@@ -6511,7 +6544,7 @@ const PauseTriggers = {
6511
6544
  DEVICE: 3,
6512
6545
  };
6513
6546
 
6514
- var Version = "10.16.0";
6547
+ var Version = "10.17.1";
6515
6548
 
6516
6549
  /* eslint-disable no-use-before-define */
6517
6550
 
@@ -7703,7 +7736,7 @@ function Subtitles(
7703
7736
 
7704
7737
  if (available()) {
7705
7738
  if (useLegacySubs) {
7706
- import('./legacysubtitles-cd82cb3e.js')
7739
+ import('./legacysubtitles-df3bbfee.js')
7707
7740
  .then(({ default: LegacySubtitles }) => {
7708
7741
  subtitlesContainer = LegacySubtitles(mediaPlayer, playbackElement, mediaSources, {
7709
7742
  alwaysOnTop,
@@ -7717,7 +7750,7 @@ function Subtitles(
7717
7750
  Plugins.interface.onSubtitlesDynamicLoadError();
7718
7751
  });
7719
7752
  } else if (embeddedSubs) {
7720
- import('./embeddedsubtitles-e981440e.js')
7753
+ import('./embeddedsubtitles-f2fc7a37.js')
7721
7754
  .then(({ default: EmbeddedSubtitles }) => {
7722
7755
  subtitlesContainer = EmbeddedSubtitles(mediaPlayer, playbackElement, {
7723
7756
  autoStart,
@@ -7730,7 +7763,7 @@ function Subtitles(
7730
7763
  Plugins.interface.onSubtitlesDynamicLoadError();
7731
7764
  });
7732
7765
  } else {
7733
- import('./imscsubtitles-70f433df.js')
7766
+ import('./imscsubtitles-dbc289bc.js')
7734
7767
  .then(({ default: IMSCSubtitles }) => {
7735
7768
  subtitlesContainer = IMSCSubtitles(mediaPlayer, playbackElement, mediaSources, {
7736
7769
  alwaysOnTop,
@@ -7817,6 +7850,16 @@ function Subtitles(
7817
7850
  subtitlesContainer?.tearDown();
7818
7851
  }
7819
7852
 
7853
+ function attemptSubtitleCdnFailover(opts) {
7854
+ hide();
7855
+ mediaSources
7856
+ .failoverSubtitles(opts)
7857
+ .then(() => show())
7858
+ .catch(() => DebugTool.info("No more CDNs available for subtitle failover"));
7859
+ }
7860
+
7861
+ Plugins.updateContext((context) => ({ ...context, attemptSubtitleCdnFailover }));
7862
+
7820
7863
  return {
7821
7864
  enable,
7822
7865
  disable,
@@ -8144,6 +8187,8 @@ function BigscreenPlayer() {
8144
8187
  callbacks.onError(reason);
8145
8188
  }
8146
8189
  });
8190
+
8191
+ Plugins.updateContext((context) => ({ ...context, mediaSources }));
8147
8192
  },
8148
8193
 
8149
8194
  /**
@@ -8574,7 +8619,7 @@ function BigscreenPlayer() {
8574
8619
  },
8575
8620
 
8576
8621
  /**
8577
- * Register a plugin for extended events.
8622
+ * Register a plugin for extended events & custom functionality.
8578
8623
  * @function
8579
8624
  * @param {*} plugin
8580
8625
  */
@@ -262,7 +262,7 @@ declare function BigscreenPlayer(): {
262
262
  */
263
263
  mockJasmine(opts: any): void;
264
264
  /**
265
- * Register a plugin for extended events.
265
+ * Register a plugin for extended events & custom functionality.
266
266
  * @function
267
267
  * @param {*} plugin
268
268
  */
package/dist/esm/main.js CHANGED
@@ -1,2 +1,2 @@
1
- export { B as BigscreenPlayer, a as DebugTool, E as EntryCategory, b as LiveSupport, c as ManifestType, M as MediaKinds, d as MediaState, g as MockBigscreenPlayer, h as PauseTriggers, i as PlaybackStrategy, k as Timeline, j as TransferFormat, T as TransportControlPosition, W as WindowTypes, l as isMessage, m as isMetric, n as isTrace } from './main-bfedf7e6.js';
1
+ export { B as BigscreenPlayer, a as DebugTool, E as EntryCategory, b as LiveSupport, c as ManifestType, M as MediaKinds, d as MediaState, g as MockBigscreenPlayer, h as PauseTriggers, i as PlaybackStrategy, k as Timeline, j as TransferFormat, T as TransportControlPosition, W as WindowTypes, l as isMessage, m as isMetric, n as isTrace } from './main-052c3a5e.js';
2
2
  import 'tslib';
@@ -1,5 +1,5 @@
1
1
  import { MediaPlayer } from 'dashjs/index';
2
- import { U as Utils, M as MediaKinds, b as LiveSupport, a as DebugTool, c as ManifestType, P as Plugins, d as MediaState, e as autoResumeAtStartOfRange, D as DOMHelpers } from './main-bfedf7e6.js';
2
+ import { U as Utils, M as MediaKinds, b as LiveSupport, a as DebugTool, c as ManifestType, P as Plugins, d as MediaState, e as autoResumeAtStartOfRange, D as DOMHelpers } from './main-052c3a5e.js';
3
3
  import 'tslib';
4
4
 
5
5
  function filter(manifest, representationOptions) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bigscreen-player",
3
- "version": "10.16.0",
3
+ "version": "10.17.1",
4
4
  "type": "module",
5
5
  "description": "Simplified media playback for bigscreen devices.",
6
6
  "main": "dist/esm/main.js",