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

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 (134) hide show
  1. package/.eslintrc.js +0 -4
  2. package/CHANGELOG.md +5 -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 +20 -17
  10. package/dist/_esm5.processed/compat/eme/custom_media_keys/webkit_media_keys.js +29 -14
  11. package/dist/_esm5.processed/compat/eme/generate_key_request.d.ts +4 -6
  12. package/dist/_esm5.processed/compat/eme/generate_key_request.js +4 -6
  13. package/dist/_esm5.processed/compat/eme/load_session.js +1 -2
  14. package/dist/_esm5.processed/config.d.ts +0 -3
  15. package/dist/_esm5.processed/core/api/option_utils.d.ts +3 -2
  16. package/dist/_esm5.processed/core/api/option_utils.js +2 -1
  17. package/dist/_esm5.processed/core/api/public_api.js +3 -4
  18. package/dist/_esm5.processed/core/decrypt/attach_media_keys.js +1 -2
  19. package/dist/_esm5.processed/core/decrypt/clear_on_stop.js +1 -2
  20. package/dist/_esm5.processed/core/decrypt/content_decryptor.js +12 -5
  21. package/dist/_esm5.processed/core/decrypt/create_or_load_session.js +1 -1
  22. package/dist/_esm5.processed/core/decrypt/create_session.d.ts +3 -1
  23. package/dist/_esm5.processed/core/decrypt/create_session.js +16 -7
  24. package/dist/_esm5.processed/core/decrypt/find_key_system.js +1 -2
  25. package/dist/_esm5.processed/core/decrypt/utils/clean_old_loaded_sessions.js +1 -2
  26. package/dist/_esm5.processed/core/decrypt/utils/loaded_sessions_store.d.ts +94 -1
  27. package/dist/_esm5.processed/core/decrypt/utils/loaded_sessions_store.js +238 -98
  28. package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.js +1 -3
  29. package/dist/_esm5.processed/core/fetchers/utils/try_urls_with_backoff.js +2 -3
  30. package/dist/_esm5.processed/core/init/initialize_media_source.d.ts +2 -1
  31. package/dist/_esm5.processed/core/stream/index.d.ts +1 -0
  32. package/dist/_esm5.processed/core/stream/period/get_adaptation_switch_strategy.d.ts +15 -11
  33. package/dist/_esm5.processed/core/stream/period/get_adaptation_switch_strategy.js +5 -2
  34. package/dist/_esm5.processed/core/stream/period/index.d.ts +1 -0
  35. package/dist/_esm5.processed/core/stream/period/period_stream.d.ts +3 -11
  36. package/dist/_esm5.processed/core/stream/representation/append_segment_to_buffer.js +4 -3
  37. package/dist/_esm5.processed/default_config.d.ts +0 -27
  38. package/dist/_esm5.processed/default_config.js +0 -27
  39. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/thumbnail_loader.js +5 -6
  40. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/api/index.js +2 -3
  41. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.d.ts +15 -0
  42. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.js +1 -2
  43. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/DRMInfos.js +2 -3
  44. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/HDCPPolicy.js +2 -3
  45. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/decodingInfo.js +1 -2
  46. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/mediaContentType.js +1 -2
  47. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/mediaContentTypeWithFeatures/index.js +1 -2
  48. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/mediaDisplayInfos.js +1 -2
  49. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/dash-wasm-parser.js +4 -5
  50. package/dist/_esm5.processed/public_types.d.ts +1 -0
  51. package/dist/_esm5.processed/transports/dash/add_segment_integrity_checks_to_loader.js +1 -2
  52. package/dist/_esm5.processed/transports/dash/image_pipelines.d.ts +4 -3
  53. package/dist/_esm5.processed/transports/dash/image_pipelines.js +57 -11
  54. package/dist/_esm5.processed/transports/dash/init_segment_loader.js +1 -2
  55. package/dist/_esm5.processed/transports/dash/manifest_parser.js +2 -3
  56. package/dist/_esm5.processed/transports/dash/segment_loader.d.ts +1 -1
  57. package/dist/_esm5.processed/transports/dash/segment_loader.js +3 -4
  58. package/dist/_esm5.processed/transports/dash/text_loader.js +1 -2
  59. package/dist/_esm5.processed/transports/local/segment_loader.js +2 -3
  60. package/dist/_esm5.processed/transports/metaplaylist/pipelines.js +2 -3
  61. package/dist/_esm5.processed/transports/smooth/pipelines.js +3 -4
  62. package/dist/_esm5.processed/transports/smooth/segment_loader.js +3 -4
  63. package/dist/_esm5.processed/transports/utils/call_custom_manifest_loader.js +1 -2
  64. package/dist/_esm5.processed/utils/cancellable_sleep.js +1 -2
  65. package/dist/_esm5.processed/utils/cast_to_observable.js +1 -3
  66. package/dist/_esm5.processed/utils/request/xhr.js +1 -2
  67. package/dist/rx-player.js +851 -937
  68. package/dist/rx-player.min.js +1 -1
  69. package/package.json +1 -2
  70. package/scripts/update-version +2 -2
  71. package/sonar-project.properties +1 -1
  72. package/src/compat/__tests__/play.test.ts +2 -4
  73. package/src/compat/eme/close_session.ts +1 -2
  74. package/src/compat/eme/custom_key_system_access.ts +1 -2
  75. package/src/compat/eme/custom_media_keys/ie11_media_keys.ts +6 -7
  76. package/src/compat/eme/custom_media_keys/index.ts +3 -4
  77. package/src/compat/eme/custom_media_keys/old_webkit_media_keys.ts +21 -18
  78. package/src/compat/eme/custom_media_keys/webkit_media_keys.ts +28 -16
  79. package/src/compat/eme/generate_key_request.ts +4 -6
  80. package/src/compat/eme/load_session.ts +1 -2
  81. package/src/core/api/__tests__/option_utils.test.ts +12 -0
  82. package/src/core/api/option_utils.ts +5 -3
  83. package/src/core/api/public_api.ts +3 -4
  84. package/src/core/decrypt/attach_media_keys.ts +1 -2
  85. package/src/core/decrypt/clear_on_stop.ts +1 -2
  86. package/src/core/decrypt/content_decryptor.ts +16 -6
  87. package/src/core/decrypt/create_or_load_session.ts +4 -1
  88. package/src/core/decrypt/create_session.ts +25 -12
  89. package/src/core/decrypt/find_key_system.ts +1 -2
  90. package/src/core/decrypt/utils/clean_old_loaded_sessions.ts +1 -2
  91. package/src/core/decrypt/utils/loaded_sessions_store.ts +256 -105
  92. package/src/core/fetchers/manifest/manifest_fetcher.ts +1 -3
  93. package/src/core/fetchers/utils/try_urls_with_backoff.ts +2 -3
  94. package/src/core/init/initialize_media_source.ts +2 -1
  95. package/src/core/stream/index.ts +1 -0
  96. package/src/core/stream/period/get_adaptation_switch_strategy.ts +24 -14
  97. package/src/core/stream/period/index.ts +1 -0
  98. package/src/core/stream/period/period_stream.ts +5 -14
  99. package/src/core/stream/representation/append_segment_to_buffer.ts +17 -13
  100. package/src/default_config.ts +0 -30
  101. package/src/experimental/tools/VideoThumbnailLoader/thumbnail_loader.ts +5 -6
  102. package/src/experimental/tools/mediaCapabilitiesProber/__tests__/probers/HDCPPolicy.test.ts +5 -6
  103. package/src/experimental/tools/mediaCapabilitiesProber/__tests__/probers/decodingInfos.test.ts +2 -4
  104. package/src/experimental/tools/mediaCapabilitiesProber/api/index.ts +2 -3
  105. package/src/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.ts +1 -2
  106. package/src/experimental/tools/mediaCapabilitiesProber/probers/DRMInfos.ts +2 -3
  107. package/src/experimental/tools/mediaCapabilitiesProber/probers/HDCPPolicy.ts +2 -3
  108. package/src/experimental/tools/mediaCapabilitiesProber/probers/decodingInfo.ts +1 -2
  109. package/src/experimental/tools/mediaCapabilitiesProber/probers/mediaContentType.ts +1 -2
  110. package/src/experimental/tools/mediaCapabilitiesProber/probers/mediaContentTypeWithFeatures/index.ts +1 -2
  111. package/src/experimental/tools/mediaCapabilitiesProber/probers/mediaDisplayInfos.ts +1 -2
  112. package/src/parsers/manifest/dash/wasm-parser/ts/dash-wasm-parser.ts +4 -5
  113. package/src/public_types.ts +1 -0
  114. package/src/transports/dash/add_segment_integrity_checks_to_loader.ts +1 -2
  115. package/src/transports/dash/image_pipelines.ts +12 -14
  116. package/src/transports/dash/init_segment_loader.ts +1 -2
  117. package/src/transports/dash/manifest_parser.ts +2 -3
  118. package/src/transports/dash/segment_loader.ts +4 -5
  119. package/src/transports/dash/text_loader.ts +2 -3
  120. package/src/transports/local/segment_loader.ts +2 -3
  121. package/src/transports/metaplaylist/pipelines.ts +2 -3
  122. package/src/transports/smooth/pipelines.ts +4 -5
  123. package/src/transports/smooth/segment_loader.ts +5 -6
  124. package/src/transports/utils/call_custom_manifest_loader.ts +1 -2
  125. package/src/utils/cancellable_sleep.ts +1 -2
  126. package/src/utils/cast_to_observable.ts +0 -2
  127. package/src/utils/request/xhr.ts +1 -2
  128. package/tsconfig.json +0 -1
  129. package/tsconfig.modules.json +0 -1
  130. package/dist/_esm5.processed/utils/promise.d.ts +0 -17
  131. package/dist/_esm5.processed/utils/promise.js +0 -18
  132. package/src/typings/pinkie.d.ts +0 -19
  133. package/src/utils/__tests__/promise.test.ts +0 -23
  134. package/src/utils/promise.ts +0 -20
