rx-player 3.27.0-dev.20220317 → 3.27.0-dev.2022032100

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 (121) hide show
  1. package/.eslintrc.js +0 -4
  2. package/CHANGELOG.md +3 -2
  3. package/VERSION +1 -1
  4. package/dist/_esm5.processed/compat/eme/close_session.js +1 -2
  5. package/dist/_esm5.processed/compat/eme/custom_key_system_access.d.ts +15 -0
  6. package/dist/_esm5.processed/compat/eme/custom_key_system_access.js +1 -17
  7. package/dist/_esm5.processed/compat/eme/custom_media_keys/ie11_media_keys.js +6 -7
  8. package/dist/_esm5.processed/compat/eme/custom_media_keys/index.js +3 -4
  9. package/dist/_esm5.processed/compat/eme/custom_media_keys/old_webkit_media_keys.js +6 -7
  10. package/dist/_esm5.processed/compat/eme/custom_media_keys/webkit_media_keys.js +7 -8
  11. package/dist/_esm5.processed/compat/eme/load_session.js +1 -2
  12. package/dist/_esm5.processed/core/api/option_utils.d.ts +3 -2
  13. package/dist/_esm5.processed/core/api/option_utils.js +2 -1
  14. package/dist/_esm5.processed/core/api/public_api.js +3 -4
  15. package/dist/_esm5.processed/core/decrypt/attach_media_keys.js +1 -2
  16. package/dist/_esm5.processed/core/decrypt/clear_on_stop.js +1 -2
  17. package/dist/_esm5.processed/core/decrypt/content_decryptor.js +1 -2
  18. package/dist/_esm5.processed/core/decrypt/create_session.js +1 -2
  19. package/dist/_esm5.processed/core/decrypt/find_key_system.js +1 -2
  20. package/dist/_esm5.processed/core/decrypt/utils/clean_old_loaded_sessions.js +1 -2
  21. package/dist/_esm5.processed/core/decrypt/utils/loaded_sessions_store.js +5 -6
  22. package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.js +1 -3
  23. package/dist/_esm5.processed/core/fetchers/utils/try_urls_with_backoff.js +2 -3
  24. package/dist/_esm5.processed/core/init/initialize_media_source.d.ts +2 -1
  25. package/dist/_esm5.processed/core/stream/index.d.ts +1 -0
  26. package/dist/_esm5.processed/core/stream/period/get_adaptation_switch_strategy.d.ts +15 -11
  27. package/dist/_esm5.processed/core/stream/period/get_adaptation_switch_strategy.js +5 -2
  28. package/dist/_esm5.processed/core/stream/period/index.d.ts +1 -0
  29. package/dist/_esm5.processed/core/stream/period/period_stream.d.ts +3 -11
  30. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/thumbnail_loader.js +5 -6
  31. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/api/index.js +2 -3
  32. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.d.ts +15 -0
  33. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.js +1 -2
  34. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/DRMInfos.js +2 -3
  35. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/HDCPPolicy.js +2 -3
  36. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/decodingInfo.js +1 -2
  37. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/mediaContentType.js +1 -2
  38. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/mediaContentTypeWithFeatures/index.js +1 -2
  39. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/mediaDisplayInfos.js +1 -2
  40. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/dash-wasm-parser.js +4 -5
  41. package/dist/_esm5.processed/public_types.d.ts +1 -0
  42. package/dist/_esm5.processed/transports/dash/add_segment_integrity_checks_to_loader.js +1 -2
  43. package/dist/_esm5.processed/transports/dash/image_pipelines.d.ts +4 -3
  44. package/dist/_esm5.processed/transports/dash/image_pipelines.js +57 -11
  45. package/dist/_esm5.processed/transports/dash/init_segment_loader.js +1 -2
  46. package/dist/_esm5.processed/transports/dash/manifest_parser.js +2 -3
  47. package/dist/_esm5.processed/transports/dash/segment_loader.d.ts +1 -1
  48. package/dist/_esm5.processed/transports/dash/segment_loader.js +3 -4
  49. package/dist/_esm5.processed/transports/dash/text_loader.js +1 -2
  50. package/dist/_esm5.processed/transports/local/segment_loader.js +2 -3
  51. package/dist/_esm5.processed/transports/metaplaylist/pipelines.js +2 -3
  52. package/dist/_esm5.processed/transports/smooth/pipelines.js +3 -4
  53. package/dist/_esm5.processed/transports/smooth/segment_loader.js +3 -4
  54. package/dist/_esm5.processed/transports/utils/call_custom_manifest_loader.js +1 -2
  55. package/dist/_esm5.processed/utils/cancellable_sleep.js +1 -2
  56. package/dist/_esm5.processed/utils/cast_to_observable.js +1 -3
  57. package/dist/_esm5.processed/utils/request/xhr.js +1 -2
  58. package/dist/rx-player.js +128 -501
  59. package/dist/rx-player.min.js +1 -1
  60. package/package.json +1 -2
  61. package/scripts/update-version +2 -2
  62. package/sonar-project.properties +1 -1
  63. package/src/compat/__tests__/play.test.ts +2 -4
  64. package/src/compat/eme/close_session.ts +1 -2
  65. package/src/compat/eme/custom_key_system_access.ts +1 -2
  66. package/src/compat/eme/custom_media_keys/ie11_media_keys.ts +6 -7
  67. package/src/compat/eme/custom_media_keys/index.ts +3 -4
  68. package/src/compat/eme/custom_media_keys/old_webkit_media_keys.ts +6 -7
  69. package/src/compat/eme/custom_media_keys/webkit_media_keys.ts +7 -8
  70. package/src/compat/eme/load_session.ts +1 -2
  71. package/src/core/api/__tests__/option_utils.test.ts +12 -0
  72. package/src/core/api/option_utils.ts +5 -3
  73. package/src/core/api/public_api.ts +3 -4
  74. package/src/core/decrypt/attach_media_keys.ts +1 -2
  75. package/src/core/decrypt/clear_on_stop.ts +1 -2
  76. package/src/core/decrypt/content_decryptor.ts +1 -2
  77. package/src/core/decrypt/create_session.ts +2 -3
  78. package/src/core/decrypt/find_key_system.ts +1 -2
  79. package/src/core/decrypt/utils/clean_old_loaded_sessions.ts +1 -2
  80. package/src/core/decrypt/utils/loaded_sessions_store.ts +5 -6
  81. package/src/core/fetchers/manifest/manifest_fetcher.ts +1 -3
  82. package/src/core/fetchers/utils/try_urls_with_backoff.ts +2 -3
  83. package/src/core/init/initialize_media_source.ts +2 -1
  84. package/src/core/stream/index.ts +1 -0
  85. package/src/core/stream/period/get_adaptation_switch_strategy.ts +24 -14
  86. package/src/core/stream/period/index.ts +1 -0
  87. package/src/core/stream/period/period_stream.ts +5 -14
  88. package/src/experimental/tools/VideoThumbnailLoader/thumbnail_loader.ts +5 -6
  89. package/src/experimental/tools/mediaCapabilitiesProber/__tests__/probers/HDCPPolicy.test.ts +5 -6
  90. package/src/experimental/tools/mediaCapabilitiesProber/__tests__/probers/decodingInfos.test.ts +2 -4
  91. package/src/experimental/tools/mediaCapabilitiesProber/api/index.ts +2 -3
  92. package/src/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.ts +1 -2
  93. package/src/experimental/tools/mediaCapabilitiesProber/probers/DRMInfos.ts +2 -3
  94. package/src/experimental/tools/mediaCapabilitiesProber/probers/HDCPPolicy.ts +2 -3
  95. package/src/experimental/tools/mediaCapabilitiesProber/probers/decodingInfo.ts +1 -2
  96. package/src/experimental/tools/mediaCapabilitiesProber/probers/mediaContentType.ts +1 -2
  97. package/src/experimental/tools/mediaCapabilitiesProber/probers/mediaContentTypeWithFeatures/index.ts +1 -2
  98. package/src/experimental/tools/mediaCapabilitiesProber/probers/mediaDisplayInfos.ts +1 -2
  99. package/src/parsers/manifest/dash/wasm-parser/ts/dash-wasm-parser.ts +4 -5
  100. package/src/public_types.ts +1 -0
  101. package/src/transports/dash/add_segment_integrity_checks_to_loader.ts +1 -2
  102. package/src/transports/dash/image_pipelines.ts +12 -14
  103. package/src/transports/dash/init_segment_loader.ts +1 -2
  104. package/src/transports/dash/manifest_parser.ts +2 -3
  105. package/src/transports/dash/segment_loader.ts +4 -5
  106. package/src/transports/dash/text_loader.ts +2 -3
  107. package/src/transports/local/segment_loader.ts +2 -3
  108. package/src/transports/metaplaylist/pipelines.ts +2 -3
  109. package/src/transports/smooth/pipelines.ts +4 -5
  110. package/src/transports/smooth/segment_loader.ts +5 -6
  111. package/src/transports/utils/call_custom_manifest_loader.ts +1 -2
  112. package/src/utils/cancellable_sleep.ts +1 -2
  113. package/src/utils/cast_to_observable.ts +0 -2
  114. package/src/utils/request/xhr.ts +1 -2
  115. package/tsconfig.json +0 -1
  116. package/tsconfig.modules.json +0 -1
  117. package/dist/_esm5.processed/utils/promise.d.ts +0 -17
  118. package/dist/_esm5.processed/utils/promise.js +0 -18
  119. package/src/typings/pinkie.d.ts +0 -19
  120. package/src/utils/__tests__/promise.test.ts +0 -23
  121. package/src/utils/promise.ts +0 -20
