rx-player 3.33.1 → 3.33.3

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 (92) hide show
  1. package/CHANGELOG.md +1080 -1129
  2. package/VERSION +1 -1
  3. package/dist/_esm5.processed/compat/can_rely_on_request_media_key_system_access.d.ts +34 -0
  4. package/dist/_esm5.processed/compat/can_rely_on_request_media_key_system_access.js +40 -0
  5. package/dist/_esm5.processed/compat/generate_init_data.d.ts +14 -0
  6. package/dist/_esm5.processed/compat/generate_init_data.js +61 -0
  7. package/dist/_esm5.processed/compat/may_media_element_fail_on_undecipherable_data.d.ts +16 -0
  8. package/dist/_esm5.processed/compat/may_media_element_fail_on_undecipherable_data.js +17 -0
  9. package/dist/_esm5.processed/compat/should_wait_for_data_before_loaded.d.ts +1 -1
  10. package/dist/_esm5.processed/compat/should_wait_for_data_before_loaded.js +5 -3
  11. package/dist/_esm5.processed/config.d.ts +2 -0
  12. package/dist/_esm5.processed/core/adaptive/adaptive_representation_selector.js +1 -1
  13. package/dist/_esm5.processed/core/api/debug/buffer_graph.js +3 -3
  14. package/dist/_esm5.processed/core/api/public_api.d.ts +17 -0
  15. package/dist/_esm5.processed/core/api/public_api.js +41 -2
  16. package/dist/_esm5.processed/core/api/tracks_management/media_element_track_choice_manager.js +21 -25
  17. package/dist/_esm5.processed/core/decrypt/attach_media_keys.js +6 -6
  18. package/dist/_esm5.processed/core/decrypt/find_key_system.d.ts +10 -0
  19. package/dist/_esm5.processed/core/decrypt/find_key_system.js +42 -1
  20. package/dist/_esm5.processed/core/decrypt/session_events_listener.js +2 -2
  21. package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.js +2 -2
  22. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.js +1 -1
  23. package/dist/_esm5.processed/core/init/media_source_content_initializer.js +34 -12
  24. package/dist/_esm5.processed/core/init/utils/get_loaded_reference.js +6 -1
  25. package/dist/_esm5.processed/core/init/utils/initial_seek_and_play.js +4 -1
  26. package/dist/_esm5.processed/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.js +24 -25
  27. package/dist/_esm5.processed/core/segment_buffers/implementations/image/image_segment_buffer.js +1 -1
  28. package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/html_text_segment_buffer.js +1 -1
  29. package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/text_track_cues_store.js +2 -2
  30. package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/utils.d.ts +15 -0
  31. package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/utils.js +23 -0
  32. package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/native_text_segment_buffer.js +1 -1
  33. package/dist/_esm5.processed/core/segment_buffers/inventory/segment_inventory.d.ts +18 -4
  34. package/dist/_esm5.processed/core/segment_buffers/inventory/segment_inventory.js +57 -13
  35. package/dist/_esm5.processed/core/stream/adaptation/adaptation_stream.js +3 -0
  36. package/dist/_esm5.processed/core/stream/representation/utils/append_segment_to_buffer.js +15 -8
  37. package/dist/_esm5.processed/core/stream/representation/utils/get_buffer_status.js +1 -37
  38. package/dist/_esm5.processed/core/stream/representation/utils/get_needed_segments.js +19 -11
  39. package/dist/_esm5.processed/core/stream/representation/utils/push_init_segment.js +6 -6
  40. package/dist/_esm5.processed/core/stream/representation/utils/push_media_segment.js +9 -9
  41. package/dist/_esm5.processed/default_config.d.ts +31 -0
  42. package/dist/_esm5.processed/default_config.js +48 -17
  43. package/dist/_esm5.processed/errors/assertion_error.d.ts +0 -1
  44. package/dist/_esm5.processed/errors/assertion_error.js +1 -2
  45. package/dist/_esm5.processed/errors/custom_loader_error.d.ts +0 -1
  46. package/dist/_esm5.processed/errors/custom_loader_error.js +1 -2
  47. package/dist/_esm5.processed/errors/encrypted_media_error.d.ts +0 -1
  48. package/dist/_esm5.processed/errors/encrypted_media_error.js +1 -2
  49. package/dist/_esm5.processed/errors/media_error.d.ts +0 -1
  50. package/dist/_esm5.processed/errors/media_error.js +1 -2
  51. package/dist/_esm5.processed/errors/network_error.d.ts +0 -1
  52. package/dist/_esm5.processed/errors/network_error.js +1 -2
  53. package/dist/_esm5.processed/errors/other_error.d.ts +0 -1
  54. package/dist/_esm5.processed/errors/other_error.js +1 -2
  55. package/dist/_esm5.processed/errors/request_error.d.ts +0 -1
  56. package/dist/_esm5.processed/errors/request_error.js +17 -15
  57. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader_error.d.ts +0 -1
  58. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader_error.js +2 -2
  59. package/dist/_esm5.processed/experimental/tools/createMetaplaylist/get_duration_from_manifest.js +1 -1
  60. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/decodingInfo.js +4 -4
  61. package/dist/_esm5.processed/parsers/containers/isobmff/utils.js +3 -1
  62. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.js +1 -3
  63. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representation_index.js +9 -5
  64. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/utils.d.ts +0 -1
  65. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/utils.js +1 -2
  66. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/ContentComponent.d.ts +1 -1
  67. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/ContentComponent.js +1 -1
  68. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/ContentProtection.d.ts +1 -1
  69. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/ContentProtection.js +1 -1
  70. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/Scheme.d.ts +1 -1
  71. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/Scheme.js +1 -1
  72. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/parsers_stack.d.ts +2 -1
  73. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/types.d.ts +55 -55
  74. package/dist/_esm5.processed/parsers/manifest/smooth/parse_protection_node.js +1 -1
  75. package/dist/_esm5.processed/transports/dash/extract_complete_chunks.d.ts +1 -1
  76. package/dist/_esm5.processed/transports/dash/extract_complete_chunks.js +6 -2
  77. package/dist/_esm5.processed/transports/dash/low_latency_segment_loader.js +4 -2
  78. package/dist/_esm5.processed/utils/languages/ISO_639-1_to_ISO_639-3.js +182 -182
  79. package/dist/_esm5.processed/utils/languages/ISO_639-2_to_ISO_639-3.js +19 -19
  80. package/dist/_esm5.processed/utils/languages/normalize.js +4 -1
  81. package/dist/_esm5.processed/utils/resolve_url.d.ts +13 -10
  82. package/dist/_esm5.processed/utils/resolve_url.js +220 -69
  83. package/dist/_esm5.processed/utils/string_parsing.d.ts +1 -1
  84. package/dist/_esm5.processed/utils/string_parsing.js +1 -1
  85. package/dist/_esm5.processed/utils/task_canceller.d.ts +0 -1
  86. package/dist/_esm5.processed/utils/task_canceller.js +3 -2
  87. package/dist/mpd-parser.wasm +0 -0
  88. package/dist/rx-player.d.ts +1 -1
  89. package/dist/rx-player.js +3951 -3398
  90. package/dist/rx-player.min.d.ts +1 -1
  91. package/dist/rx-player.min.js +1 -1
  92. package/package.json +40 -40
