bigscreen-player 8.9.1 → 8.10.0

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 { f as findSegmentTemplate, L as LoadUrl, a as DebugToolInstance, P as Plugins, U as Utils, D as DOMHelpers } from './main-7b498fab.js';
2
+ import { f as findSegmentTemplate, L as LoadUrl, a as DebugToolInstance, P as Plugins, U as Utils, D as DOMHelpers } from './main-2e77173d.js';
3
3
 
4
4
  const SEGMENTS_BUFFER_SIZE = 3;
5
5
  const LOAD_ERROR_COUNT_MAX = 3;
@@ -1,4 +1,4 @@
1
- import { D as DOMHelpers, a as DebugToolInstance, P as Plugins, L as LoadUrl, T as TransportControlPosition } from './main-7b498fab.js';
1
+ import { D as DOMHelpers, a as DebugToolInstance, P as Plugins, L as LoadUrl, T as TransportControlPosition } from './main-2e77173d.js';
2
2
 
3
3
  /**
4
4
  * Safely checks if an attribute exists on an element.
@@ -5961,7 +5961,7 @@ BasicStrategy.getLiveSupport = () => LiveSupport.SEEKABLE;
5961
5961
  function StrategyPicker() {
5962
5962
  return new Promise((resolve, reject) => {
5963
5963
  if (window.bigscreenPlayer.playbackStrategy === PlaybackStrategy.MSE) {
5964
- return import('./msestrategy-4bf7955f.js')
5964
+ return import('./msestrategy-0d12e398.js')
5965
5965
  .then(({ default: MSEStrategy }) => resolve(MSEStrategy))
5966
5966
  .catch(() => {
5967
5967
  reject({ error: "strategyDynamicLoadError" });
@@ -5979,7 +5979,8 @@ function PlayerComponent(
5979
5979
  mediaSources,
5980
5980
  windowType,
5981
5981
  stateUpdateCallback,
5982
- errorCallback
5982
+ errorCallback,
5983
+ callBroadcastMixADCallbacks
5983
5984
  ) {
5984
5985
  const transferFormat = bigscreenPlayerData.media.transferFormat;
5985
5986
 
@@ -6003,7 +6004,9 @@ function PlayerComponent(
6003
6004
  mediaKind,
6004
6005
  playbackElement,
6005
6006
  bigscreenPlayerData.media.isUHD,
6006
- bigscreenPlayerData.media.playerSettings
6007
+ bigscreenPlayerData.media.playerSettings,
6008
+ bigscreenPlayerData.enableBroadcastMixAD,
6009
+ callBroadcastMixADCallbacks
6007
6010
  );
6008
6011
 
6009
6012
  playbackStrategy.addEventCallback(this, eventCallback);
@@ -6064,6 +6067,22 @@ function PlayerComponent(
6064
6067
  return playbackStrategy && playbackStrategy.getSeekableRange()
6065
6068
  }
6066
6069
 
6070
+ function isBroadcastMixADAvailable() {
6071
+ return playbackStrategy && playbackStrategy.isBroadcastMixADAvailable?.()
6072
+ }
6073
+
6074
+ function isBroadcastMixADEnabled() {
6075
+ return playbackStrategy && playbackStrategy.isBroadcastMixADEnabled?.()
6076
+ }
6077
+
6078
+ function setBroadcastMixADOn() {
6079
+ playbackStrategy && playbackStrategy.setBroadcastMixADOn?.();
6080
+ }
6081
+
6082
+ function setBroadcastMixADOff() {
6083
+ playbackStrategy && playbackStrategy.setBroadcastMixADOff?.();
6084
+ }
6085
+
6067
6086
  function isPaused() {
6068
6087
  return playbackStrategy && playbackStrategy.isPaused()
6069
6088
  }
@@ -6369,6 +6388,10 @@ function PlayerComponent(
6369
6388
  getPlayerElement,
6370
6389
  isPaused,
6371
6390
  tearDown,
6391
+ isBroadcastMixADAvailable,
6392
+ isBroadcastMixADEnabled,
6393
+ setBroadcastMixADOn,
6394
+ setBroadcastMixADOff,
6372
6395
  }
6373
6396
  }
6374
6397
 
@@ -6384,7 +6407,7 @@ const PauseTriggers = {
6384
6407
  DEVICE: 3,
6385
6408
  };
6386
6409
 
6387
- var Version = "8.9.1";
6410
+ var Version = "8.10.0";
6388
6411
 
6389
6412
  var sourceList;
6390
6413
  var source;
@@ -7735,7 +7758,7 @@ function Subtitles(mediaPlayer, autoStart, playbackElement, defaultStyleOpts, me
7735
7758
 
7736
7759
  if (available()) {
7737
7760
  if (useLegacySubs) {
7738
- import('./legacysubtitles-9f94b60a.js')
7761
+ import('./legacysubtitles-9b711a3d.js')
7739
7762
  .then(({ default: LegacySubtitles }) => {
7740
7763
  subtitlesContainer = LegacySubtitles(mediaPlayer, autoStart, playbackElement, mediaSources, defaultStyleOpts);
7741
7764
  callback(subtitlesEnabled);
@@ -7744,7 +7767,7 @@ function Subtitles(mediaPlayer, autoStart, playbackElement, defaultStyleOpts, me
7744
7767
  Plugins.interface.onSubtitlesDynamicLoadError();
7745
7768
  });
7746
7769
  } else {
7747
- import('./imscsubtitles-e2151ee1.js')
7770
+ import('./imscsubtitles-8fbacac5.js')
7748
7771
  .then(({ default: IMSCSubtitles }) => {
7749
7772
  subtitlesContainer = IMSCSubtitles(mediaPlayer, autoStart, playbackElement, mediaSources, defaultStyleOpts);
7750
7773
  callback(subtitlesEnabled);
@@ -7845,6 +7868,7 @@ function BigscreenPlayer() {
7845
7868
  let stateChangeCallbacks = [];
7846
7869
  let timeUpdateCallbacks = [];
7847
7870
  let subtitleCallbacks = [];
7871
+ let broadcastMixADCallbacks = [];
7848
7872
 
7849
7873
  let playerReadyCallback;
7850
7874
  let playerErrorCallback;
@@ -7953,7 +7977,8 @@ function BigscreenPlayer() {
7953
7977
  mediaSources,
7954
7978
  windowType,
7955
7979
  mediaStateUpdateCallback,
7956
- playerErrorCallback
7980
+ playerErrorCallback,
7981
+ callBroadcastMixADCallbacks
7957
7982
  );
7958
7983
 
7959
7984
  subtitles = Subtitles(
@@ -8001,6 +8026,10 @@ function BigscreenPlayer() {
8001
8026
  return subtitles ? subtitles.available() : false
8002
8027
  }
8003
8028
 
8029
+ function callBroadcastMixADCallbacks(enabled) {
8030
+ CallCallbacks(broadcastMixADCallbacks, { enabled });
8031
+ }
8032
+
8004
8033
  return /** @alias module:bigscreenplayer/bigscreenplayer */ {
8005
8034
  /**
8006
8035
  * Call first to initialise bigscreen player for playback.
@@ -8075,6 +8104,7 @@ function BigscreenPlayer() {
8075
8104
  stateChangeCallbacks = [];
8076
8105
  timeUpdateCallbacks = [];
8077
8106
  subtitleCallbacks = [];
8107
+ broadcastMixADCallbacks = [];
8078
8108
  endOfStream = undefined;
8079
8109
  mediaKind = undefined;
8080
8110
  pauseTrigger = undefined;
@@ -8151,6 +8181,28 @@ function BigscreenPlayer() {
8151
8181
  }
8152
8182
  },
8153
8183
 
8184
+ /**
8185
+ * Pass a function to be called whenever BroadcastMixAD is enabled or disabled.
8186
+ * @function
8187
+ * @param {Function} callback
8188
+ */
8189
+ registerForBroadcastMixADChanges: (callback) => {
8190
+ broadcastMixADCallbacks.push(callback);
8191
+ return callback
8192
+ },
8193
+
8194
+ /**
8195
+ * Unregisters a previously registered callback for changes to BroadcastMixAD.
8196
+ * @function
8197
+ * @param {Function} callback
8198
+ */
8199
+ unregisterForBroadcastMixADChanges: (callback) => {
8200
+ const indexOf = broadcastMixADCallbacks.indexOf(callback);
8201
+ if (indexOf !== -1) {
8202
+ broadcastMixADCallbacks.splice(indexOf, 1);
8203
+ }
8204
+ },
8205
+
8154
8206
  /**
8155
8207
  * Sets the current time of the media asset.
8156
8208
  * @function
@@ -8373,6 +8425,25 @@ function BigscreenPlayer() {
8373
8425
  }
8374
8426
  },
8375
8427
 
8428
+ /**
8429
+ * @function
8430
+ * @returns {boolean} true if there if an AD track is available
8431
+ */
8432
+ isBroadcastMixADAvailable: () => playerComponent && playerComponent.isBroadcastMixADAvailable(),
8433
+
8434
+ /**
8435
+ * @function
8436
+ * @returns {boolean} true if there is an the AD audio track is current being used
8437
+ */
8438
+ isBroadcastMixADEnabled: () => playerComponent && playerComponent.isBroadcastMixADEnabled(),
8439
+
8440
+ /**
8441
+ * @function
8442
+ */
8443
+ setBroadcastMixADEnabled: (enabled) => {
8444
+ enabled ? playerComponent.setBroadcastMixADOn() : playerComponent.setBroadcastMixADOff();
8445
+ },
8446
+
8376
8447
  /**
8377
8448
  *
8378
8449
  * An enum may be used to set the on-screen position of any transport controls
@@ -122,6 +122,18 @@ declare function BigscreenPlayer(): {
122
122
  * @param {Function} callback
123
123
  */
124
124
  unregisterForSubtitleChanges: (callback: Function) => void;
125
+ /**
126
+ * Pass a function to be called whenever BroadcastMixAD is enabled or disabled.
127
+ * @function
128
+ * @param {Function} callback
129
+ */
130
+ registerForBroadcastMixADChanges: (callback: Function) => Function;
131
+ /**
132
+ * Unregisters a previously registered callback for changes to BroadcastMixAD.
133
+ * @function
134
+ * @param {Function} callback
135
+ */
136
+ unregisterForBroadcastMixADChanges: (callback: Function) => void;
125
137
  /**
126
138
  * Sets the current time of the media asset.
127
139
  * @function
@@ -259,6 +271,20 @@ declare function BigscreenPlayer(): {
259
271
  * Clear the example subtitle string
260
272
  */
261
273
  clearSubtitleExample: () => void;
274
+ /**
275
+ * @function
276
+ * @returns {boolean} true if there if an AD track is available
277
+ */
278
+ isBroadcastMixADAvailable: () => boolean;
279
+ /**
280
+ * @function
281
+ * @returns {boolean} true if there is an the AD audio track is current being used
282
+ */
283
+ isBroadcastMixADEnabled: () => boolean;
284
+ /**
285
+ * @function
286
+ */
287
+ setBroadcastMixADEnabled: (enabled: any) => void;
262
288
  /**
263
289
  *
264
290
  * An enum may be used to set the on-screen position of any transport controls
package/dist/esm/main.js CHANGED
@@ -1 +1 @@
1
- export { B as BigscreenPlayer, a as DebugTool, E as EntryCategory, c as LiveSupport, M as MediaKinds, g as MediaState, h as MockBigscreenPlayer, b as PauseTriggers, i as PlaybackStrategy, j as TransferFormat, T as TransportControlPosition, W as WindowTypes, k as isMessage, l as isMetric, m as isTrace } from './main-7b498fab.js';
1
+ export { B as BigscreenPlayer, a as DebugTool, E as EntryCategory, c as LiveSupport, M as MediaKinds, g as MediaState, h as MockBigscreenPlayer, b as PauseTriggers, i as PlaybackStrategy, j as TransferFormat, T as TransportControlPosition, W as WindowTypes, k as isMessage, l as isMetric, m as isTrace } from './main-2e77173d.js';
@@ -1,5 +1,5 @@
1
1
  import { MediaPlayer } from 'dashjs/index_mediaplayerOnly';
2
- import { W as WindowTypes, U as Utils, b as PauseTriggers, c as LiveSupport, M as MediaKinds, a as DebugToolInstance, d as TimeUtils, e as DynamicWindowUtils, g as MediaState, P as Plugins, D as DOMHelpers } from './main-7b498fab.js';
2
+ import { W as WindowTypes, U as Utils, b as PauseTriggers, c as LiveSupport, M as MediaKinds, a as DebugToolInstance, d as TimeUtils, e as DynamicWindowUtils, g as MediaState, P as Plugins, D as DOMHelpers } from './main-2e77173d.js';
3
3
 
4
4
  function filter(manifest, representationOptions) {
5
5
  const constantFps = representationOptions.constantFps;
@@ -175,7 +175,16 @@ const DEFAULT_SETTINGS = {
175
175
  seekDurationPadding: 1.1,
176
176
  };
177
177
 
178
- function MSEStrategy(mediaSources, windowType, mediaKind, playbackElement, isUHD, customPlayerSettings) {
178
+ function MSEStrategy(
179
+ mediaSources,
180
+ windowType,
181
+ mediaKind,
182
+ playbackElement,
183
+ isUHD,
184
+ customPlayerSettings,
185
+ enableBroadcastMixAD,
186
+ callBroadcastMixADCallbacks
187
+ ) {
179
188
  let mediaPlayer;
180
189
  let mediaElement;
181
190
 
@@ -253,6 +262,7 @@ function MSEStrategy(mediaSources, windowType, mediaKind, playbackElement, isUHD
253
262
  STREAM_INITIALIZED: "streamInitialized",
254
263
  FRAGMENT_CONTENT_LENGTH_MISMATCH: "fragmentContentLengthMismatch",
255
264
  QUOTA_EXCEEDED: "quotaExceeded",
265
+ CURRENT_TRACK_CHANGED: "currentTrackChanged",
256
266
  };
257
267
 
258
268
  function onLoadedMetaData() {
@@ -600,6 +610,16 @@ function MSEStrategy(mediaSources, windowType, mediaKind, playbackElement, isUHD
600
610
  Plugins.interface.onFragmentContentLengthMismatch(event);
601
611
  }
602
612
 
613
+ function onCurrentTrackChanged(event) {
614
+ const mediaType = event.newMediaInfo.type;
615
+ DebugToolInstance.info(
616
+ `${mediaType} track changed.${
617
+ mediaType === "audio" ? (isBroadcastMixADEnabled() ? " BroadcastMixAD on." : " BroadcastMixAD off.") : ""
618
+ }`
619
+ );
620
+ callBroadcastMixADCallbacks(isBroadcastMixADEnabled());
621
+ }
622
+
603
623
  function publishMediaState(mediaState) {
604
624
  for (let index = 0; index < eventCallbacks.length; index++) {
605
625
  eventCallbacks[index](mediaState);
@@ -672,6 +692,14 @@ function MSEStrategy(mediaSources, windowType, mediaKind, playbackElement, isUHD
672
692
  mediaPlayer = MediaPlayer().create();
673
693
  mediaPlayer.updateSettings(dashSettings);
674
694
  mediaPlayer.initialize(mediaElement, null, true);
695
+
696
+ if (enableBroadcastMixAD) {
697
+ mediaPlayer.setInitialMediaSettingsFor("audio", {
698
+ role: "alternate",
699
+ accessibility: { schemeIdUri: "urn:tva:metadata:cs:AudioPurposeCS:2007", value: "1" },
700
+ });
701
+ }
702
+
675
703
  modifySource(playbackTime);
676
704
  }
677
705
 
@@ -719,6 +747,7 @@ function MSEStrategy(mediaSources, windowType, mediaKind, playbackElement, isUHD
719
747
  mediaPlayer.on(DashJSEvents.GAP_JUMP_TO_END, onGapJump);
720
748
  mediaPlayer.on(DashJSEvents.QUOTA_EXCEEDED, onQuotaExceeded);
721
749
  mediaPlayer.on(DashJSEvents.MANIFEST_LOADING_FINISHED, manifestLoadingFinished);
750
+ mediaPlayer.on(DashJSEvents.CURRENT_TRACK_CHANGED, onCurrentTrackChanged);
722
751
  }
723
752
 
724
753
  function manifestLoadingFinished(event) {
@@ -809,6 +838,43 @@ function MSEStrategy(mediaSources, windowType, mediaKind, playbackElement, isUHD
809
838
  );
810
839
  }
811
840
 
841
+ function isTrackBroadcastMixAD(track) {
842
+ return (
843
+ track.roles.includes("alternate") &&
844
+ track.accessibilitiesWithSchemeIdUri.some(
845
+ (scheme) => scheme.schemeIdUri === "urn:tva:metadata:cs:AudioPurposeCS:2007" && scheme.value === "1"
846
+ )
847
+ )
848
+ }
849
+
850
+ function getBroadcastMixADTrack() {
851
+ const audioTracks = mediaPlayer.getTracksFor("audio");
852
+ return audioTracks.find((track) => isTrackBroadcastMixAD(track))
853
+ }
854
+
855
+ function isBroadcastMixADAvailable() {
856
+ const audioTracks = mediaPlayer.getTracksFor("audio");
857
+ return audioTracks.some((track) => isTrackBroadcastMixAD(track))
858
+ }
859
+
860
+ function isBroadcastMixADEnabled() {
861
+ const currentAudioTrack = mediaPlayer.getCurrentTrackFor("audio");
862
+ return currentAudioTrack ? isTrackBroadcastMixAD(currentAudioTrack) : false
863
+ }
864
+
865
+ function setBroadcastMixADOff() {
866
+ const audioTracks = mediaPlayer.getTracksFor("audio");
867
+ const mainTrack = audioTracks.find((track) => track.roles.includes("main"));
868
+ mediaPlayer.setCurrentTrack(mainTrack);
869
+ }
870
+
871
+ function setBroadcastMixADOn() {
872
+ const ADTrack = getBroadcastMixADTrack();
873
+ if (ADTrack) {
874
+ mediaPlayer.setCurrentTrack(ADTrack);
875
+ }
876
+ }
877
+
812
878
  function cleanUpMediaPlayer() {
813
879
  if (mediaPlayer) {
814
880
  mediaPlayer.destroy();
@@ -827,6 +893,7 @@ function MSEStrategy(mediaSources, windowType, mediaKind, playbackElement, isUHD
827
893
  mediaPlayer.off(DashJSEvents.GAP_JUMP, onGapJump);
828
894
  mediaPlayer.off(DashJSEvents.GAP_JUMP_TO_END, onGapJump);
829
895
  mediaPlayer.off(DashJSEvents.QUOTA_EXCEEDED, onQuotaExceeded);
896
+ mediaPlayer.off(DashJSEvents.TRACK_CHANGE_RENDERED, onCurrentTrackChanged);
830
897
 
831
898
  mediaPlayer = undefined;
832
899
  }
@@ -866,6 +933,10 @@ function MSEStrategy(mediaSources, windowType, mediaKind, playbackElement, isUHD
866
933
  load,
867
934
  getSeekableRange,
868
935
  getCurrentTime,
936
+ isBroadcastMixADAvailable,
937
+ isBroadcastMixADEnabled,
938
+ setBroadcastMixADOn,
939
+ setBroadcastMixADOff,
869
940
  getDuration,
870
941
  getPlayerElement: () => mediaElement,
871
942
  tearDown: () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bigscreen-player",
3
- "version": "8.9.1",
3
+ "version": "8.10.0",
4
4
  "type": "module",
5
5
  "description": "Simplified media playback for bigscreen devices.",
6
6
  "main": "dist/esm/main.js",