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
@@ -41,22 +41,28 @@ export type IAdaptationSwitchStrategy =
41
41
  { type: "needs-reload"; value: undefined };
42
42
 
43
43
  export interface IAdaptationSwitchOptions {
44
- /**
45
- * Strategy to adopt when manually switching of audio adaptation.
46
- * Can be either:
47
- * - "seamless": transitions are smooth but could be not immediate.
48
- * - "direct": strategy will be "smart", if the mimetype and the codec,
49
- * change, we will perform a hard reload of the media source, however, if it
50
- * doesn't change, we will just perform a small flush by removing buffered range
51
- * and performing, a small seek on the media element.
52
- * Transitions are faster, but, we could see appear a reloading or seeking state.
53
- */
54
- audioTrackSwitchingMode : "seamless" | "direct";
55
-
44
+ /** RxPlayer's behavior when switching the audio track. */
45
+ audioTrackSwitchingMode : IAudioTrackSwitchingMode;
56
46
  /** Behavior when a new video and/or audio codec is encountered. */
57
47
  onCodecSwitch : "continue" | "reload";
58
48
  }
59
49
 
50
+ /**
51
+ * Strategy to adopt when manually switching of audio adaptation.
52
+ * Can be either:
53
+ * - "seamless": transitions are smooth but could be not immediate.
54
+ * - "direct": strategy will be "smart", if the mimetype and the codec,
55
+ * change, we will perform a hard reload of the media source, however, if it
56
+ * doesn't change, we will just perform a small flush by removing buffered range
57
+ * and performing, a small seek on the media element.
58
+ * Transitions are faster, but, we could see appear a BUFFERING state.
59
+ * - "reload": completely reload the content. This allows a direct switch
60
+ * compatible with most device but may necessitate a RELOADING phase.
61
+ */
62
+ export type IAudioTrackSwitchingMode = "seamless" |
63
+ "direct" |
64
+ "reload";
65
+
60
66
  /**
61
67
  * Find out what to do when switching Adaptation, based on the current
62
68
  * situation.
@@ -119,7 +125,11 @@ export default function getAdaptationSwitchStrategy(
119
125
  }
120
126
 
121
127
  const { currentTime } = playbackInfo;
122
- if (adaptation.type === "video" &&
128
+ const { audioTrackSwitchingMode } = options;
129
+
130
+ const hasReloadSwitchingMode = adaptation.type === "video" ||
131
+ (adaptation.type === "audio" && audioTrackSwitchingMode === "reload");
132
+ if (hasReloadSwitchingMode &&
123
133
  // We're playing the current Period
124
134
  isTimeInRange({ start, end }, currentTime) &&
125
135
  // There is data for the current position or the codecs are differents
@@ -135,7 +145,7 @@ export default function getAdaptationSwitchStrategy(
135
145
  // From here, clean-up data from the previous Adaptation, if one
136
146
 
137
147
  const shouldFlush = adaptation.type === "audio" &&
138
- options.audioTrackSwitchingMode === "direct";
148
+ audioTrackSwitchingMode === "direct";
139
149
 
140
150
  const rangesToExclude = [];
141
151
 
@@ -19,6 +19,7 @@ import PeriodStream, {
19
19
  IPeriodStreamOptions,
20
20
  IPeriodStreamPlaybackObservation,
21
21
  } from "./period_stream";
22
+ export { IAudioTrackSwitchingMode } from "./get_adaptation_switch_strategy";
22
23
 
23
24
  export default PeriodStream;
24
25
 
@@ -59,7 +59,9 @@ import {
59
59
  IStreamWarningEvent,
60
60
  } from "../types";
61
61
  import createEmptyStream from "./create_empty_adaptation_stream";
62
- import getAdaptationSwitchStrategy from "./get_adaptation_switch_strategy";
62
+ import getAdaptationSwitchStrategy, {
63
+ IAudioTrackSwitchingMode,
64
+ } from "./get_adaptation_switch_strategy";
63
65
 
64
66
 
65
67
  /** Playback observation required by the `PeriodStream`. */