@@ -35,20 +35,24 @@ export declare type IAdaptationSwitchStrategy = {
35
35
  value: undefined;
36
36
  };
37
37
  export interface IAdaptationSwitchOptions {
38
- /**
39
- * Strategy to adopt when manually switching of audio adaptation.
40
- * Can be either:
41
- * - "seamless": transitions are smooth but could be not immediate.
42
- * - "direct": strategy will be "smart", if the mimetype and the codec,
43
- * change, we will perform a hard reload of the media source, however, if it
44
- * doesn't change, we will just perform a small flush by removing buffered range
45
- * and performing, a small seek on the media element.
46
- * Transitions are faster, but, we could see appear a reloading or seeking state.
47
- */
48
- audioTrackSwitchingMode: "seamless" | "direct";
38
+ /** RxPlayer's behavior when switching the audio track. */
39
+ audioTrackSwitchingMode: IAudioTrackSwitchingMode;
49
40
  /** Behavior when a new video and/or audio codec is encountered. */
50
41
  onCodecSwitch: "continue" | "reload";
51
42
  }
43
+ /**
44
+ * Strategy to adopt when manually switching of audio adaptation.
45
+ * Can be either:
46
+ * - "seamless": transitions are smooth but could be not immediate.
47
+ * - "direct": strategy will be "smart", if the mimetype and the codec,
48
+ * change, we will perform a hard reload of the media source, however, if it
49
+ * doesn't change, we will just perform a small flush by removing buffered range
50
+ * and performing, a small seek on the media element.
51
+ * Transitions are faster, but, we could see appear a BUFFERING state.
52
+ * - "reload": completely reload the content. This allows a direct switch
53
+ * compatible with most device but may necessitate a RELOADING phase.
54
+ */
55
+ export declare type IAudioTrackSwitchingMode = "seamless" | "direct" | "reload";
52
56
  /**
53
57
  * Find out what to do when switching Adaptation, based on the current
54
58
  * situation.
@@ -62,7 +62,10 @@ export default function getAdaptationSwitchStrategy(segmentBuffer, period, adapt
62
62
  return { type: "continue", value: undefined };
63
63
  }
64
64
  var currentTime = playbackInfo.currentTime;
65
- if (adaptation.type === "video" &&
65
+ var audioTrackSwitchingMode = options.audioTrackSwitchingMode;
66
+ var hasReloadSwitchingMode = adaptation.type === "video" ||
67
+ (adaptation.type === "audio" && audioTrackSwitchingMode === "reload");
68
+ if (hasReloadSwitchingMode &&
66
69
  // We're playing the current Period
67
70
  isTimeInRange({ start: start, end: end }, currentTime) &&
68
71
  // There is data for the current position or the codecs are differents
@@ -74,7 +77,7 @@ export default function getAdaptationSwitchStrategy(segmentBuffer, period, adapt
74
77
  }
75
78
  // From here, clean-up data from the previous Adaptation, if one
76
79
  var shouldFlush = adaptation.type === "audio" &&
77
- options.audioTrackSwitchingMode === "direct";
80
+ audioTrackSwitchingMode === "direct";
78
81
  var rangesToExclude = [];
79
82
  // First, we don't want to accidentally remove some segments from the previous
80
83
  // Period (which overlap a little with this one)
@@ -14,5 +14,6 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import PeriodStream, { IPeriodStreamArguments, IPeriodStreamOptions, IPeriodStreamPlaybackObservation } from "./period_stream";
17
+ export { IAudioTrackSwitchingMode } from "./get_adaptation_switch_strategy";
17
18
  export default PeriodStream;
18
19
  export { IPeriodStreamArguments, IPeriodStreamOptions, IPeriodStreamPlaybackObservation, };
@@ -23,6 +23,7 @@ import { SegmentFetcherCreator } from "../../fetchers";
23
23
  import SegmentBuffersStore, { IBufferType, ITextTrackSegmentBufferOptions, SegmentBuffer } from "../../segment_buffers";
24
24
  import { IAdaptationStreamOptions } from "../adaptation";
25
25
  import { IPeriodStreamEvent } from "../types";
26
+ import { IAudioTrackSwitchingMode } from "./get_adaptation_switch_strategy";
26
27
  /** Playback observation required by the `PeriodStream`. */