@@ -934,33 +934,6 @@ declare const DEFAULT_CONFIG: {
934
934
  * This wasn't battle-tested however.
935
935
  */
936
936
  EME_MAX_STORED_PERSISTENT_SESSION_INFORMATION: number;
937
- /**
938
- * Attempts to closing a MediaKeySession can fail, most likely because the
939
- * MediaKeySession was not initialized yet.
940
- * When we consider that we're in one of these case, we will retry to close it.
941
- *
942
- * To avoid going into an infinite loop of retry, this number indicates a
943
- * maximum number of attemps we're going to make (`0` meaning no retry at all,
944
- * `1` only one retry and so on).
945
- */
946
- EME_SESSION_CLOSING_MAX_RETRY: number;
947
- /**
948
- * When closing a MediaKeySession failed due to the reasons explained for the
949
- * `EME_SESSION_CLOSING_MAX_RETRY` config property, we may (among other
950
- * triggers) choose to wait a delay raising exponentially at each retry before
951
- * that new attempt.
952
- * This value indicates the initial value for this delay, in milliseconds.
953
- */
954
- EME_SESSION_CLOSING_INITIAL_DELAY: number;
955
- /**
956
- * When closing a MediaKeySession failed due to the reasons explained for the
957
- * `EME_SESSION_CLOSING_MAX_RETRY` config property, we may (among other
958
- * triggers) choose to wait a delay raising exponentially at each retry before
959
- * that new attempt.
960
- * This value indicates the maximum possible value for this delay, in
961
- * milliseconds.
962
- */
963
- EME_SESSION_CLOSING_MAX_DELAY: number;
964
937
  /**
965
938
  * After loading a persistent MediaKeySession, the RxPlayer needs to ensure
966
939
  * that its keys still allow to decrypt a content.
@@ -978,33 +978,6 @@ var DEFAULT_CONFIG = {
978
978
  * This wasn't battle-tested however.
979
979
  */
980
980
  EME_MAX_STORED_PERSISTENT_SESSION_INFORMATION: 1000,
981
- /**
982
- * Attempts to closing a MediaKeySession can fail, most likely because the
983
- * MediaKeySession was not initialized yet.
984
- * When we consider that we're in one of these case, we will retry to close it.
985
- *
986
- * To avoid going into an infinite loop of retry, this number indicates a
987
- * maximum number of attemps we're going to make (`0` meaning no retry at all,
988
- * `1` only one retry and so on).
989
- */
990
- EME_SESSION_CLOSING_MAX_RETRY: 5,
991
- /**
992
- * When closing a MediaKeySession failed due to the reasons explained for the
993
- * `EME_SESSION_CLOSING_MAX_RETRY` config property, we may (among other
994
- * triggers) choose to wait a delay raising exponentially at each retry before
995
- * that new attempt.
996
- * This value indicates the initial value for this delay, in milliseconds.
997
- */
998
- EME_SESSION_CLOSING_INITIAL_DELAY: 100,
999
- /**
1000
- * When closing a MediaKeySession failed due to the reasons explained for the
1001
- * `EME_SESSION_CLOSING_MAX_RETRY` config property, we may (among other
1002
- * triggers) choose to wait a delay raising exponentially at each retry before
1003
- * that new attempt.
1004
- * This value indicates the maximum possible value for this delay, in
1005
- * milliseconds.
1006
- */
1007
- EME_SESSION_CLOSING_MAX_DELAY: 1000,
1008
981
  /**
1009
982
  * After loading a persistent MediaKeySession, the RxPlayer needs to ensure
1010
983
  * that its keys still allow to decrypt a content.
@@ -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
  /**
@@ -29,7 +29,6 @@ import Manifest from "../../manifest";
29
29
  import parseMetaPlaylist from "../../parsers/manifest/metaplaylist";
30
30
  import isNullOrUndefined from "../../utils/is_null_or_undefined";
31
31
  import objectAssign from "../../utils/object_assign";
32
- import PPromise from "../../utils/promise";
33
32
  import generateManifestLoader from "./manifest_loader";
34
33
  /**
35
34
  * Get base - real - content from an offseted metaplaylist content.
@@ -98,7 +97,7 @@ export default function (options) {
98
97
  function handleParsedResult(parsedResult) {
99
98
  if (parsedResult.type === "done") {
100
99
  var manifest = new Manifest(parsedResult.value, options);
101
- return PPromise.resolve({ manifest: manifest });
100
+ return Promise.resolve({ manifest: manifest });
102
101
  }
103
102
  var parsedValue = parsedResult.value;
104
103
  var loaderProms = parsedValue.ressources.map(function (resource) {
@@ -111,7 +110,7 @@ export default function (options) {
111
110
  return transport.manifest.loadManifest(resource.url, cancelSignal);
112
111
  }
113
112
  });
114
- return PPromise.all(loaderProms).then(function (parsedReqs) {
113
+ return Promise.all(loaderProms).then(function (parsedReqs) {
115
114
  var loadedRessources = parsedReqs.map(function (e) { return e.manifest; });
116
115
  return handleParsedResult(parsedResult.value.continue(loadedRessources));
117
116
  });