@@ -105,21 +107,10 @@ export interface IPeriodStreamArguments {
105
107
  export type IPeriodStreamOptions =
106
108
  IAdaptationStreamOptions &
107
109
  {
108
- /**
109
- * Strategy to adopt when manually switching of audio adaptation.
110
- * Can be either:
111
- * - "seamless": transitions are smooth but could be not immediate.
112
- * - "direct": strategy will be "smart", if the mimetype and the codec,
113
- * change, we will perform a hard reload of the media source, however, if it
114
- * doesn't change, we will just perform a small flush by removing buffered range
115
- * and performing, a small seek on the media element.
116
- * Transitions are faster, but, we could see appear a reloading or seeking state.
117
- */
118
- audioTrackSwitchingMode : "seamless" | "direct";
119
-
110
+ /** RxPlayer's behavior when switching the audio track. */
111
+ audioTrackSwitchingMode : IAudioTrackSwitchingMode;
120
112
  /** Behavior when a new video and/or audio codec is encountered. */
121
113
  onCodecSwitch : "continue" | "reload";
122
-
123
114
  /** Options specific to the text SegmentBuffer. */
124
115
  textTrackOptions? : ITextTrackSegmentBufferOptions;
125
116
  };
@@ -35,7 +35,6 @@ import createSegmentFetcher, {
35
35
  import log from "../../../log";
36
36
  import { ISegment } from "../../../manifest";
37
37
  import objectAssign from "../../../utils/object_assign";
38
- import PPromise from "../../../utils/promise";
39
38
  import { freeRequest } from "./create_request";
40
39
  import getCompleteSegmentId from "./get_complete_segment_id";
41
40
  import getContentInfos from "./get_content_infos";
@@ -110,13 +109,13 @@ export default class VideoThumbnailLoader {
110
109
 
111
110
  const manifest = this._player.getManifest();
112
111
  if (manifest === null) {
113
- return PPromise.reject(
112
+ return Promise.reject(
114
113
  new VideoThumbnailLoaderError("NO_MANIFEST",
115
114
  "No manifest available."));
116
115
  }
117
116
  const contentInfos = getContentInfos(time, manifest);
118
117
  if (contentInfos === null) {
119
- return PPromise.reject(
118
+ return Promise.reject(
120
119
  new VideoThumbnailLoaderError("NO_TRACK",
121
120
  "Couldn't find track for this time."));
122
121
  }
@@ -125,7 +124,7 @@ export default class VideoThumbnailLoader {
125
124
  .representation.index.getSegments(time, MIN_NEEDED_DATA_AFTER_TIME);
126
125
 
127
126
  if (segments.length === 0) {
128
- return PPromise.reject(
127
+ return Promise.reject(
129
128
  new VideoThumbnailLoaderError("NO_THUMBNAIL",
130
129
  "Couldn't find thumbnail for the given time."));
131
130
  }
@@ -147,7 +146,7 @@ export default class VideoThumbnailLoader {
147
146
  if (segments.length === 0) {
148
147
  this._videoElement.currentTime = time;
149
148
  log.debug("VTL: Thumbnails already loaded.", time);
150
- return PPromise.resolve(time);
149
+ return Promise.resolve(time);
151
150
  }
152
151
 
153
152
  log.debug("VTL: Found thumbnail for time", time, segments);
@@ -193,7 +192,7 @@ export default class VideoThumbnailLoader {
193
192
  "VideoThumbnailLoaderError: No " +
194
193
  "imported loader for this transport type: " +
195
194
  contentInfos.manifest.transport);
196
- return PPromise.reject(error);
195
+ return Promise.reject(error);
197
196
  }
198
197
  const killTask$ = new Subject<void>();
199
198
  const abortError$ = killTask$.pipe(
@@ -22,7 +22,6 @@
22
22
  /* eslint-disable @typescript-eslint/no-unsafe-return */
23
23
  /* eslint-disable no-restricted-properties */
24
24
 
25
- import PPromise from "../../../../../utils/promise";
26
25
  import { ProberStatus } from "../../types";
27
26
 
28
27
 
@@ -57,7 +56,7 @@ describe("MediaCapabilitiesProber probers - HDCPPolicy", () => {
57
56
 
58
57
  it("should resolve with `Unknown` if no getStatusForPolicy API", (done) => {
59
58
  const mockCreateMediaKeys = jest.fn(() => {
60
- return PPromise.resolve({});
59
+ return Promise.resolve({});
61
60
  });
62
61
  const mockRequestMediaKeySystemAcces = jest.fn(() => {
63
62
  return Promise.resolve({
@@ -85,8 +84,8 @@ describe("MediaCapabilitiesProber probers - HDCPPolicy", () => {
85
84
 
86
85
  it("should resolve with `Supported` if policy is supported", (done) => {
87
86
  const mockCreateMediaKeys = jest.fn(() => {
88
- return PPromise.resolve({
89
- getStatusForPolicy: () => PPromise.resolve("usable"),
87
+ return Promise.resolve({
88
+ getStatusForPolicy: () => Promise.resolve("usable"),
90
89
  });
91
90
  });
92
91
  const mockRequestMediaKeySystemAcces = jest.fn(() => {
@@ -115,8 +114,8 @@ describe("MediaCapabilitiesProber probers - HDCPPolicy", () => {
115
114
 
116
115
  it("should resolve with `NotSupported` if policy is not supported", (done) => {
117
116
  const mockCreateMediaKeys = jest.fn(() => {
118
- return PPromise.resolve({
119
- getStatusForPolicy: () => PPromise.resolve("not-usable"),
117
+ return Promise.resolve({
118
+ getStatusForPolicy: () => Promise.resolve("not-usable"),
120
119
  });
121
120
  });
122
121
  const mockRequestMediaKeySystemAcces = jest.fn(() => {
@@ -23,8 +23,6 @@
23
23
  /* eslint-disable @typescript-eslint/strict-boolean-expressions */
24
24
  /* eslint-disable @typescript-eslint/no-explicit-any */
25
25
 
26
- import PPromise from "../../../../../utils/promise";
27
-
28
26
  import probeDecodingInfos from "../../probers/decodingInfo";
29
27
  import {
30
28
  IMediaConfiguration,
@@ -42,9 +40,9 @@ const origMediaCapabilities = (navigator as any).mediaCapabilities;
42
40
  function stubDecodingInfo(isSupported: boolean, mustReject?: boolean) {
43
41
  const decodingInfoStub = jest.fn(() => {
44
42
  if (mustReject === true) {
45
- return PPromise.reject();
43
+ return Promise.reject();
46
44
  } else {
47
- return PPromise.resolve({
45
+ return Promise.resolve({
48
46
  supported: isSupported,
49
47
  });
50
48
  }
@@ -15,7 +15,6 @@
15
15
  */
16
16
 
17
17
  import arrayFind from "../../../../utils/array_find";
18
- import PPromise from "../../../../utils/promise";
19
18
  import log from "../log";
20
19
  import {
21
20
  ICompatibleKeySystem,
@@ -79,7 +78,7 @@ const mediaCapabilitiesProber = {
79
78
  */
80
79
  getStatusForHDCP(hdcp: string) : Promise<string> {
81
80
  if (hdcp === undefined || hdcp.length === 0) {
82
- return PPromise.reject("MediaCapabilitiesProbers >>> Bad Arguments: " +
81
+ return Promise.reject("MediaCapabilitiesProbers >>> Bad Arguments: " +
83
82
  "No HDCP Policy specified.");
84
83
  }
85
84
  const config = {
@@ -152,7 +151,7 @@ const mediaCapabilitiesProber = {
152
151
  })
153
152
  );
154
153
  });
155
- return PPromise.all(promises)
154
+ return Promise.all(promises)
156
155
  .then((configs) => {
157
156
  // TODO I added those lines to work-around a type issue but does it
158
157
  // really correspond to the original intent? I find it hard to
@@ -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, { ICapabilitiesTypes } from "../capabilities";
18
17
  import log from "../log";
19
18
  import probers, {
@@ -102,7 +101,7 @@ function probeMediaConfiguration(
102
101
  }
103
102
  }
104
103
 
105
- return PPromise.all(promises).then(() => {
104
+ return Promise.all(promises).then(() => {
106
105
  if (globalStatus === undefined) {
107
106
  globalStatus = ProberStatus.Unknown;
108
107
  }
@@ -15,7 +15,6 @@
15
15
  */
16
16
 
17
17
  import { requestMediaKeySystemAccess } from "../../../../compat";
18
- import PPromise from "../../../../utils/promise";
19
18
  import log from "../log";
20
19
  import {
21
20
  ICompatibleKeySystem,
@@ -37,7 +36,7 @@ export default function probeDRMInfos(
37
36
  ): Promise<[ProberStatus, ICompatibleKeySystem?]> {
38
37
  const keySystem = mediaConfig.keySystem;
39
38
  if (keySystem == null || keySystem.type == null) {
40
- return PPromise.reject("MediaCapabilitiesProber >>> API_CALL: " +
39
+ return Promise.reject("MediaCapabilitiesProber >>> API_CALL: " +
41
40
  "Missing a type argument to request a media key system access.");
42
41
  }
43
42
 
@@ -51,7 +50,7 @@ export default function probeDRMInfos(
51
50
  "Your browser has no API to request a media key system access.");
52
51
  // In that case, the API lack means that no EME workflow may be started.
53
52
  // So, the DRM configuration is not supported.
54
- return PPromise.resolve([ProberStatus.NotSupported, result]);
53
+ return Promise.resolve([ProberStatus.NotSupported, result]);
55
54
  }
56
55
 
57
56
  return requestMediaKeySystemAccess(type, [configuration])
@@ -15,7 +15,6 @@
15
15
  */
16
16
 
17
17
  import { requestMediaKeySystemAccess } from "../../../../compat";
18
- import PPromise from "../../../../utils/promise";
19
18
  import {
20
19
  IMediaConfiguration,
21
20
  ProberStatus,
@@ -38,11 +37,11 @@ export default function probeHDCPPolicy(
38
37
  config: IMediaConfiguration
39
38
  ): Promise<[ProberStatus]> {
40
39
  if (requestMediaKeySystemAccess == null) {
41
- return PPromise.reject("MediaCapabilitiesProber >>> API_CALL: " +
40
+ return Promise.reject("MediaCapabilitiesProber >>> API_CALL: " +
42
41
  "API not available");
43
42
  }
44
43
  if (config.hdcp == null) {
45
- return PPromise.reject("MediaCapabilitiesProber >>> API_CALL: " +
44
+ return Promise.reject("MediaCapabilitiesProber >>> API_CALL: " +
46
45
  "Missing policy argument for calling getStatusForPolicy.");
47
46
  }
48
47
 
@@ -14,7 +14,6 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import PPromise from "../../../../utils/promise";
18
17
  import {
19
18
  IMediaConfiguration,
20
19
  ProberStatus,
@@ -31,7 +30,7 @@ export interface IDecodingInfos {
31
30
  * @returns {Promise}
32
31
  */
33
32
  function isMediaCapabilitiesAPIAvailable(): Promise<void> {
34
- return new PPromise((resolve) => {
33
+ return new Promise((resolve) => {
35
34
  if (!("mediaCapabilities" in navigator)) {
36
35
  throw new Error("MediaCapabilitiesProber >>> API_CALL: " +
37
36
  "MediaCapabilities API not available");
@@ -15,7 +15,6 @@
15
15
  */
16
16
 
17
17
  import { MediaSource_ } from "../../../../compat";
18
- import PPromise from "../../../../utils/promise";
19
18
  import {
20
19
  IMediaConfiguration,
21
20
  ProberStatus,
@@ -28,7 +27,7 @@ import {
28
27
  export default function probeContentType(
29
28
  config: IMediaConfiguration
30
29
  ): Promise<[ProberStatus]> {
31
- return new PPromise((resolve) => {
30
+ return new Promise((resolve) => {
32
31
  if (MediaSource_ == null) {
33
32
  throw new Error("MediaCapabilitiesProber >>> API_CALL: " +
34
33
  "MediaSource API not available");
@@ -14,7 +14,6 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import PPromise from "../../../../../utils/promise";
18
17
  import {
19
18
  IMediaConfiguration,
20
19
  ProberStatus,
@@ -33,7 +32,7 @@ export type ISupportWithFeatures = ""|"Maybe"|"Not Supported"|"Probably";
33
32
  * @returns {Promise}
34
33
  */
35
34
  function isTypeSupportedWithFeaturesAPIAvailable(): Promise<void> {
36
- return new PPromise((resolve) => {
35
+ return new Promise((resolve) => {
37
36
  if (!("MSMediaKeys" in window)) {
38
37
  throw new Error("MediaCapabilitiesProber >>> API_CALL: " +
39
38
  "MSMediaKeys API not available");
@@ -14,7 +14,6 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import PPromise from "../../../../utils/promise";
18
17
  import {
19
18
  IMediaConfiguration,
20
19
  ProberStatus,
@@ -27,7 +26,7 @@ import {
27
26
  export default function probeMatchMedia(
28
27
  config: IMediaConfiguration
29
28
  ): Promise<[ProberStatus]> {
30
- return new PPromise((resolve) => {
29
+ return new Promise((resolve) => {
31
30
  /* eslint-disable @typescript-eslint/unbound-method */
32
31
  if (typeof window.matchMedia !== "function") {
33
32
  /* eslint-enable @typescript-eslint/unbound-method */
@@ -17,7 +17,6 @@
17
17
  import log from "../../../../../log";
18
18
  import assertUnreachable from "../../../../../utils/assert_unreachable";
19
19
  import noop from "../../../../../utils/noop";
20
- import PPromise from "../../../../../utils/promise";
21
20
  import parseMpdIr, {
22
21
  IIrParserResponse,
23
22
  ILoadedXlinkData,
@@ -136,15 +135,15 @@ export default class DashWasmParser {
136
135
  */
137
136
  public waitForInitialization() : Promise<void> {
138
137
  return this._initProm ??
139
- PPromise.reject("No initialization performed yet.");
138
+ Promise.reject("No initialization performed yet.");
140
139
  }
141
140
 
142
141
  public async initialize(opts : IDashWasmParserOptions) : Promise<void> {
143
142
  if (this.status !== "uninitialized") {
144
- return PPromise.reject(new Error("DashWasmParser already initialized."));
143
+ return Promise.reject(new Error("DashWasmParser already initialized."));
145
144
  } else if (!this.isCompatible()) {
146
145
  this.status = "failure";
147
- return PPromise.reject(new Error("Target not compatible with WebAssembly."));
146
+ return Promise.reject(new Error("Target not compatible with WebAssembly."));
148
147
  }
149
148
  this.status = "initializing";
150
149
 
@@ -175,7 +174,7 @@ export default class DashWasmParser {
175
174
 
176
175
  const streamingProm = typeof WebAssembly.instantiateStreaming === "function" ?
177
176
  WebAssembly.instantiateStreaming(fetchedWasm, imports) :
178
- PPromise.reject("`WebAssembly.instantiateStreaming` API not available");
177
+ Promise.reject("`WebAssembly.instantiateStreaming` API not available");
179
178
 
180
179
  this._initProm = streamingProm
181
180
  .catch(async (e) => {
@@ -56,6 +56,7 @@ export {
56
56
  IPersistentSessionInfo,
57
57
  IPersistentSessionStorage,
58
58
  } from "./core/decrypt";
59
+ export { IAudioTrackSwitchingMode } from "./core/stream";
59
60
  export { ICustomError as IPlayerError } from "./errors";
60
61
  export {
61
62
  IExposedAdaptation as IAdaptation,
@@ -14,7 +14,6 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import PPromise from "../../utils/promise";
18
17
  import TaskCanceller, {
19
18
  CancellationError,
20
19
  } from "../../utils/task_canceller";
@@ -33,7 +32,7 @@ export default function addSegmentIntegrityChecks<T>(
33
32
  segmentLoader : ISegmentLoader<T>
34
33
  ) : ISegmentLoader<T> {
35
34
  return (url, content, initialCancelSignal, callbacks) => {
36
- return new PPromise((res, rej) => {
35
+ return new Promise((res, rej) => {
37
36
  const canceller = new TaskCanceller();
38
37
  const unregisterCancelLstnr = initialCancelSignal
39
38
  .register(function onCheckCancellation(err : CancellationError) {
@@ -15,7 +15,6 @@
15
15
  */
16
16
 
17
17
  import features from "../../features";
18
- import PPromise from "../../utils/promise";
19
18
  import request from "../../utils/request";
20
19
  import takeFirstSet from "../../utils/take_first_set";
21
20
  import { CancellationSignal } from "../../utils/task_canceller";
@@ -24,7 +23,6 @@ import {
24
23
  ILoadedImageSegmentFormat,
25
24
  ISegmentContext,
26
25
  ISegmentLoaderCallbacks,
27
- ISegmentLoaderResultChunkedComplete,
28
26
  ISegmentLoaderResultSegmentCreated,
29
27
  ISegmentLoaderResultSegmentLoaded,
30
28
  ISegmentParserParsedInitChunk,
@@ -39,31 +37,31 @@ import {
39
37
  * @param {Object} callbacks
40
38
  * @returns {Promise}
41
39
  */
42
- export function imageLoader(
40
+ export async function imageLoader(
43
41
  url : string | null,
44
42
  content : ISegmentContext,
45
43
  cancelSignal : CancellationSignal,
46
44
  callbacks : ISegmentLoaderCallbacks<ILoadedImageSegmentFormat>
47
45
  ) : Promise<ISegmentLoaderResultSegmentLoaded<ILoadedImageSegmentFormat> |
48
- ISegmentLoaderResultSegmentCreated<ILoadedImageSegmentFormat> |
49
- ISegmentLoaderResultChunkedComplete>
46
+ ISegmentLoaderResultSegmentCreated<ILoadedImageSegmentFormat>>
50
47
  {
51
48
  const { segment } = content;
52
49
  if (segment.isInit || url === null) {
53
- return PPromise.resolve({ resultType: "segment-created",
54
- resultData: null });
50
+ return { resultType: "segment-created",
51
+ resultData: null };
55
52
  }
56
- return request({ url,
57
- responseType: "arraybuffer",
58
- onProgress: callbacks.onProgress,
59
- cancelSignal })
60
- .then((data) => ({ resultType: "segment-loaded",
61
- resultData: data }));
53
+ const data = await request({ url,
54
+ responseType: "arraybuffer",
55
+ onProgress: callbacks.onProgress,
56
+ cancelSignal });
57
+ return { resultType: "segment-loaded",
58
+ resultData: data };
62
59
  }
63
60
 
64
61
  /**
65
62
  * Parses an image segment.
66
- * @param {Object} args
63
+ * @param {Object} loadedSegment
64
+ * @param {Object} content
67
65
  * @returns {Object}
68
66
  */
69
67
  export function imageParser(
@@ -16,7 +16,6 @@
16
16
 
17
17
  import { ISegment } from "../../manifest";
18
18
  import { concat } from "../../utils/byte_parsing";
19
- import PPromise from "../../utils/promise";
20
19
  import request from "../../utils/request";
21
20
  import { CancellationSignal } from "../../utils/task_canceller";
22
21
  import {
@@ -86,7 +85,7 @@ export default function initSegmentLoader(
86
85
  cancelSignal,
87
86
  onProgress: callbacks.onProgress });
88
87
 
89
- return PPromise.all([rangeRequest$, indexRequest$])
88
+ return Promise.all([rangeRequest$, indexRequest$])
90
89
  .then(([ initData, indexData ]) => {
91
90
  const data = concat(new Uint8Array(initData.responseData),
92
91
  new Uint8Array(indexData.responseData));
@@ -23,7 +23,6 @@ import {
23
23
  ILoadedResource,
24
24
  } from "../../parsers/manifest/dash/parsers_types";
25
25
  import objectAssign from "../../utils/object_assign";
26
- import PPromise from "../../utils/promise";
27
26
  import request from "../../utils/request";
28
27
  import {
29
28
  strToUtf8,
@@ -140,7 +139,7 @@ export default function generateManifestParser(
140
139
  onWarnings(parserResponse.value.warnings);
141
140
  }
142
141
  if (cancelSignal.isCancelled) {
143
- return PPromise.reject(cancelSignal.cancellationError);
142
+ return Promise.reject(cancelSignal.cancellationError);
144
143
  }
145
144
  const manifest = new Manifest(parserResponse.value.parsed, options);
146
145
  return { manifest, url };
@@ -192,7 +191,7 @@ export default function generateManifestParser(
192
191
  });
193
192
  });
194
193
 
195
- return PPromise.all(externalResources).then(loadedResources => {
194
+ return Promise.all(externalResources).then(loadedResources => {
196
195
  if (value.format === "string") {
197
196
  assertLoadedResourcesFormatString(loadedResources);
198
197
  return processMpdParserResponse(value.continue(loadedResources));
@@ -15,7 +15,6 @@
15
15
  */
16
16
 
17
17
  import { CustomLoaderError } from "../../errors";
18
- import PPromise from "../../utils/promise";
19
18
  import request, {
20
19
  fetchIsSupported,
21
20
  } from "../../utils/request";
@@ -42,7 +41,7 @@ import lowLatencySegmentLoader from "./low_latency_segment_loader";
42
41
 
43
42
  /**
44
43
  * Segment loader triggered if there was no custom-defined one in the API.
45
- * @param {string} uri
44
+ * @param {string} url
46
45
  * @param {Object} content
47
46
  * @param {boolean} lowLatencyMode
48
47
  * @param {Object} callbacks
@@ -114,8 +113,8 @@ export default function generateSegmentLoader(
114
113
  ISegmentLoaderResultChunkedComplete>
115
114
  {
116
115
  if (url == null) {
117
- return PPromise.resolve({ resultType: "segment-created",
118
- resultData: null });
116
+ return Promise.resolve({ resultType: "segment-created",
117
+ resultData: null });
119
118
  }
120
119
 
121
120
  if (lowLatencyMode || customSegmentLoader === undefined) {
@@ -130,7 +129,7 @@ export default function generateSegmentLoader(
130
129
  transport: "dash",
131
130
  url };
132
131
 
133
- return new PPromise((res, rej) => {
132
+ return new Promise((res, rej) => {
134
133
  /** `true` when the custom segmentLoader should not be active anymore. */
135
134
  let hasFinished = false;
136
135
 
@@ -14,7 +14,6 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import PPromise from "../../utils/promise";
18
17
  import request, {
19
18
  fetchIsSupported,
20
19
  } from "../../utils/request";
@@ -68,8 +67,8 @@ export default function generateTextTrackLoader(
68
67
  const { range } = segment;
69
68
 
70
69
  if (url === null) {
71
- return PPromise.resolve({ resultType: "segment-created",
72
- resultData: null });
70
+ return Promise.resolve({ resultType: "segment-created",
71
+ resultData: null });
73
72
  }
74
73
 
75
74
  if (segment.isInit) {
@@ -20,7 +20,6 @@ import {
20
20
  ILocalManifestSegmentLoader,
21
21
  } from "../../parsers/manifest/local";
22
22
  import isNullOrUndefined from "../../utils/is_null_or_undefined";
23
- import PPromise from "../../utils/promise";
24
23
  import {
25
24
  CancellationError,
26
25
  CancellationSignal,
@@ -40,7 +39,7 @@ function loadInitSegment(
40
39
  customSegmentLoader : ILocalManifestInitSegmentLoader,
41
40
  cancelSignal : CancellationSignal
42
41
  ) : Promise<ISegmentLoaderResultSegmentLoaded<ArrayBuffer | null>> {
43
- return new PPromise((res, rej) => {
42
+ return new Promise((res, rej) => {
44
43
  /** `true` when the custom segmentLoader should not be active anymore. */
45
44
  let hasFinished = false;
46
45
 
@@ -108,7 +107,7 @@ function loadSegment(
108
107
  customSegmentLoader : ILocalManifestSegmentLoader,
109
108
  cancelSignal : CancellationSignal
110
109
  ) : Promise< ISegmentLoaderResultSegmentLoaded<ArrayBuffer | null>> {
111
- return new PPromise((res, rej) => {
110
+ return new Promise((res, rej) => {
112
111
  /** `true` when the custom segmentLoader should not be active anymore. */
113
112
  let hasFinished = false;
114
113
 
@@ -28,7 +28,6 @@ import parseMetaPlaylist, {
28
28
  import { IParsedManifest } from "../../parsers/manifest/types";
29
29
  import isNullOrUndefined from "../../utils/is_null_or_undefined";
30
30
  import objectAssign from "../../utils/object_assign";
31
- import PPromise from "../../utils/promise";
32
31
  import { CancellationSignal } from "../../utils/task_canceller";
33
32
  import {
34
33
  IChunkTimeInfo,
@@ -156,7 +155,7 @@ export default function(options : ITransportOptions): ITransportPipelines {
156
155
  ) : Promise<IManifestParserResult> {
157
156
  if (parsedResult.type === "done") {
158
157
  const manifest = new Manifest(parsedResult.value, options);
159
- return PPromise.resolve({ manifest });
158
+ return Promise.resolve({ manifest });
160
159
  }
161
160
 
162
161
  const parsedValue = parsedResult.value;
@@ -177,7 +176,7 @@ export default function(options : ITransportOptions): ITransportPipelines {
177
176
  }
178
177
  });
179
178
 
180
- return PPromise.all(loaderProms).then(parsedReqs => {
179
+ return Promise.all(loaderProms).then(parsedReqs => {
181
180
  const loadedRessources = parsedReqs.map(e => e.manifest);
182
181
  return handleParsedResult(parsedResult.value.continue(loadedRessources));
183
182
  });