rx-player 3.30.0-dev.2023011800 → 3.30.0-dev.2023020100

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.
Files changed (30) hide show
  1. package/CHANGELOG.md +9 -1
  2. package/VERSION +1 -1
  3. package/dist/_esm5.processed/compat/should_reload_media_source_on_decipherability_update.d.ts +2 -2
  4. package/dist/_esm5.processed/compat/should_reload_media_source_on_decipherability_update.js +2 -2
  5. package/dist/_esm5.processed/core/api/option_utils.js +25 -10
  6. package/dist/_esm5.processed/core/api/public_api.d.ts +11 -1
  7. package/dist/_esm5.processed/core/api/public_api.js +28 -3
  8. package/dist/_esm5.processed/core/decrypt/{get_current_key_system.d.ts → get_key_system_configuration.d.ts} +11 -2
  9. package/dist/_esm5.processed/core/decrypt/{get_current_key_system.js → get_key_system_configuration.js} +20 -2
  10. package/dist/_esm5.processed/core/decrypt/index.d.ts +2 -2
  11. package/dist/_esm5.processed/core/decrypt/index.js +2 -2
  12. package/dist/_esm5.processed/core/init/media_source_content_initializer.js +3 -3
  13. package/dist/_esm5.processed/public_types.d.ts +7 -0
  14. package/dist/rx-player.js +64 -15
  15. package/dist/rx-player.min.js +1 -1
  16. package/jest.config.js +0 -5
  17. package/package.json +1 -4
  18. package/scripts/fast_demo_build.js +39 -40
  19. package/scripts/generate_full_demo.js +1 -1
  20. package/sonar-project.properties +1 -1
  21. package/src/compat/__tests__/should_reload_media_source_on_decipherability_update.test.ts +1 -1
  22. package/src/compat/should_reload_media_source_on_decipherability_update.ts +3 -3
  23. package/src/core/api/option_utils.ts +16 -0
  24. package/src/core/api/public_api.ts +30 -2
  25. package/src/core/decrypt/{get_current_key_system.ts → get_key_system_configuration.ts} +23 -2
  26. package/src/core/decrypt/index.ts +4 -1
  27. package/src/core/init/media_source_content_initializer.ts +3 -3
  28. package/src/public_types.ts +8 -0
  29. package/tsconfig.json +1 -1
  30. package/tsconfig.modules.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,11 +1,19 @@
1
1
  # Changelog
2
2
 
3
- ## v3.30.0-dev.2023011700 (2023-01-17)
3
+ ## v3.30.0-dev.2023020100 (2023-01-17)
4
4
 
5
5
  ### Features
6
6
 
7
7
  - Add `updateContentUrls` API, allowing to update the Manifest's URL during playback [#1182]
8
8
  - DASH: implement forced-subtitles, adding the `forced` property to the audio tracks API and selecting by default a forced text track linked to the audio track's language if present [#1187]