27
28
  export interface IPeriodStreamPlaybackObservation {
28
29
  /** The position we are in the video in seconds at the time of the observation. */
@@ -64,17 +65,8 @@ export interface IPeriodStreamArguments {
64
65
  }
65
66
  /** Options tweaking the behavior of the PeriodStream. */
66
67
  export declare type IPeriodStreamOptions = IAdaptationStreamOptions & {
67
- /**
68
- * Strategy to adopt when manually switching of audio adaptation.
69
- * Can be either:
70
- * - "seamless": transitions are smooth but could be not immediate.
71
- * - "direct": strategy will be "smart", if the mimetype and the codec,
72
- * change, we will perform a hard reload of the media source, however, if it
73
- * doesn't change, we will just perform a small flush by removing buffered range
74
- * and performing, a small seek on the media element.
75
- * Transitions are faster, but, we could see appear a reloading or seeking state.
76
- */
77
- audioTrackSwitchingMode: "seamless" | "direct";
68
+ /** RxPlayer's behavior when switching the audio track. */
69
+ audioTrackSwitchingMode: IAudioTrackSwitchingMode;
78
70
  /** Behavior when a new video and/or audio codec is encountered. */
79
71
  onCodecSwitch: "continue" | "reload";
80
72
  /** Options specific to the text SegmentBuffer. */
@@ -17,7 +17,6 @@ import { catchError, combineLatest, finalize, ignoreElements, lastValueFrom, map
17
17
  import createSegmentFetcher from "../../../core/fetchers/segment/segment_fetcher";
18
18
  import log from "../../../log";
19
19
  import objectAssign from "../../../utils/object_assign";
20
- import PPromise from "../../../utils/promise";
21
20
  import { freeRequest } from "./create_request";
22
21
  import getCompleteSegmentId from "./get_complete_segment_id";
23
22
  import getContentInfos from "./get_content_infos";
@@ -68,16 +67,16 @@ var VideoThumbnailLoader = /** @class */ (function () {
68
67
  }
69
68
  var manifest = this._player.getManifest();
70
69
  if (manifest === null) {
71
- return PPromise.reject(new VideoThumbnailLoaderError("NO_MANIFEST", "No manifest available."));
70
+ return Promise.reject(new VideoThumbnailLoaderError("NO_MANIFEST", "No manifest available."));
72
71
  }
73
72
  var contentInfos = getContentInfos(time, manifest);
74
73
  if (contentInfos === null) {
75
- return PPromise.reject(new VideoThumbnailLoaderError("NO_TRACK", "Couldn't find track for this time."));
74
+ return Promise.reject(new VideoThumbnailLoaderError("NO_TRACK", "Couldn't find track for this time."));
76
75
  }
77
76
  var segments = contentInfos
78
77
  .representation.index.getSegments(time, MIN_NEEDED_DATA_AFTER_TIME);
79
78
  if (segments.length === 0) {
80
- return PPromise.reject(new VideoThumbnailLoaderError("NO_THUMBNAIL", "Couldn't find thumbnail for the given time."));
79
+ return Promise.reject(new VideoThumbnailLoaderError("NO_THUMBNAIL", "Couldn't find thumbnail for the given time."));
81
80
  }
82
81
  for (var j = 0; j < segments.length; j++) {
83
82
  var _a = segments[j], stime = _a.time, duration = _a.duration, timescale = _a.timescale;
@@ -95,7 +94,7 @@ var VideoThumbnailLoader = /** @class */ (function () {
95
94
  if (segments.length === 0) {
96
95
  this._videoElement.currentTime = time;
97
96
  log.debug("VTL: Thumbnails already loaded.", time);
98
- return PPromise.resolve(time);
97
+ return Promise.resolve(time);
99
98
  }
100
99
  log.debug("VTL: Found thumbnail for time", time, segments);
101
100
  if (this._currentTask !== undefined) {
@@ -132,7 +131,7 @@ var VideoThumbnailLoader = /** @class */ (function () {
132
131
  var error = new VideoThumbnailLoaderError("NO_LOADER", "VideoThumbnailLoaderError: No " +
133
132
  "imported loader for this transport type: " +
134
133
  contentInfos.manifest.transport);
135
- return PPromise.reject(error);
134
+ return Promise.reject(error);
136
135
  }
137
136
  var killTask$ = new Subject();
138
137
  var abortError$ = killTask$.pipe(map(function () {
@@ -14,7 +14,6 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import arrayFind from "../../../../utils/array_find";
17
- import PPromise from "../../../../utils/promise";
18
17
  import log from "../log";
19
18
  import { ProberStatus, } from "../types";
20
19
  import probeMediaConfiguration from "./probeMediaConfiguration";
@@ -65,7 +64,7 @@ var mediaCapabilitiesProber = {
65
64
  */
66
65
  getStatusForHDCP: function (hdcp) {
67
66
  if (hdcp === undefined || hdcp.length === 0) {
68
- return PPromise.reject("MediaCapabilitiesProbers >>> Bad Arguments: " +
67
+ return Promise.reject("MediaCapabilitiesProbers >>> Bad Arguments: " +
69
68
  "No HDCP Policy specified.");
70
69
  }
71
70
  var config = {
@@ -125,7 +124,7 @@ var mediaCapabilitiesProber = {
125
124
  return { globalStatus: ProberStatus.NotSupported };
126
125
  }));
127
126
  });
128
- return PPromise.all(promises)
127
+ return Promise.all(promises)
129
128
  .then(function (configs) {
130
129
  // TODO I added those lines to work-around a type issue but does it
131
130
  // really correspond to the original intent? I find it hard to
@@ -1,3 +1,18 @@
1
+ /**
2
+ * Copyright 2015 CANAL+ Group
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
1
16
  import { ICapabilitiesTypes } from "../capabilities";
2
17
  import { IResultsFromAPI } from "../probers";
3
18
  import { IMediaConfiguration, ProberStatus } from "../types";
@@ -13,7 +13,6 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import PPromise from "../../../../utils/promise";
17
16
  import getProbedConfiguration from "../capabilities";
18
17
  import log from "../log";
19
18
  import probers from "../probers";
@@ -79,7 +78,7 @@ function probeMediaConfiguration(config, browserAPIS) {
79
78
  var browserAPI = browserAPIS_1[_i];
80
79
  _loop_1(browserAPI);
81
80
  }
82
- return PPromise.all(promises).then(function () {
81
+ return Promise.all(promises).then(function () {
83
82
  if (globalStatus === undefined) {
84
83
  globalStatus = ProberStatus.Unknown;
85
84
  }
@@ -14,7 +14,6 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { requestMediaKeySystemAccess } from "../../../../compat";
17
- import PPromise from "../../../../utils/promise";
18
17
  import log from "../log";
19
18
  import { ProberStatus, } from "../types";
20
19
  /**
@@ -24,7 +23,7 @@ import { ProberStatus, } from "../types";
24
23
  export default function probeDRMInfos(mediaConfig) {
25
24
  var keySystem = mediaConfig.keySystem;
26
25
  if (keySystem == null || keySystem.type == null) {
27
- return PPromise.reject("MediaCapabilitiesProber >>> API_CALL: " +
26
+ return Promise.reject("MediaCapabilitiesProber >>> API_CALL: " +
28
27
  "Missing a type argument to request a media key system access.");
29
28
  }
30
29
  var type = keySystem.type;
@@ -36,7 +35,7 @@ export default function probeDRMInfos(mediaConfig) {
36
35
  "Your browser has no API to request a media key system access.");
37
36
  // In that case, the API lack means that no EME workflow may be started.
38
37
  // So, the DRM configuration is not supported.
39
- return PPromise.resolve([ProberStatus.NotSupported, result]);
38
+ return Promise.resolve([ProberStatus.NotSupported, result]);
40
39
  }
41
40
  return requestMediaKeySystemAccess(type, [configuration])
42
41
  .then(function (keySystemAccess) {
@@ -14,7 +14,6 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { requestMediaKeySystemAccess } from "../../../../compat";
17
- import PPromise from "../../../../utils/promise";
18
17
  import { ProberStatus, } from "../types";
19
18
  /**
20
19
  * @param {Object} config
@@ -22,11 +21,11 @@ import { ProberStatus, } from "../types";
22
21
  */
23
22
  export default function probeHDCPPolicy(config) {
24
23
  if (requestMediaKeySystemAccess == null) {
25
- return PPromise.reject("MediaCapabilitiesProber >>> API_CALL: " +
24
+ return Promise.reject("MediaCapabilitiesProber >>> API_CALL: " +
26
25
  "API not available");
27
26
  }
28
27
  if (config.hdcp == null) {
29
- return PPromise.reject("MediaCapabilitiesProber >>> API_CALL: " +
28
+ return Promise.reject("MediaCapabilitiesProber >>> API_CALL: " +
30
29
  "Missing policy argument for calling getStatusForPolicy.");
31
30
  }
32
31
  var hdcp = "hdcp-" + config.hdcp;
@@ -13,14 +13,13 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import PPromise from "../../../../utils/promise";
17
16
  import { ProberStatus, } from "../types";
18
17
  /**
19
18
  * Check if the required APIs are available.
20
19
  * @returns {Promise}
21
20
  */
22
21
  function isMediaCapabilitiesAPIAvailable() {
23
- return new PPromise(function (resolve) {
22
+ return new Promise(function (resolve) {
24
23
  if (!("mediaCapabilities" in navigator)) {
25
24
  throw new Error("MediaCapabilitiesProber >>> API_CALL: " +
26
25
  "MediaCapabilities API not available");
@@ -14,14 +14,13 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { MediaSource_ } from "../../../../compat";
17
- import PPromise from "../../../../utils/promise";
18
17
  import { ProberStatus, } from "../types";
19
18
  /**
20
19
  * @param {Object} config
21
20
  * @returns {Promise}
22
21
  */
23
22
  export default function probeContentType(config) {
24
- return new PPromise(function (resolve) {
23
+ return new Promise(function (resolve) {
25
24
  if (MediaSource_ == null) {
26
25
  throw new Error("MediaCapabilitiesProber >>> API_CALL: " +
27
26
  "MediaSource API not available");
@@ -13,14 +13,13 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import PPromise from "../../../../../utils/promise";
17
16
  import { ProberStatus, } from "../../types";
18
17
  import formatConfig from "./format";
19
18
  /**
20
19
  * @returns {Promise}
21
20
  */
22
21
  function isTypeSupportedWithFeaturesAPIAvailable() {
23
- return new PPromise(function (resolve) {
22
+ return new Promise(function (resolve) {
24
23
  if (!("MSMediaKeys" in window)) {
25
24
  throw new Error("MediaCapabilitiesProber >>> API_CALL: " +
26
25
  "MSMediaKeys API not available");
@@ -13,14 +13,13 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import PPromise from "../../../../utils/promise";
17
16
  import { ProberStatus, } from "../types";
18
17
  /**
19
18
  * @param {Object} config
20
19
  * @returns {Promise}
21
20
  */
22
21
  export default function probeMatchMedia(config) {
23
- return new PPromise(function (resolve) {
22
+ return new Promise(function (resolve) {
24
23
  /* eslint-disable @typescript-eslint/unbound-method */
25
24
  if (typeof window.matchMedia !== "function") {
26
25
  /* eslint-enable @typescript-eslint/unbound-method */
@@ -52,7 +52,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
52
52
  import log from "../../../../../log";
53
53
  import assertUnreachable from "../../../../../utils/assert_unreachable";
54
54
  import noop from "../../../../../utils/noop";
55
- import PPromise from "../../../../../utils/promise";
56
55
  import parseMpdIr from "../../common";
57
56
  import { generateRootChildrenParser } from "./generators";
58
57
  import { generateXLinkChildrenParser } from "./generators/XLink";
@@ -86,7 +85,7 @@ var DashWasmParser = /** @class */ (function () {
86
85
  */
87
86
  DashWasmParser.prototype.waitForInitialization = function () {
88
87
  var _a;
89
- return (_a = this._initProm) !== null && _a !== void 0 ? _a : PPromise.reject("No initialization performed yet.");
88
+ return (_a = this._initProm) !== null && _a !== void 0 ? _a : Promise.reject("No initialization performed yet.");
90
89
  };
91
90
  DashWasmParser.prototype.initialize = function (opts) {
92
91
  return __awaiter(this, void 0, void 0, function () {
@@ -175,11 +174,11 @@ var DashWasmParser = /** @class */ (function () {
175
174
  var _this = this;
176
175
  return __generator(this, function (_a) {
177
176
  if (this.status !== "uninitialized") {
178
- return [2 /*return*/, PPromise.reject(new Error("DashWasmParser already initialized."))];
177
+ return [2 /*return*/, Promise.reject(new Error("DashWasmParser already initialized."))];
179
178
  }
180
179
  else if (!this.isCompatible()) {
181
180
  this.status = "failure";
182
- return [2 /*return*/, PPromise.reject(new Error("Target not compatible with WebAssembly."))];
181
+ return [2 /*return*/, Promise.reject(new Error("Target not compatible with WebAssembly."))];
183
182
  }
184
183
  this.status = "initializing";
185
184
  parsersStack = this._parsersStack;
@@ -201,7 +200,7 @@ var DashWasmParser = /** @class */ (function () {
201
200
  fetchedWasm = fetch(opts.wasmUrl);
202
201
  streamingProm = typeof WebAssembly.instantiateStreaming === "function" ?
203
202
  WebAssembly.instantiateStreaming(fetchedWasm, imports) :
204
- PPromise.reject("`WebAssembly.instantiateStreaming` API not available");
203
+ Promise.reject("`WebAssembly.instantiateStreaming` API not available");
205
204
  this._initProm = streamingProm
206
205
  .catch(function (e) { return __awaiter(_this, void 0, void 0, function () {
207
206
  var res, resAb;
@@ -19,6 +19,7 @@
19
19
  */
20
20
  export { IConstructorOptions, ILoadVideoOptions, ITransportOptions, IKeySystemOption, ISupplementaryTextTrackOption, ISupplementaryImageTrackOption, IDefaultAudioTrackOption, IDefaultTextTrackOption, INetworkConfigOption, IStartAtOption, ITMAudioTrackListItem as IAvailableAudioTrack, ITMTextTrackListItem as IAvailableTextTrack, ITMVideoTrackListItem as IAvailableVideoTrack, ITMAudioTrack as IAudioTrack, ITMTextTrack as ITextTrack, ITMVideoTrack as IVideoTrack, IAudioTrackPreference, ITextTrackPreference, IVideoTrackPreference, IBitrateEstimate, IPositionUpdateItem as IPositionUpdate, IPlayerState, IStreamEvent, IStreamEventData, } from "./core/api";
21
21
  export { IPersistentSessionInfo, IPersistentSessionStorage, } from "./core/decrypt";
22
+ export { IAudioTrackSwitchingMode } from "./core/stream";
22
23
  export { ICustomError as IPlayerError } from "./errors";
23
24
  export { IExposedAdaptation as IAdaptation, IExposedManifest as IManifest, IExposedPeriod as IPeriod, IExposedRepresentation as IRepresentation, IExposedSegment as ISegment, IRepresentationFilter, IRepresentationInfos, } from "./manifest";
24
25
  export { ICustomSegmentLoader as ISegmentLoader, ICustomManifestLoader as IManifestLoader, } from "./transports";
@@ -24,7 +24,6 @@ var __assign = (this && this.__assign) || function () {
24
24
  };
25
25
  return __assign.apply(this, arguments);
26
26
  };
27
- import PPromise from "../../utils/promise";
28
27
  import TaskCanceller from "../../utils/task_canceller";
29
28
  import checkISOBMFFIntegrity from "../utils/check_isobmff_integrity";
30
29
  import inferSegmentContainer from "../utils/infer_segment_container";
@@ -37,7 +36,7 @@ import inferSegmentContainer from "../utils/infer_segment_container";
37
36
  */
38
37
  export default function addSegmentIntegrityChecks(segmentLoader) {
39
38
  return function (url, content, initialCancelSignal, callbacks) {
40
- return new PPromise(function (res, rej) {
39
+ return new Promise(function (res, rej) {
41
40
  var canceller = new TaskCanceller();
42
41
  var unregisterCancelLstnr = initialCancelSignal
43
42
  .register(function onCheckCancellation(err) {
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { CancellationSignal } from "../../utils/task_canceller";
17
- import { IImageTrackSegmentData, ILoadedImageSegmentFormat, ISegmentContext, ISegmentLoaderCallbacks, ISegmentLoaderResultChunkedComplete, ISegmentLoaderResultSegmentCreated, ISegmentLoaderResultSegmentLoaded, ISegmentParserParsedInitChunk, ISegmentParserParsedMediaChunk } from "../types";
17
+ import { IImageTrackSegmentData, ILoadedImageSegmentFormat, ISegmentContext, ISegmentLoaderCallbacks, ISegmentLoaderResultSegmentCreated, ISegmentLoaderResultSegmentLoaded, ISegmentParserParsedInitChunk, ISegmentParserParsedMediaChunk } from "../types";
18
18
  /**
19
19
  * Loads an image segment.
20
20
  * @param {string|null} url
@@ -23,10 +23,11 @@ import { IImageTrackSegmentData, ILoadedImageSegmentFormat, ISegmentContext, ISe
23
23
  * @param {Object} callbacks
24
24
  * @returns {Promise}
25
25
  */
26
- export declare function imageLoader(url: string | null, content: ISegmentContext, cancelSignal: CancellationSignal, callbacks: ISegmentLoaderCallbacks<ILoadedImageSegmentFormat>): Promise<ISegmentLoaderResultSegmentLoaded<ILoadedImageSegmentFormat> | ISegmentLoaderResultSegmentCreated<ILoadedImageSegmentFormat> | ISegmentLoaderResultChunkedComplete>;
26
+ export declare function imageLoader(url: string | null, content: ISegmentContext, cancelSignal: CancellationSignal, callbacks: ISegmentLoaderCallbacks<ILoadedImageSegmentFormat>): Promise<ISegmentLoaderResultSegmentLoaded<ILoadedImageSegmentFormat> | ISegmentLoaderResultSegmentCreated<ILoadedImageSegmentFormat>>;
27
27
  /**
28
28
  * Parses an image segment.
29
- * @param {Object} args
29
+ * @param {Object} loadedSegment
30
+ * @param {Object} content
30
31
  * @returns {Object}
31
32
  */
32
33
  export declare function imageParser(loadedSegment: {
@@ -13,8 +13,43 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
17
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
18
+ return new (P || (P = Promise))(function (resolve, reject) {
19
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
20
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
21
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
22
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
23
+ });
24
+ };
25
+ var __generator = (this && this.__generator) || function (thisArg, body) {
26
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
27
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
28
+ function verb(n) { return function (v) { return step([n, v]); }; }
29
+ function step(op) {
30
+ if (f) throw new TypeError("Generator is already executing.");
31
+ while (_) try {
32
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
33
+ if (y = 0, t) op = [op[0] & 2, t.value];
34
+ switch (op[0]) {
35
+ case 0: case 1: t = op; break;
36
+ case 4: _.label++; return { value: op[1], done: false };
37
+ case 5: _.label++; y = op[1]; op = [0]; continue;
38
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
39
+ default:
40
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
41
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
42
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
43
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
44
+ if (t[2]) _.ops.pop();
45
+ _.trys.pop(); continue;
46
+ }
47
+ op = body.call(thisArg, _);
48
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
49
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
50
+ }
51
+ };
16
52
  import features from "../../features";
17
- import PPromise from "../../utils/promise";
18
53
  import request from "../../utils/request";
19
54
  import takeFirstSet from "../../utils/take_first_set";
20
55
  /**
@@ -26,19 +61,30 @@ import takeFirstSet from "../../utils/take_first_set";
26
61
  * @returns {Promise}
27
62
  */
28
63
  export function imageLoader(url, content, cancelSignal, callbacks) {
29
- var segment = content.segment;
30
- if (segment.isInit || url === null) {
31
- return PPromise.resolve({ resultType: "segment-created",
32
- resultData: null });
33
- }
34
- return request({ url: url, responseType: "arraybuffer",
35
- onProgress: callbacks.onProgress, cancelSignal: cancelSignal })
36
- .then(function (data) { return ({ resultType: "segment-loaded",
37
- resultData: data }); });
64
+ return __awaiter(this, void 0, void 0, function () {
65
+ var segment, data;
66
+ return __generator(this, function (_a) {
67
+ switch (_a.label) {
68
+ case 0:
69
+ segment = content.segment;
70
+ if (segment.isInit || url === null) {
71
+ return [2 /*return*/, { resultType: "segment-created",
72
+ resultData: null }];
73
+ }
74
+ return [4 /*yield*/, request({ url: url, responseType: "arraybuffer",
75
+ onProgress: callbacks.onProgress, cancelSignal: cancelSignal })];
76
+ case 1:
77
+ data = _a.sent();
78
+ return [2 /*return*/, { resultType: "segment-loaded",
79
+ resultData: data }];
80
+ }
81
+ });
82
+ });
38
83
  }
39
84
  /**
40
85
  * Parses an image segment.
41
- * @param {Object} args
86
+ * @param {Object} loadedSegment
87
+ * @param {Object} content
42
88
  * @returns {Object}
43
89
  */
44
90
  export function imageParser(loadedSegment, content) {
@@ -14,7 +14,6 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { concat } from "../../utils/byte_parsing";
17
- import PPromise from "../../utils/promise";
18
17
  import request from "../../utils/request";
19
18
  import byteRange from "../utils/byte_range";
20
19
  /**
@@ -49,7 +48,7 @@ export default function initSegmentLoader(url, segment, cancelSignal, callbacks)
49
48
  responseType: "arraybuffer", cancelSignal: cancelSignal, onProgress: callbacks.onProgress });
50
49
  var indexRequest$ = request({ url: url, headers: { Range: byteRange(segment.indexRange) },
51
50
  responseType: "arraybuffer", cancelSignal: cancelSignal, onProgress: callbacks.onProgress });
52
- return PPromise.all([rangeRequest$, indexRequest$])
51
+ return Promise.all([rangeRequest$, indexRequest$])
53
52
  .then(function (_a) {
54
53
  var initData = _a[0], indexData = _a[1];
55
54
  var data = concat(new Uint8Array(initData.responseData), new Uint8Array(indexData.responseData));
@@ -18,7 +18,6 @@ import features from "../../features";
18
18
  import log from "../../log";
19
19
  import Manifest from "../../manifest";
20
20
  import objectAssign from "../../utils/object_assign";
21
- import PPromise from "../../utils/promise";
22
21
  import request from "../../utils/request";
23
22
  import { strToUtf8, utf8ToStr, } from "../../utils/string_parsing";
24
23
  export default function generateManifestParser(options) {
@@ -98,7 +97,7 @@ export default function generateManifestParser(options) {
98
97
  onWarnings(parserResponse.value.warnings);
99
98
  }
100
99
  if (cancelSignal.isCancelled) {
101
- return PPromise.reject(cancelSignal.cancellationError);
100
+ return Promise.reject(cancelSignal.cancellationError);
102
101
  }
103
102
  var manifest = new Manifest(parserResponse.value.parsed, options);
104
103
  return { manifest: manifest, url: url };
@@ -148,7 +147,7 @@ export default function generateManifestParser(options) {
148
147
  });
149
148
  });
150
149
  });
151
- return PPromise.all(externalResources).then(function (loadedResources) {
150
+ return Promise.all(externalResources).then(function (loadedResources) {
152
151
  if (value.format === "string") {
153
152
  assertLoadedResourcesFormatString(loadedResources);
154
153
  return processMpdParserResponse(value.continue(loadedResources));
@@ -17,7 +17,7 @@ import { CancellationSignal } from "../../utils/task_canceller";
17
17
  import { ICustomSegmentLoader, ILoadedAudioVideoSegmentFormat, ISegmentContext, ISegmentLoader, ISegmentLoaderCallbacks, ISegmentLoaderResultChunkedComplete, ISegmentLoaderResultSegmentCreated, ISegmentLoaderResultSegmentLoaded } from "../types";
18
18
  /**
19
19
  * Segment loader triggered if there was no custom-defined one in the API.
20
- * @param {string} uri
20
+ * @param {string} url
21
21
  * @param {Object} content
22
22
  * @param {boolean} lowLatencyMode
23
23
  * @param {Object} callbacks
@@ -14,7 +14,6 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { CustomLoaderError } from "../../errors";
17
- import PPromise from "../../utils/promise";
18
17
  import request, { fetchIsSupported, } from "../../utils/request";
19
18
  import warnOnce from "../../utils/warn_once";
20
19
  import byteRange from "../utils/byte_range";
@@ -24,7 +23,7 @@ import initSegmentLoader from "./init_segment_loader";
24
23
  import lowLatencySegmentLoader from "./low_latency_segment_loader";
25
24
  /**
26
25
  * Segment loader triggered if there was no custom-defined one in the API.
27
- * @param {string} uri
26
+ * @param {string} url
28
27
  * @param {Object} content
29
28
  * @param {boolean} lowLatencyMode
30
29
  * @param {Object} callbacks
@@ -67,7 +66,7 @@ export default function generateSegmentLoader(_a) {
67
66
  */
68
67
  function segmentLoader(url, content, cancelSignal, callbacks) {
69
68
  if (url == null) {
70
- return PPromise.resolve({ resultType: "segment-created",
69
+ return Promise.resolve({ resultType: "segment-created",
71
70
  resultData: null });
72
71
  }
73
72
  if (lowLatencyMode || customSegmentLoader === undefined) {
@@ -79,7 +78,7 @@ export default function generateSegmentLoader(_a) {
79
78
  representation: content.representation,
80
79
  segment: content.segment,
81
80
  transport: "dash", url: url };
82
- return new PPromise(function (res, rej) {
81
+ return new Promise(function (res, rej) {
83
82
  /** `true` when the custom segmentLoader should not be active anymore. */
84
83
  var hasFinished = false;
85
84
  /**
@@ -13,7 +13,6 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import PPromise from "../../utils/promise";
17
16
  import request, { fetchIsSupported, } from "../../utils/request";
18
17
  import warnOnce from "../../utils/warn_once";
19
18
  import byteRange from "../utils/byte_range";
@@ -41,7 +40,7 @@ export default function generateTextTrackLoader(_a) {
41
40
  var adaptation = content.adaptation, representation = content.representation, segment = content.segment;
42
41
  var range = segment.range;
43
42
  if (url === null) {
44
- return PPromise.resolve({ resultType: "segment-created",
43
+ return Promise.resolve({ resultType: "segment-created",
45
44
  resultData: null });
46
45
  }
47
46
  if (segment.isInit) {
@@ -15,14 +15,13 @@
15
15
  */
16
16
  import { CustomLoaderError } from "../../errors";
17
17
  import isNullOrUndefined from "../../utils/is_null_or_undefined";
18
- import PPromise from "../../utils/promise";
19
18
  /**
20
19
  * @param {Function} customSegmentLoader
21
20
  * @param {Object} cancelSignal
22
21
  * @returns {Promise}
23
22
  */
24
23
  function loadInitSegment(customSegmentLoader, cancelSignal) {
25
- return new PPromise(function (res, rej) {
24
+ return new Promise(function (res, rej) {
26
25
  /** `true` when the custom segmentLoader should not be active anymore. */
27
26
  var hasFinished = false;
28
27
  /**
@@ -77,7 +76,7 @@ function loadInitSegment(customSegmentLoader, cancelSignal) {
77
76
  * @returns {Observable}
78
77
  */
79
78
  function loadSegment(segment, customSegmentLoader, cancelSignal) {
80
- return new PPromise(function (res, rej) {
79
+ return new Promise(function (res, rej) {
81
80
  /** `true` when the custom segmentLoader should not be active anymore. */
82
81
  var hasFinished = false;
83
82
  /**