@@ -13,78 +13,32 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- // Scheme part of an url (e.g. "http://").
17
- var schemeRe = /^(?:[a-z]+:)?\/\//i;
18
- // Captures "/../" or "/./".
19
- var selfDirRe = /\/\.{1,2}\//;
20
- /**
21
- * Resolve self directory and previous directory references to obtain a
22
- * "normalized" url.
23
- * @example "https://foo.bar/baz/booz/../biz" => "https://foo.bar/baz/biz"
24
- * @param {string} url
25
- * @returns {string}
26
- */
27
- function _normalizeUrl(url) {
28
- // fast path if no ./ or ../ are present in the url
29
- if (!selfDirRe.test(url)) {
30
- return url;
31
- }
32
- var newUrl = [];
33
- var oldUrl = url.split("/");
34
- for (var i = 0, l = oldUrl.length; i < l; i++) {
35
- if (oldUrl[i] === "..") {
36
- newUrl.pop();
37
- }
38
- else if (oldUrl[i] === ".") {
39
- continue;
40
- }
41
- else {
42
- newUrl.push(oldUrl[i]);
16
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
17
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
18
+ if (ar || !(i in from)) {
19
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
20
+ ar[i] = from[i];
43
21
  }
44
22
  }
45
- return newUrl.join("/");
46
- }
23
+ return to.concat(ar || Array.prototype.slice.call(from));
24
+ };
25
+ import startsWith from "./starts_with";
26
+ // Scheme part of an url (e.g. "http://").
27
+ var schemeRe = /^(?:[a-z]+:)?\/\//i;
47
28
  /**
48
- * Construct an url from the arguments given.
49
- * Basically:
50
- * - The last arguments that contains a scheme (e.g. "http://") is the base
51
- * of the url.
52
- * - every subsequent string arguments are concatened to it.
53
- * @param {...string|undefined} args
54
- * @returns {string}
55
- */
56
- export default function resolveURL() {
57
- var args = [];
58
- for (var _i = 0; _i < arguments.length; _i++) {
59
- args[_i] = arguments[_i];
60
- }
61
- var len = args.length;
62
- if (len === 0) {
63
- return "";
64
- }
65
- var base = "";
66
- for (var i = 0; i < len; i++) {
67
- var part = args[i];
68
- if (typeof part !== "string" || part === "") {
69
- continue;
70
- }
71
- if (schemeRe.test(part)) {
72
- base = part;
73
- }
74
- else {
75
- // trim if begins with "/"
76
- if (part[0] === "/") {
77
- part = part.substring(1);
78
- }
79
- // trim if ends with "/"
80
- if (base[base.length - 1] === "/") {
81
- base = base.substring(0, base.length - 1);
82
- }
83
- base = base + "/" + part;
84
- }
85
- }
86
- return _normalizeUrl(base);
87
- }
29
+ * Match the different components of an URL.
30
+ *
31
+ * foo://example.com:8042/over/there?name=ferret#nose
32
+ \_/ \______________/\_________/ \_________/ \__/
33
+ | | | | |
34
+ scheme authority path query fragment
35
+ * 1st match is the scheme: (e.g. "foo://")
36
+ * 2nd match is the authority (e.g "example.com:8042")
37
+ * 3rd match is the path (e.g "/over/there")
38
+ * 4th match is the query params (e.g "name=ferret")
39
+ * 5th match is the fragment (e.g "nose")
40
+ * */
41
+ var urlComponentRegex = /^(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?$/;
88
42
  /**
89
43
  * In a given URL, find the index at which the filename begins.
90
44
  * That is, this function finds the index of the last `/` character and returns
@@ -114,4 +68,201 @@ function getFilenameIndexInUrl(url) {
114
68
  }
115
69
  return indexOfLastSlash + 1;
116
70
  }
71
+ /**
72
+ * Resolve the output URL from the baseURL and the relative reference as
73
+ * specified by RFC 3986 section 5.
74
+ * @param base
75
+ * @param relative
76
+ * @see https://datatracker.ietf.org/doc/html/rfc3986#section-5
77
+ * @example base: http://example.com | relative: /b/c | output: http://example.com/b/c
78
+ * @returns the resolved url
79
+ */
80
+ function _resolveURL(base, relative) {
81
+ var baseParts = parseURL(base);
82
+ var relativeParts = parseURL(relative);
83
+ if (relativeParts.scheme) {
84
+ return formatURL(relativeParts);
85
+ }
86
+ var target = {
87
+ scheme: baseParts.scheme,
88
+ authority: baseParts.authority,
89
+ path: "",
90
+ query: relativeParts.query,
91
+ fragment: relativeParts.fragment,
92
+ };
93
+ if (relativeParts.authority) {
94
+ target.authority = relativeParts.authority;
95
+ target.path = removeDotSegment(relativeParts.path);
96
+ return formatURL(target);
97
+ }
98
+ if (relativeParts.path === "") {
99
+ target.path = baseParts.path;
100
+ if (!relativeParts.query) {
101
+ target.query = baseParts.query;
102
+ }
103
+ }
104
+ else {
105
+ if (startsWith(relativeParts.path, "/")) {
106
+ // path is absolute
107
+ target.path = removeDotSegment(relativeParts.path);
108
+ }
109
+ else {
110
+ // path is relative
111
+ target.path = removeDotSegment(mergePaths(baseParts, relativeParts.path));
112
+ }
113
+ }
114
+ return formatURL(target);
115
+ }
116
+ /**
117
+ * Cache to store already parsed URLs to avoid unnecessary computation when
118
+ * parsing the same URL again.
119
+ */
120
+ var parsedUrlCache = new Map();
121
+ /**
122
+ * Sets the maximum number of entries allowed in the parsedUrlCache map.
123
+ * This limit helps prevent excessive memory usage. The value is arbitrary.
124
+ */
125
+ var MAX_URL_CACHE_ENTRIES = 200;
126
+ /**
127
+ * Parses a URL into its components.
128
+ * @param {string} url - The URL to parse.
129
+ * @returns {IParsedURL} The parsed URL components.
130
+ */
131
+ function parseURL(url) {
132
+ var _a, _b, _c, _d, _e;
133
+ if (parsedUrlCache.has(url)) {
134
+ return parsedUrlCache.get(url);
135
+ }
136
+ var matches = url.match(urlComponentRegex);
137
+ var parsed;
138
+ if (matches === null) {
139
+ parsed = {
140
+ scheme: "",
141
+ authority: "",
142
+ path: "",
143
+ query: "",
144
+ fragment: "",
145
+ };
146
+ }
147
+ else {
148
+ parsed = {
149
+ scheme: (_a = matches[1]) !== null && _a !== void 0 ? _a : "",
150
+ authority: (_b = matches[2]) !== null && _b !== void 0 ? _b : "",
151
+ path: (_c = matches[3]) !== null && _c !== void 0 ? _c : "",
152
+ query: (_d = matches[4]) !== null && _d !== void 0 ? _d : "",
153
+ fragment: (_e = matches[5]) !== null && _e !== void 0 ? _e : "",
154
+ };
155
+ }
156
+ if (parsedUrlCache.size >= MAX_URL_CACHE_ENTRIES) {
157
+ parsedUrlCache.clear();
158
+ }
159
+ parsedUrlCache.set(url, parsed);
160
+ return parsed;
161
+ }
162
+ /**
163
+ * Formats a parsed URL into a string.
164
+ * @param {IParsedURL} parts - The parsed URL components.
165
+ * @returns {string} The formatted URL string.
166
+ */
167
+ function formatURL(parts) {
168
+ var url = "";
169
+ if (parts.scheme) {
170
+ url += parts.scheme + ":";
171
+ }
172
+ if (parts.authority) {
173
+ url += "//" + parts.authority;
174
+ }
175
+ url += parts.path;
176
+ if (parts.query) {
177
+ url += "?" + parts.query;
178
+ }
179
+ if (parts.fragment) {
180
+ url += "#" + parts.fragment;
181
+ }
182
+ return url;
183
+ }
184
+ /**
185
+ * Removes "." and ".." from the URL path, as described by the algorithm
186
+ * in RFC 3986 Section 5.2.4. Remove Dot Segments
187
+ * @param {string} path - The URL path
188
+ * @see https://datatracker.ietf.org/doc/html/rfc3986#section-5.2.4
189
+ * @returns The path with dot segments removed.
190
+ * @example "/baz/booz/../biz" => "/baz/biz"
191
+ */
192
+ function removeDotSegment(path) {
193
+ var segments = path.split(/(?=\/)/);
194
+ var output = [];
195
+ for (var i = 0; i < segments.length; i++) {
196
+ var segment = segments[i];
197
+ if (segment === ".." || segment === "." || segment === "") {
198
+ continue;
199
+ }
200
+ if (segment === "/..") {
201
+ output.pop();
202
+ // if it's last segment push a trailing "/"
203
+ if (i === segments.length - 1) {
204
+ output.push("/");
205
+ }
206
+ continue;
207
+ }
208
+ if (segment === "/.") {
209
+ // if it's last segment push a trailing "/"
210
+ if (i === segments.length - 1) {
211
+ output.push("/");
212
+ }
213
+ continue;
214
+ }
215
+ output.push(segment);
216
+ }
217
+ return output.join("");
218
+ }
219
+ /**
220
+ * Merges a base URL path with a relative URL path, as described by
221
+ * the algorithm merge paths in RFC 3986 Section 5.2.3. Merge Paths
222
+ * @param {IParsedURL} baseParts - The parsed base URL components.
223
+ * @param {string} relativePath - The relative URL path.
224
+ * @returns {string} The merged URL path.
225
+ * @see https://datatracker.ietf.org/doc/html/rfc3986#section-5.2.3
226
+ */
227
+ function mergePaths(baseParts, relativePath) {
228
+ if (baseParts.authority && baseParts.path === "") {
229
+ return "/" + relativePath;
230
+ }
231
+ var basePath = baseParts.path;
232
+ return basePath.substring(0, basePath.lastIndexOf("/") + 1) + relativePath;
233
+ }
234
+ /**
235
+ * Resolves multiple URL segments using the RFC 3986 URL resolution algorithm.
236
+ *
237
+ * This function takes a variable number of URL segments and resolves them
238
+ * sequentially according to the RFC 3986 URL resolution algorithm.
239
+ * First argument is the base URL.
240
+ * Empty string arguments are ignored.
241
+ *
242
+ * @param {...(string|undefined)} args - The URL segments to resolve.
243
+ * @returns {string} The resolved URL as a string.
244
+ */
245
+ export function resolveURL() {
246
+ var _a, _b, _c;
247
+ var args = [];
248
+ for (var _i = 0; _i < arguments.length; _i++) {
249
+ args[_i] = arguments[_i];
250
+ }
251
+ var filteredArgs = args.filter(function (val) { return val !== ""; });
252
+ var len = filteredArgs.length;
253
+ if (len === 0) {
254
+ return "";
255
+ }
256
+ if (len === 1) {
257
+ return (_a = filteredArgs[0]) !== null && _a !== void 0 ? _a : "";
258
+ }
259
+ else {
260
+ var basePart = (_b = filteredArgs[0]) !== null && _b !== void 0 ? _b : "";
261
+ var relativeParts = (_c = filteredArgs[1]) !== null && _c !== void 0 ? _c : "";
262
+ var resolvedURL = _resolveURL(basePart, relativeParts);
263
+ var remainingArgs = filteredArgs.slice(2);
264
+ return resolveURL.apply(void 0, __spreadArray([resolvedURL], remainingArgs, false));
265
+ }
266
+ }
117
267
  export { getFilenameIndexInUrl };
268
+ export default resolveURL;
@@ -22,7 +22,7 @@
22
22
  declare function strToUtf16LE(str: string): Uint8Array;
23
23
  /**
24
24
  * Convert a string to an Uint8Array containing the corresponding UTF-16 code
25
- * units in little-endian.
25
+ * units in big-endian.
26
26
  * @param {string} str
27
27
  * @returns {Uint8Array}
28
28
  */
@@ -37,7 +37,7 @@ function strToUtf16LE(str) {
37
37
  }
38
38
  /**
39
39
  * Convert a string to an Uint8Array containing the corresponding UTF-16 code
40
- * units in little-endian.
40
+ * units in big-endian.
41
41
  * @param {string} str
42
42
  * @returns {Uint8Array}
43
43
  */
@@ -258,6 +258,5 @@ export type ICancellationListener = (error: CancellationError) => void;
258
258
  */
259
259
  export declare class CancellationError extends Error {
260
260
  readonly name: "CancellationError";
261
- readonly message: string;
262
261
  constructor();
263
262
  }
@@ -297,11 +297,12 @@ export { CancellationSignal };
297
297
  var CancellationError = /** @class */ (function (_super) {
298
298
  __extends(CancellationError, _super);
299
299
  function CancellationError() {
300
- var _this = _super.call(this) || this;
300
+ var _this = this;
301
+ var message = "This task was cancelled.";
302
+ _this = _super.call(this, message) || this;
301
303
  // @see https://stackoverflow.com/questions/41102060/typescript-extending-error-class
302
304
  Object.setPrototypeOf(_this, CancellationError.prototype);
303
305
  _this.name = "CancellationError";
304
- _this.message = "This task was cancelled.";
305
306
  return _this;
306
307
  }
307
308
  return CancellationError;
Binary file
@@ -1,3 +1,3 @@
1
1
 
2
- import RxPlayer from "./_esm5.processed/index";
2
+ import RxPlayer from "./_esm5.processed/minimal";
3
3
  export default RxPlayer;