9
+ - DRM: add the `getKeySystemConfiguration` method to the RxPlayer [#1202]
10
+
11
+ ### Deprecated
12
+
13
+ - Deprecate the `getVideoLoadedTime` method which can be easily replaced (see Deprecated method documentation)
14
+ - Deprecate the `getVideoPlayedTime` method which can be easily replaced (see Deprecated method documentation)
15
+ - Deprecate the `transportOptions.aggressiveMode` option
16
+ - DRM: Deprecate the `keySystems[].onKeyStatusesChange` callback as no good use case was found for it.
9
17
 
10
18
  ### Bug fixes
11
19
 
package/VERSION CHANGED
@@ -1 +1 @@
1
- 3.30.0-dev.2023011800
1
+ 3.30.0-dev.2023020100
@@ -20,7 +20,7 @@
20
20
  * We found that on all Widevine targets tested, a simple seek is sufficient.
21
21
  * As widevine clients make a good chunk of users, we can make a difference
22
22
  * between them and others as it is for the better.
23
- * @param {string|null} currentKeySystem
23
+ * @param {string|undefined} currentKeySystem
24
24
  * @returns {Boolean}
25
25
  */
26
- export default function shouldReloadMediaSourceOnDecipherabilityUpdate(currentKeySystem: string | null): boolean;
26
+ export default function shouldReloadMediaSourceOnDecipherabilityUpdate(currentKeySystem: string | undefined): boolean;
@@ -20,10 +20,10 @@
20
20
  * We found that on all Widevine targets tested, a simple seek is sufficient.
21
21
  * As widevine clients make a good chunk of users, we can make a difference
22
22
  * between them and others as it is for the better.
23
- * @param {string|null} currentKeySystem
23
+ * @param {string|undefined} currentKeySystem
24
24
  * @returns {Boolean}
25
25
  */
26
26
  export default function shouldReloadMediaSourceOnDecipherabilityUpdate(currentKeySystem) {
27
- return currentKeySystem === null ||
27
+ return currentKeySystem === undefined ||
28
28
  currentKeySystem.indexOf("widevine") < 0;
29
29
  }
@@ -269,14 +269,14 @@ function checkReloadOptions(options) {
269
269
  * @returns {Object}
270
270
  */
271
271
  function parseLoadVideoOptions(options) {
272
- var _a, _b, _c, _d, _e, _f, _g;
272
+ var _a, _b, _c, _d, _e, _f, _g, _h;
273
273
  var url;
274
274
  var transport;
275
275
  var keySystems;
276
276
  var textTrackMode;
277
277
  var textTrackElement;
278
278
  var startAt;
279
- var _h = config.getCurrent(), DEFAULT_AUDIO_TRACK_SWITCHING_MODE = _h.DEFAULT_AUDIO_TRACK_SWITCHING_MODE, DEFAULT_AUTO_PLAY = _h.DEFAULT_AUTO_PLAY, DEFAULT_CODEC_SWITCHING_BEHAVIOR = _h.DEFAULT_CODEC_SWITCHING_BEHAVIOR, DEFAULT_ENABLE_FAST_SWITCHING = _h.DEFAULT_ENABLE_FAST_SWITCHING, DEFAULT_MANUAL_BITRATE_SWITCHING_MODE = _h.DEFAULT_MANUAL_BITRATE_SWITCHING_MODE, DEFAULT_SHOW_NATIVE_SUBTITLE = _h.DEFAULT_SHOW_NATIVE_SUBTITLE, DEFAULT_TEXT_TRACK_MODE = _h.DEFAULT_TEXT_TRACK_MODE;
279
+ var _j = config.getCurrent(), DEFAULT_AUDIO_TRACK_SWITCHING_MODE = _j.DEFAULT_AUDIO_TRACK_SWITCHING_MODE, DEFAULT_AUTO_PLAY = _j.DEFAULT_AUTO_PLAY, DEFAULT_CODEC_SWITCHING_BEHAVIOR = _j.DEFAULT_CODEC_SWITCHING_BEHAVIOR, DEFAULT_ENABLE_FAST_SWITCHING = _j.DEFAULT_ENABLE_FAST_SWITCHING, DEFAULT_MANUAL_BITRATE_SWITCHING_MODE = _j.DEFAULT_MANUAL_BITRATE_SWITCHING_MODE, DEFAULT_SHOW_NATIVE_SUBTITLE = _j.DEFAULT_SHOW_NATIVE_SUBTITLE, DEFAULT_TEXT_TRACK_MODE = _j.DEFAULT_TEXT_TRACK_MODE;
280
280
  if (isNullOrUndefined(options)) {
281
281
  throw new Error("No option set on loadVideo");
282
282
  }
@@ -297,6 +297,11 @@ function parseLoadVideoOptions(options) {
297
297
  else {
298
298
  transport = String(options.transport);
299
299
  }
300
+ if (!isNullOrUndefined((_c = options.transportOptions) === null || _c === void 0 ? void 0 : _c.aggressiveMode)) {
301
+ warnOnce("`transportOptions.aggressiveMode` is deprecated and won't " +
302
+ "be present in the next major version. " +
303
+ "Please open an issue if you still need this.");
304
+ }
300
305
  var autoPlay = isNullOrUndefined(options.autoPlay) ? DEFAULT_AUTO_PLAY :
301
306
  !!options.autoPlay;
302
307
  if (isNullOrUndefined(options.keySystems)) {
@@ -312,6 +317,16 @@ function parseLoadVideoOptions(options) {
312
317
  throw new Error("Invalid key system given: Missing type string or " +
313
318
  "getLicense callback");
314
319
  }
320
+ if (!isNullOrUndefined(keySystem.onKeyStatusesChange)) {
321
+ warnOnce("`keySystems[].onKeyStatusesChange` is deprecated and won't " +
322
+ "be present in the next major version. " +
323
+ "Please open an issue if you still need this.");
324
+ }
325
+ if (!isNullOrUndefined(keySystem.throwOnLicenseExpiration)) {
326
+ warnOnce("`keySystems[].throwOnLicenseExpiration` is deprecated and won't " +
327
+ "be present in the next major version. " +
328
+ "Please open an issue if you still need this.");
329
+ }
315
330
  }
316
331
  }
317
332
  var lowLatencyMode = options.lowLatencyMode === undefined ?
@@ -321,8 +336,8 @@ function parseLoadVideoOptions(options) {
321
336
  options.transportOptions !== null ?
322
337
  options.transportOptions :
323
338
  {};
324
- var initialManifest = (_c = options.transportOptions) === null || _c === void 0 ? void 0 : _c.initialManifest;
325
- var minimumManifestUpdateInterval = (_e = (_d = options.transportOptions) === null || _d === void 0 ? void 0 : _d.minimumManifestUpdateInterval) !== null && _e !== void 0 ? _e : 0;
339
+ var initialManifest = (_d = options.transportOptions) === null || _d === void 0 ? void 0 : _d.initialManifest;
340
+ var minimumManifestUpdateInterval = (_f = (_e = options.transportOptions) === null || _e === void 0 ? void 0 : _e.minimumManifestUpdateInterval) !== null && _f !== void 0 ? _f : 0;
326
341
  var audioTrackSwitchingMode = isNullOrUndefined(options.audioTrackSwitchingMode)
327
342
  ? DEFAULT_AUDIO_TRACK_SWITCHING_MODE
328
343
  : options.audioTrackSwitchingMode;
@@ -363,8 +378,8 @@ function parseLoadVideoOptions(options) {
363
378
  "Please use the `TextTrackRenderer` tool instead.");
364
379
  var supplementaryTextTracks = Array.isArray(options.supplementaryTextTracks) ?
365
380
  options.supplementaryTextTracks : [options.supplementaryTextTracks];
366
- for (var _j = 0, supplementaryTextTracks_1 = supplementaryTextTracks; _j < supplementaryTextTracks_1.length; _j++) {
367
- var supplementaryTextTrack = supplementaryTextTracks_1[_j];
381
+ for (var _k = 0, supplementaryTextTracks_1 = supplementaryTextTracks; _k < supplementaryTextTracks_1.length; _k++) {
382
+ var supplementaryTextTrack = supplementaryTextTracks_1[_k];
368
383
  if (typeof supplementaryTextTrack.language !== "string" ||
369
384
  typeof supplementaryTextTrack.mimeType !== "string" ||
370
385
  typeof supplementaryTextTrack.url !== "string") {
@@ -379,8 +394,8 @@ function parseLoadVideoOptions(options) {
379
394
  "Please use the `parseBifThumbnails` tool instead.");
380
395
  var supplementaryImageTracks = Array.isArray(options.supplementaryImageTracks) ?
381
396
  options.supplementaryImageTracks : [options.supplementaryImageTracks];
382
- for (var _k = 0, supplementaryImageTracks_1 = supplementaryImageTracks; _k < supplementaryImageTracks_1.length; _k++) {
383
- var supplementaryImageTrack = supplementaryImageTracks_1[_k];
397
+ for (var _l = 0, supplementaryImageTracks_1 = supplementaryImageTracks; _l < supplementaryImageTracks_1.length; _l++) {
398
+ var supplementaryImageTrack = supplementaryImageTracks_1[_l];
384
399
  if (typeof supplementaryImageTrack.mimeType !== "string" ||
385
400
  typeof supplementaryImageTrack.url !== "string") {
386
401
  throw new Error("Invalid supplementary image track given. " +
@@ -415,7 +430,7 @@ function parseLoadVideoOptions(options) {
415
430
  warnOnce("The `hideNativeSubtitle` loadVideo option is deprecated");
416
431
  hideNativeSubtitle = !!options.hideNativeSubtitle;
417
432
  }
418
- var manualBitrateSwitchingMode = (_f = options.manualBitrateSwitchingMode) !== null && _f !== void 0 ? _f : DEFAULT_MANUAL_BITRATE_SWITCHING_MODE;
433
+ var manualBitrateSwitchingMode = (_g = options.manualBitrateSwitchingMode) !== null && _g !== void 0 ? _g : DEFAULT_MANUAL_BITRATE_SWITCHING_MODE;
419
434
  var enableFastSwitching = isNullOrUndefined(options.enableFastSwitching) ?
420
435
  DEFAULT_ENABLE_FAST_SWITCHING :
421
436
  options.enableFastSwitching;
@@ -448,7 +463,7 @@ function parseLoadVideoOptions(options) {
448
463
  startAt = options.startAt;
449
464
  }
450
465
  }
451
- var networkConfig = (_g = options.networkConfig) !== null && _g !== void 0 ? _g : {};
466
+ var networkConfig = (_h = options.networkConfig) !== null && _h !== void 0 ? _h : {};
452
467
  // TODO without cast
453
468
  /* eslint-disable @typescript-eslint/consistent-type-assertions */
454
469
  return { autoPlay: autoPlay, defaultAudioTrack: defaultAudioTrack, defaultTextTrack: defaultTextTrack, enableFastSwitching: enableFastSwitching, hideNativeSubtitle: hideNativeSubtitle, keySystems: keySystems, initialManifest: initialManifest, lowLatencyMode: lowLatencyMode, manualBitrateSwitchingMode: manualBitrateSwitchingMode, audioTrackSwitchingMode: audioTrackSwitchingMode, minimumManifestUpdateInterval: minimumManifestUpdateInterval, networkConfig: networkConfig, onCodecSwitch: onCodecSwitch, startAt: startAt, textTrackElement: textTrackElement, textTrackMode: textTrackMode, transport: transport, transportOptions: transportOptions, url: url };
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import { IErrorCode, IErrorType } from "../../errors";
17
17
  import Manifest from "../../manifest";
18
- import { IAdaptation, IAudioTrack, IAudioTrackPreference, IAvailableAudioTrack, IAvailableTextTrack, IAvailableVideoTrack, IBifThumbnail, IBitrateEstimate, IConstructorOptions, IDecipherabilityUpdateContent, ILoadVideoOptions, IPeriod, IPlayerError, IPlayerState, IPositionUpdate, IRepresentation, IStreamEvent, ITextTrack, ITextTrackPreference, IVideoTrack, IVideoTrackPreference } from "../../public_types";
18
+ import { IAdaptation, IAudioTrack, IAudioTrackPreference, IAvailableAudioTrack, IAvailableTextTrack, IAvailableVideoTrack, IBifThumbnail, IBitrateEstimate, IConstructorOptions, IDecipherabilityUpdateContent, IKeySystemConfigurationOutput, ILoadVideoOptions, IPeriod, IPlayerError, IPlayerState, IPositionUpdate, IRepresentation, IStreamEvent, ITextTrack, ITextTrackPreference, IVideoTrack, IVideoTrackPreference } from "../../public_types";
19
19
  import EventEmitter, { IListener } from "../../utils/event_emitter";
20
20
  import Logger from "../../utils/logger";
21
21
  import { IBufferedChunk, IBufferType } from "../segment_buffers";
@@ -556,9 +556,19 @@ declare class Player extends EventEmitter<IPublicAPIEvent> {
556
556
  /**
557
557
  * Returns type of current keysystem (e.g. playready, widevine) if the content
558
558
  * is encrypted. null otherwise.
559
+ * @deprecated
559
560
  * @returns {string|null}
560
561
  */
561
562
  getCurrentKeySystem(): string | null;
563
+ /**
564
+ * Returns both the name of the key system (e.g. `"com.widevine.alpha"`) and
565
+ * the `MediaKeySystemConfiguration` currently associated to the
566
+ * HTMLMediaElement linked to the RxPlayer.
567
+ *
568
+ * Returns `null` if no such capabilities is associated or if unknown.
569
+ * @returns {Object|null}
570
+ */
571
+ getKeySystemConfiguration(): IKeySystemConfigurationOutput | null;
562
572
  /**
563
573
  * Returns every available audio tracks for the current Period.
564
574
  * @returns {Array.<Object>|null}
@@ -60,7 +60,7 @@ import { getLeftSizeOfRange, getPlayedSizeOfRange, getSizeOfRange, } from "../..
60
60
  import createSharedReference, { createMappedReference, } from "../../utils/reference";
61
61
  import TaskCanceller from "../../utils/task_canceller";
62
62
  import warnOnce from "../../utils/warn_once";
63
- import { clearOnStop, disposeDecryptionResources, getCurrentKeySystem, } from "../decrypt";
63
+ import { clearOnStop, disposeDecryptionResources, getKeySystemConfiguration, getCurrentKeySystem, } from "../decrypt";
64
64
  import MediaSourceContentInitializer from "../init/media_source_content_initializer";
65
65
  import { checkReloadOptions, parseConstructorOptions, parseLoadVideoOptions, } from "./option_utils";
66
66
  import PlaybackObserver from "./playback_observer";
@@ -89,7 +89,7 @@ var Player = /** @class */ (function (_super) {
89
89
  // Workaround to support Firefox autoplay on FF 42.
90
90
  // See: https://bugzilla.mozilla.org/show_bug.cgi?id=1194624
91
91
  videoElement.preload = "auto";
92
- _this.version = /* PLAYER_VERSION */ "3.30.0-dev.2023011800";
92
+ _this.version = /* PLAYER_VERSION */ "3.30.0-dev.2023020100";
93
93
  _this.log = log;
94
94
  _this.state = "STOPPED";
95
95
  _this.videoElement = videoElement;
@@ -811,6 +811,8 @@ var Player = /** @class */ (function (_super) {
811
811
  * @returns {Number}
812
812
  */
813
813
  Player.prototype.getVideoLoadedTime = function () {
814
+ warnOnce("`getVideoLoadedTime` is deprecated and won't be present in the " +
815
+ "next major version");
814
816
  if (this.videoElement === null) {
815
817
  throw new Error("Disposed player");
816
818
  }
@@ -824,6 +826,8 @@ var Player = /** @class */ (function (_super) {
824
826
  * @returns {Number}
825
827
  */
826
828
  Player.prototype.getVideoPlayedTime = function () {
829
+ warnOnce("`getVideoPlayedTime` is deprecated and won't be present in the " +
830
+ "next major version");
827
831
  if (this.videoElement === null) {
828
832
  throw new Error("Disposed player");
829
833
  }
@@ -1373,14 +1377,35 @@ var Player = /** @class */ (function (_super) {
1373
1377
  /**
1374
1378
  * Returns type of current keysystem (e.g. playready, widevine) if the content
1375
1379
  * is encrypted. null otherwise.
1380
+ * @deprecated
1376
1381
  * @returns {string|null}
1377
1382
  */
1378
1383
  Player.prototype.getCurrentKeySystem = function () {
1384
+ warnOnce("`getCurrentKeySystem` is deprecated." +
1385
+ "Please use the `getKeySystemConfiguration` method instead.");
1379
1386
  if (this.videoElement === null) {
1380
1387
  throw new Error("Disposed player");
1381
1388
  }
1382
1389
  return getCurrentKeySystem(this.videoElement);
1383
1390
  };
1391
+ /**
1392
+ * Returns both the name of the key system (e.g. `"com.widevine.alpha"`) and
1393
+ * the `MediaKeySystemConfiguration` currently associated to the
1394
+ * HTMLMediaElement linked to the RxPlayer.
1395
+ *
1396
+ * Returns `null` if no such capabilities is associated or if unknown.
1397
+ * @returns {Object|null}
1398
+ */
1399
+ Player.prototype.getKeySystemConfiguration = function () {
1400
+ if (this.videoElement === null) {
1401
+ throw new Error("Disposed player");
1402
+ }
1403
+ var values = getKeySystemConfiguration(this.videoElement);
1404
+ if (values === null) {
1405
+ return null;
1406
+ }
1407
+ return { keySystem: values[0], configuration: values[1] };
1408
+ };
1384
1409
  /**
1385
1410
  * Returns every available audio tracks for the current Period.
1386
1411
  * @returns {Array.<Object>|null}
@@ -2303,5 +2328,5 @@ var Player = /** @class */ (function (_super) {
2303
2328
  };
2304
2329
  return Player;
2305
2330
  }(EventEmitter));
2306
- Player.version = /* PLAYER_VERSION */ "3.30.0-dev.2023011800";
2331
+ Player.version = /* PLAYER_VERSION */ "3.30.0-dev.2023020100";
2307
2332
  export default Player;
@@ -14,8 +14,17 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  /**
17
- * Returns the name of the current key system used.
17
+ * Returns the name of the current key system used as well as its configuration,
18
+ * as reported by the `MediaKeySystemAccess` itself.
19
+ * @param {HTMLMediaElement} mediaElement
20
+ * @returns {Array|null}
21
+ */
22
+ export default function getKeySystemConfiguration(mediaElement: HTMLMediaElement): [string, MediaKeySystemConfiguration] | null;
23
+ /**
24
+ * Returns the name of the current key system used, as originally indicated by
25
+ * the user.
26
+ * @deprecated
18
27
  * @param {HTMLMediaElement} mediaElement
19
28
  * @returns {string|null}
20
29
  */
21
- export default function getCurrentKeySystem(mediaElement: HTMLMediaElement): string | null;
30
+ export declare function getCurrentKeySystem(mediaElement: HTMLMediaElement): string | null;
@@ -15,11 +15,29 @@
15
15
  */
16
16
  import MediaKeysInfosStore from "./utils/media_keys_infos_store";
17
17
  /**
18
- * Returns the name of the current key system used.
18
+ * Returns the name of the current key system used as well as its configuration,
19
+ * as reported by the `MediaKeySystemAccess` itself.
20
+ * @param {HTMLMediaElement} mediaElement
21
+ * @returns {Array|null}
22
+ */
23
+ export default function getKeySystemConfiguration(mediaElement) {
24
+ var currentState = MediaKeysInfosStore.getState(mediaElement);
25
+ if (currentState === null) {
26
+ return null;
27
+ }
28
+ return [
29
+ currentState.mediaKeySystemAccess.keySystem,
30
+ currentState.mediaKeySystemAccess.getConfiguration(),
31
+ ];
32
+ }
33
+ /**
34
+ * Returns the name of the current key system used, as originally indicated by
35
+ * the user.
36
+ * @deprecated
19
37
  * @param {HTMLMediaElement} mediaElement
20
38
  * @returns {string|null}
21
39
  */
22
- export default function getCurrentKeySystem(mediaElement) {
40
+ export function getCurrentKeySystem(mediaElement) {
23
41
  var currentState = MediaKeysInfosStore.getState(mediaElement);
24
42
  return currentState == null ? null :
25
43
  currentState.keySystemOptions.type;
@@ -20,7 +20,7 @@
20
20
  import clearOnStop from "./clear_on_stop";
21
21
  import ContentDecryptor, { ContentDecryptorState, IContentDecryptorEvent } from "./content_decryptor";
22
22
  import disposeDecryptionResources from "./dispose_decryption_resources";
23
- import getCurrentKeySystem from "./get_current_key_system";
23
+ import getKeySystemConfiguration, { getCurrentKeySystem } from "./get_key_system_configuration";
24
24
  export * from "./types";
25
25
  export default ContentDecryptor;
26
- export { clearOnStop, ContentDecryptorState, disposeDecryptionResources, getCurrentKeySystem, IContentDecryptorEvent, };
26
+ export { clearOnStop, ContentDecryptorState, disposeDecryptionResources, getKeySystemConfiguration, getCurrentKeySystem, IContentDecryptorEvent, };
@@ -20,7 +20,7 @@
20
20
  import clearOnStop from "./clear_on_stop";
21
21
  import ContentDecryptor, { ContentDecryptorState, } from "./content_decryptor";
22
22
  import disposeDecryptionResources from "./dispose_decryption_resources";
23
- import getCurrentKeySystem from "./get_current_key_system";
23
+ import getKeySystemConfiguration, { getCurrentKeySystem, } from "./get_key_system_configuration";
24
24
  export * from "./types";
25
25
  export default ContentDecryptor;
26
- export { clearOnStop, ContentDecryptorState, disposeDecryptionResources, getCurrentKeySystem, };
26
+ export { clearOnStop, ContentDecryptorState, disposeDecryptionResources, getKeySystemConfiguration, getCurrentKeySystem, };
@@ -73,7 +73,7 @@ import objectAssign from "../../utils/object_assign";
73
73
  import createSharedReference from "../../utils/reference";
74
74
  import TaskCanceller from "../../utils/task_canceller";
75
75
  import AdaptiveRepresentationSelector from "../adaptive";
76
- import { getCurrentKeySystem, } from "../decrypt";
76
+ import { getKeySystemConfiguration, } from "../decrypt";
77
77
  import { ManifestFetcher, SegmentFetcherCreator, } from "../fetchers";
78
78
  import SegmentBuffersStore from "../segment_buffers";
79
79
  import StreamOrchestrator from "../stream";
@@ -460,8 +460,8 @@ var MediaSourceContentInitializer = /** @class */ (function (_super) {
460
460
  addedSegment: function (value) { return self.trigger("addedSegment", value); },
461
461
  needsMediaSourceReload: function (value) { return onReloadOrder(value); },
462
462
  needsDecipherabilityFlush: function (value) {
463
- var keySystem = getCurrentKeySystem(mediaElement);
464
- if (shouldReloadMediaSourceOnDecipherabilityUpdate(keySystem)) {
463
+ var keySystem = getKeySystemConfiguration(mediaElement);
464
+ if (shouldReloadMediaSourceOnDecipherabilityUpdate(keySystem === null || keySystem === void 0 ? void 0 : keySystem[0])) {
465
465
  onReloadOrder(value);
466
466
  }
467
467
  else {
@@ -699,6 +699,13 @@ export interface IVideoTrack {
699
699
  label?: string | undefined;
700
700
  representations: IVideoRepresentation[];
701
701
  }
702
+ /** Output of the `getKeySystemConfiguration` method. */
703
+ export interface IKeySystemConfigurationOutput {
704
+ /** Key system string. */
705
+ keySystem: string;
706
+ /** `MediaKeySystemConfiguration` actually used by the key system. */
707
+ configuration: MediaKeySystemConfiguration;
708
+ }
702
709
  /** Audio track from a list of audio tracks returned by the RxPlayer. */
703
710
  export interface IAvailableAudioTrack extends IAudioTrack {
704
711
  active: boolean;
package/dist/rx-player.js CHANGED
@@ -38199,7 +38199,7 @@ function _disposeDecryptionResources() {
38199
38199
  }));
38200
38200
  return _disposeDecryptionResources.apply(this, arguments);
38201
38201
  }
38202
- ;// CONCATENATED MODULE: ./src/core/decrypt/get_current_key_system.ts
38202
+ ;// CONCATENATED MODULE: ./src/core/decrypt/get_key_system_configuration.ts
38203
38203
  /**
38204
38204
  * Copyright 2015 CANAL+ Group
38205
38205
  *
@@ -38217,11 +38217,26 @@ function _disposeDecryptionResources() {
38217
38217
  */
38218
38218
 
38219
38219
  /**
38220
- * Returns the name of the current key system used.
38220
+ * Returns the name of the current key system used as well as its configuration,
38221
+ * as reported by the `MediaKeySystemAccess` itself.
38222
+ * @param {HTMLMediaElement} mediaElement
38223
+ * @returns {Array|null}
38224
+ */
38225
+ function get_key_system_configuration_getKeySystemConfiguration(mediaElement) {
38226
+ var currentState = media_keys_infos_store/* default.getState */.Z.getState(mediaElement);
38227
+ if (currentState === null) {
38228
+ return null;
38229
+ }
38230
+ return [currentState.mediaKeySystemAccess.keySystem, currentState.mediaKeySystemAccess.getConfiguration()];
38231
+ }
38232
+ /**
38233
+ * Returns the name of the current key system used, as originally indicated by
38234
+ * the user.
38235
+ * @deprecated
38221
38236
  * @param {HTMLMediaElement} mediaElement
38222
38237
  * @returns {string|null}
38223
38238
  */
38224
- function get_current_key_system_getCurrentKeySystem(mediaElement) {
38239
+ function get_key_system_configuration_getCurrentKeySystem(mediaElement) {
38225
38240
  var currentState = media_keys_infos_store/* default.getState */.Z.getState(mediaElement);
38226
38241
  return currentState == null ? null : currentState.keySystemOptions.type;
38227
38242
  }
@@ -38314,11 +38329,11 @@ function clearOnStop(mediaElement) {
38314
38329
  * We found that on all Widevine targets tested, a simple seek is sufficient.
38315
38330
  * As widevine clients make a good chunk of users, we can make a difference
38316
38331
  * between them and others as it is for the better.
38317
- * @param {string|null} currentKeySystem
38332
+ * @param {string|undefined} currentKeySystem
38318
38333
  * @returns {Boolean}
38319
38334
  */
38320
38335
  function shouldReloadMediaSourceOnDecipherabilityUpdate(currentKeySystem) {
38321
- return currentKeySystem === null || currentKeySystem.indexOf("widevine") < 0;
38336
+ return currentKeySystem === undefined || currentKeySystem.indexOf("widevine") < 0;
38322
38337
  }
38323
38338
  // EXTERNAL MODULE: ./src/utils/noop.ts
38324
38339
  var noop = __webpack_require__(8894);
@@ -49338,8 +49353,8 @@ var MediaSourceContentInitializer = /*#__PURE__*/function (_ContentInitializer)
49338
49353
  return onReloadOrder(value);
49339
49354
  },
49340
49355
  needsDecipherabilityFlush: function needsDecipherabilityFlush(value) {
49341
- var keySystem = get_current_key_system_getCurrentKeySystem(mediaElement);
49342
- if (shouldReloadMediaSourceOnDecipherabilityUpdate(keySystem)) {
49356
+ var keySystem = get_key_system_configuration_getKeySystemConfiguration(mediaElement);
49357
+ if (shouldReloadMediaSourceOnDecipherabilityUpdate(keySystem === null || keySystem === void 0 ? void 0 : keySystem[0])) {
49343
49358
  onReloadOrder(value);
49344
49359
  } else {
49345
49360
  // simple seek close to the current position
@@ -49740,7 +49755,7 @@ function checkReloadOptions(options) {
49740
49755
  * @returns {Object}
49741
49756
  */
49742
49757
  function parseLoadVideoOptions(options) {
49743
- var _a, _b, _c, _d, _e, _f, _g;
49758
+ var _a, _b, _c, _d, _e, _f, _g, _h;
49744
49759
  var url;
49745
49760
  var transport;
49746
49761
  var keySystems;
@@ -49768,6 +49783,9 @@ function parseLoadVideoOptions(options) {
49768
49783
  } else {
49769
49784
  transport = String(options.transport);
49770
49785
  }
49786
+ if (!(0,is_null_or_undefined/* default */.Z)((_c = options.transportOptions) === null || _c === void 0 ? void 0 : _c.aggressiveMode)) {
49787
+ (0,warn_once/* default */.Z)("`transportOptions.aggressiveMode` is deprecated and won't " + "be present in the next major version. " + "Please open an issue if you still need this.");
49788
+ }
49771
49789
  var autoPlay = (0,is_null_or_undefined/* default */.Z)(options.autoPlay) ? DEFAULT_AUTO_PLAY : !!options.autoPlay;
49772
49790
  if ((0,is_null_or_undefined/* default */.Z)(options.keySystems)) {
49773
49791
  keySystems = [];
@@ -49778,12 +49796,18 @@ function parseLoadVideoOptions(options) {
49778
49796
  if (typeof keySystem.type !== "string" || typeof keySystem.getLicense !== "function") {
49779
49797
  throw new Error("Invalid key system given: Missing type string or " + "getLicense callback");
49780
49798
  }
49799
+ if (!(0,is_null_or_undefined/* default */.Z)(keySystem.onKeyStatusesChange)) {
49800
+ (0,warn_once/* default */.Z)("`keySystems[].onKeyStatusesChange` is deprecated and won't " + "be present in the next major version. " + "Please open an issue if you still need this.");
49801
+ }
49802
+ if (!(0,is_null_or_undefined/* default */.Z)(keySystem.throwOnLicenseExpiration)) {
49803
+ (0,warn_once/* default */.Z)("`keySystems[].throwOnLicenseExpiration` is deprecated and won't " + "be present in the next major version. " + "Please open an issue if you still need this.");
49804
+ }
49781
49805
  }
49782
49806
  }
49783
49807
  var lowLatencyMode = options.lowLatencyMode === undefined ? false : !!options.lowLatencyMode;
49784
49808
  var transportOptsArg = typeof options.transportOptions === "object" && options.transportOptions !== null ? options.transportOptions : {};
49785
- var initialManifest = (_c = options.transportOptions) === null || _c === void 0 ? void 0 : _c.initialManifest;
49786
- var minimumManifestUpdateInterval = (_e = (_d = options.transportOptions) === null || _d === void 0 ? void 0 : _d.minimumManifestUpdateInterval) !== null && _e !== void 0 ? _e : 0;
49809
+ var initialManifest = (_d = options.transportOptions) === null || _d === void 0 ? void 0 : _d.initialManifest;
49810
+ var minimumManifestUpdateInterval = (_f = (_e = options.transportOptions) === null || _e === void 0 ? void 0 : _e.minimumManifestUpdateInterval) !== null && _f !== void 0 ? _f : 0;
49787
49811
  var audioTrackSwitchingMode = (0,is_null_or_undefined/* default */.Z)(options.audioTrackSwitchingMode) ? DEFAULT_AUDIO_TRACK_SWITCHING_MODE : options.audioTrackSwitchingMode;
49788
49812
  if (!(0,array_includes/* default */.Z)(["seamless", "direct", "reload"], audioTrackSwitchingMode)) {
49789
49813
  log/* default.warn */.Z.warn("The `audioTrackSwitchingMode` loadVideo option must match one of " + "the following strategy name:\n" + "- `seamless`\n" + "- `direct`\n" + "- `reload`\n" + "If badly set, " + DEFAULT_AUDIO_TRACK_SWITCHING_MODE + " strategy will be used as default");
@@ -49847,7 +49871,7 @@ function parseLoadVideoOptions(options) {
49847
49871
  (0,warn_once/* default */.Z)("The `hideNativeSubtitle` loadVideo option is deprecated");
49848
49872
  hideNativeSubtitle = !!options.hideNativeSubtitle;
49849
49873
  }
49850
- var manualBitrateSwitchingMode = (_f = options.manualBitrateSwitchingMode) !== null && _f !== void 0 ? _f : DEFAULT_MANUAL_BITRATE_SWITCHING_MODE;
49874
+ var manualBitrateSwitchingMode = (_g = options.manualBitrateSwitchingMode) !== null && _g !== void 0 ? _g : DEFAULT_MANUAL_BITRATE_SWITCHING_MODE;
49851
49875
  var enableFastSwitching = (0,is_null_or_undefined/* default */.Z)(options.enableFastSwitching) ? DEFAULT_ENABLE_FAST_SWITCHING : options.enableFastSwitching;
49852
49876
  if (textTrackMode === "html") {
49853
49877
  // TODO Better way to express that in TypeScript?
@@ -49872,7 +49896,7 @@ function parseLoadVideoOptions(options) {
49872
49896
  startAt = options.startAt;
49873
49897
  }
49874
49898
  }
49875
- var networkConfig = (_g = options.networkConfig) !== null && _g !== void 0 ? _g : {};
49899
+ var networkConfig = (_h = options.networkConfig) !== null && _h !== void 0 ? _h : {};
49876
49900
  // TODO without cast
49877
49901
  /* eslint-disable @typescript-eslint/consistent-type-assertions */
49878
49902
  return {
@@ -51802,7 +51826,7 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
51802
51826
  // Workaround to support Firefox autoplay on FF 42.
51803
51827
  // See: https://bugzilla.mozilla.org/show_bug.cgi?id=1194624
51804
51828
  videoElement.preload = "auto";
51805
- _this.version = /* PLAYER_VERSION */"3.30.0-dev.2023011800";
51829
+ _this.version = /* PLAYER_VERSION */"3.30.0-dev.2023020100";
51806
51830
  _this.log = log/* default */.Z;
51807
51831
  _this.state = "STOPPED";
51808
51832
  _this.videoElement = videoElement;
@@ -52555,6 +52579,7 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
52555
52579
  * @returns {Number}
52556
52580
  */;
52557
52581
  _proto.getVideoLoadedTime = function getVideoLoadedTime() {
52582
+ (0,warn_once/* default */.Z)("`getVideoLoadedTime` is deprecated and won't be present in the " + "next major version");
52558
52583
  if (this.videoElement === null) {
52559
52584
  throw new Error("Disposed player");
52560
52585
  }
@@ -52568,6 +52593,7 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
52568
52593
  * @returns {Number}
52569
52594
  */;
52570
52595
  _proto.getVideoPlayedTime = function getVideoPlayedTime() {
52596
+ (0,warn_once/* default */.Z)("`getVideoPlayedTime` is deprecated and won't be present in the " + "next major version");
52571
52597
  if (this.videoElement === null) {
52572
52598
  throw new Error("Disposed player");
52573
52599
  }
@@ -53105,13 +53131,36 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
53105
53131
  /**
53106
53132
  * Returns type of current keysystem (e.g. playready, widevine) if the content
53107
53133
  * is encrypted. null otherwise.
53134
+ * @deprecated
53108
53135
  * @returns {string|null}
53109
53136
  */;
53110
53137
  _proto.getCurrentKeySystem = function getCurrentKeySystem() {
53138
+ (0,warn_once/* default */.Z)("`getCurrentKeySystem` is deprecated." + "Please use the `getKeySystemConfiguration` method instead.");
53111
53139
  if (this.videoElement === null) {
53112
53140
  throw new Error("Disposed player");
53113
53141
  }
53114
- return get_current_key_system_getCurrentKeySystem(this.videoElement);
53142
+ return get_key_system_configuration_getCurrentKeySystem(this.videoElement);
53143
+ }
53144
+ /**
53145
+ * Returns both the name of the key system (e.g. `"com.widevine.alpha"`) and
53146
+ * the `MediaKeySystemConfiguration` currently associated to the
53147
+ * HTMLMediaElement linked to the RxPlayer.
53148
+ *
53149
+ * Returns `null` if no such capabilities is associated or if unknown.
53150
+ * @returns {Object|null}
53151
+ */;
53152
+ _proto.getKeySystemConfiguration = function getKeySystemConfiguration() {
53153
+ if (this.videoElement === null) {
53154
+ throw new Error("Disposed player");
53155
+ }
53156
+ var values = get_key_system_configuration_getKeySystemConfiguration(this.videoElement);
53157
+ if (values === null) {
53158
+ return null;
53159
+ }
53160
+ return {
53161
+ keySystem: values[0],
53162
+ configuration: values[1]
53163
+ };
53115
53164
  }
53116
53165
  /**
53117
53166
  * Returns every available audio tracks for the current Period.
@@ -54081,7 +54130,7 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
54081
54130
  }]);
54082
54131
  return Player;
54083
54132
  }(event_emitter/* default */.Z);
54084
- Player.version = /* PLAYER_VERSION */"3.30.0-dev.2023011800";
54133
+ Player.version = /* PLAYER_VERSION */"3.30.0-dev.2023020100";
54085
54134
  /* harmony default export */ var public_api = (Player);
54086
54135
  ;// CONCATENATED MODULE: ./src/core/api/index.ts
54087
54136
  /**