rx-player 4.5.0-dev.2026012302 → 4.5.0-dev.2026021900

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 (108) hide show
  1. package/CHANGELOG.md +9 -1
  2. package/VERSION +1 -1
  3. package/dist/commonjs/__GENERATED_CODE/embedded_dash_wasm.d.ts.map +1 -1
  4. package/dist/commonjs/__GENERATED_CODE/embedded_dash_wasm.js +1 -1
  5. package/dist/commonjs/__GENERATED_CODE/embedded_worker.d.ts.map +1 -1
  6. package/dist/commonjs/__GENERATED_CODE/embedded_worker.js +1 -1
  7. package/dist/commonjs/compat/should_seek_at_zero.d.ts +12 -0
  8. package/dist/commonjs/compat/should_seek_at_zero.d.ts.map +1 -0
  9. package/dist/commonjs/compat/should_seek_at_zero.js +23 -0
  10. package/dist/commonjs/core/entry/FreezeResolver.js +2 -2
  11. package/dist/commonjs/core/entry/content_time_boundaries_observer.d.ts.map +1 -1
  12. package/dist/commonjs/core/entry/content_time_boundaries_observer.js +8 -0
  13. package/dist/commonjs/core/stream/representation/encryption_data_notifier.d.ts +70 -0
  14. package/dist/commonjs/core/stream/representation/encryption_data_notifier.d.ts.map +1 -0
  15. package/dist/commonjs/core/stream/representation/encryption_data_notifier.js +107 -0
  16. package/dist/commonjs/core/stream/representation/representation_stream.d.ts.map +1 -1
  17. package/dist/commonjs/core/stream/representation/representation_stream.js +12 -60
  18. package/dist/commonjs/core/stream/representation/utils/get_needed_segments.js +1 -1
  19. package/dist/commonjs/default_config.d.ts +5 -0
  20. package/dist/commonjs/default_config.d.ts.map +1 -1
  21. package/dist/commonjs/default_config.js +5 -0
  22. package/dist/commonjs/main_thread/api/public_api.d.ts.map +1 -1
  23. package/dist/commonjs/main_thread/api/public_api.js +27 -3
  24. package/dist/commonjs/main_thread/init/directfile_content_initializer.d.ts.map +1 -1
  25. package/dist/commonjs/main_thread/init/directfile_content_initializer.js +23 -1
  26. package/dist/commonjs/main_thread/init/utils/initial_seek_and_play.d.ts.map +1 -1
  27. package/dist/commonjs/main_thread/init/utils/initial_seek_and_play.js +3 -1
  28. package/dist/commonjs/manifest/classes/index.d.ts +2 -1
  29. package/dist/commonjs/manifest/classes/index.d.ts.map +1 -1
  30. package/dist/commonjs/manifest/classes/representation.d.ts +1 -1
  31. package/dist/commonjs/manifest/classes/representation.d.ts.map +1 -1
  32. package/dist/commonjs/manifest/classes/representation.js +2 -2
  33. package/dist/commonjs/manifest/classes/representation_index/types.d.ts +2 -2
  34. package/dist/commonjs/utils/base64.d.ts +15 -1
  35. package/dist/commonjs/utils/base64.d.ts.map +1 -1
  36. package/dist/commonjs/utils/base64.js +6 -0
  37. package/dist/commonjs/utils/ranges.d.ts +1 -1
  38. package/dist/commonjs/utils/ranges.js +1 -1
  39. package/dist/es2017/__GENERATED_CODE/embedded_dash_wasm.d.ts.map +1 -1
  40. package/dist/es2017/__GENERATED_CODE/embedded_dash_wasm.js +1 -1
  41. package/dist/es2017/__GENERATED_CODE/embedded_worker.d.ts.map +1 -1
  42. package/dist/es2017/__GENERATED_CODE/embedded_worker.js +1 -1
  43. package/dist/es2017/compat/should_seek_at_zero.d.ts +12 -0
  44. package/dist/es2017/compat/should_seek_at_zero.d.ts.map +1 -0
  45. package/dist/es2017/compat/should_seek_at_zero.js +20 -0
  46. package/dist/es2017/core/entry/FreezeResolver.js +1 -1
  47. package/dist/es2017/core/entry/content_time_boundaries_observer.d.ts.map +1 -1
  48. package/dist/es2017/core/entry/content_time_boundaries_observer.js +8 -0
  49. package/dist/es2017/core/stream/representation/encryption_data_notifier.d.ts +70 -0
  50. package/dist/es2017/core/stream/representation/encryption_data_notifier.d.ts.map +1 -0
  51. package/dist/es2017/core/stream/representation/encryption_data_notifier.js +80 -0
  52. package/dist/es2017/core/stream/representation/representation_stream.d.ts.map +1 -1
  53. package/dist/es2017/core/stream/representation/representation_stream.js +10 -38
  54. package/dist/es2017/core/stream/representation/utils/get_needed_segments.js +1 -1
  55. package/dist/es2017/default_config.d.ts +5 -0
  56. package/dist/es2017/default_config.d.ts.map +1 -1
  57. package/dist/es2017/default_config.js +5 -0
  58. package/dist/es2017/main_thread/api/public_api.d.ts.map +1 -1
  59. package/dist/es2017/main_thread/api/public_api.js +27 -3
  60. package/dist/es2017/main_thread/init/directfile_content_initializer.d.ts.map +1 -1
  61. package/dist/es2017/main_thread/init/directfile_content_initializer.js +23 -1
  62. package/dist/es2017/main_thread/init/utils/initial_seek_and_play.d.ts.map +1 -1
  63. package/dist/es2017/main_thread/init/utils/initial_seek_and_play.js +3 -1
  64. package/dist/es2017/manifest/classes/index.d.ts +2 -1
  65. package/dist/es2017/manifest/classes/index.d.ts.map +1 -1
  66. package/dist/es2017/manifest/classes/representation.d.ts +1 -1
  67. package/dist/es2017/manifest/classes/representation.d.ts.map +1 -1
  68. package/dist/es2017/manifest/classes/representation.js +1 -1
  69. package/dist/es2017/manifest/classes/representation_index/types.d.ts +2 -2
  70. package/dist/es2017/utils/base64.d.ts +15 -1
  71. package/dist/es2017/utils/base64.d.ts.map +1 -1
  72. package/dist/es2017/utils/base64.js +6 -0
  73. package/dist/es2017/utils/ranges.d.ts +1 -1
  74. package/dist/es2017/utils/ranges.js +1 -1
  75. package/dist/mpd-parser.wasm +0 -0
  76. package/dist/worker.js +6 -6
  77. package/package.json +9 -3
  78. package/src/__GENERATED_CODE/embedded_dash_wasm.ts +1 -1
  79. package/src/__GENERATED_CODE/embedded_worker.ts +1 -1
  80. package/src/compat/should_seek_at_zero.ts +23 -0
  81. package/src/core/adaptive/__tests__/guess_based_chooser.test.ts +790 -0
  82. package/src/core/adaptive/__tests__/network_analyzer.test.ts +514 -0
  83. package/src/core/adaptive/utils/__tests__/pending_requests_store.test.ts +285 -0
  84. package/src/core/adaptive/utils/__tests__/representation_score_calculator.test.ts +247 -0
  85. package/src/core/entry/FreezeResolver.ts +1 -1
  86. package/src/core/entry/__tests__/FreezeResolver.test.ts +542 -0
  87. package/src/core/entry/__tests__/content_time_boundaries_observer.test.ts +868 -0
  88. package/src/core/entry/content_time_boundaries_observer.ts +10 -0
  89. package/src/core/stream/adaptation/__tests__/get_representations_switch_strategy.test.ts +592 -0
  90. package/src/core/stream/period/utils/__tests__/get_adaptation_switch_strategy.test.ts +646 -0
  91. package/src/core/stream/representation/__tests__/encryption_data_notifier.test.ts +531 -0
  92. package/src/core/stream/representation/encryption_data_notifier.ts +122 -0
  93. package/src/core/stream/representation/representation_stream.ts +11 -49
  94. package/src/core/stream/representation/utils/__tests__/append_segment_to_buffer.test.ts +321 -0
  95. package/src/core/stream/representation/utils/__tests__/check_for_discontinuity.test.ts +513 -0
  96. package/src/core/stream/representation/utils/__tests__/get_segment_priority.test.ts +132 -0
  97. package/src/core/stream/representation/utils/__tests__/push_init_segment.test.ts +209 -0
  98. package/src/core/stream/representation/utils/__tests__/push_media_segment.test.ts +343 -0
  99. package/src/core/stream/representation/utils/get_needed_segments.ts +1 -1
  100. package/src/default_config.ts +6 -0
  101. package/src/main_thread/api/public_api.ts +32 -3
  102. package/src/main_thread/init/directfile_content_initializer.ts +26 -1
  103. package/src/main_thread/init/utils/initial_seek_and_play.ts +5 -1
  104. package/src/manifest/classes/index.ts +2 -0
  105. package/src/manifest/classes/representation.ts +2 -1
  106. package/src/manifest/classes/representation_index/types.ts +2 -2
  107. package/src/utils/base64.ts +30 -1
  108. package/src/utils/ranges.ts +1 -1
@@ -21,6 +21,7 @@ import Manifest from "./manifest";
21
21
  import Period from "./period";
22
22
  import type { IThumbnailTrack } from "./period";
23
23
  import Representation from "./representation";
24
+ import type { IRepresentationProtectionData } from "./representation";
24
25
  import type {
25
26
  IMetaPlaylistPrivateInfos,
26
27
  IPrivateInfos,
@@ -41,6 +42,7 @@ export type {
41
42
  IManifestParsingOptions,
42
43
  IMetaPlaylistPrivateInfos,
43
44
  IRepresentationIndex,
45
+ IRepresentationProtectionData,
44
46
  IPrivateInfos,
45
47
  ISegment,
46
48
  IThumbnailTrack,
@@ -15,7 +15,6 @@
15
15
  */
16
16
 
17
17
  import log from "../../log";
18
- import { isRepresentationPlayable, type IRepresentationMetadata } from "../../manifest";
19
18
  import type {
20
19
  ICdnMetadata,
21
20
  IContentProtections,
@@ -25,6 +24,8 @@ import type { ITrackType, IHDRInformation } from "../../public_types";
25
24
  import areArraysOfNumbersEqual from "../../utils/are_arrays_of_numbers_equal";
26
25
  import idGenerator from "../../utils/id_generator";
27
26
  import { bytesToHex } from "../../utils/string_parsing";
27
+ import type { IRepresentationMetadata } from "../types";
28
+ import { isRepresentationPlayable } from "../utils";
28
29
  import type codecSupportCache from "./codec_support_cache";
29
30
  import type { IRepresentationIndex } from "./representation_index";
30
31
 
@@ -456,8 +456,8 @@ export interface IRepresentationIndex {
456
456
  * Add segments to a RepresentationIndex that were predicted after parsing the
457
457
  * segment linked to `currentSegment`.
458
458
  * @param {Array.<Object>} nextSegments - The segment information parsed.
459
- * @param {Object} segment - Information on the segment which contained that
460
- * new segment information.
459
+ * @param {Object} currentSegment - Information on the segment which contained
460
+ * that new segment information.
461
461
  */
462
462
  addPredictedSegments(
463
463
  nextSegments: ISegmentInformation[],
@@ -126,6 +126,29 @@ const base64codes = [
126
126
  47, 48, 49, 50, 51,
127
127
  ];
128
128
 
129
+ // Not yet in ECMAScript, but present in most browsers
130
+ // (2024 for SpiderMonkey, 2025 for V8)
131
+ declare global {
132
+ interface Uint8Array {
133
+ // https://tc39.es/proposal-arraybuffer-base64/spec/#sec-uint8array.prototype.tobase64
134
+ toBase64(options?: {
135
+ alphabet?: "base64" | "base64url";
136
+ omitPadding?: boolean;
137
+ }): string;
138
+ }
139
+
140
+ interface Uint8ArrayConstructor {
141
+ // https://tc39.es/proposal-arraybuffer-base64/spec/#sec-uint8array.frombase64
142
+ fromBase64(
143
+ base64: string,
144
+ options?: {
145
+ alphabet?: "base64" | "base64url";
146
+ lastChunkHandling?: "loose" | "strict" | "stop-before-partial";
147
+ },
148
+ ): Uint8Array<ArrayBuffer>;
149
+ }
150
+ }
151
+
129
152
  /**
130
153
  * Obtain the value corresponding to a base64 char code.
131
154
  * /!\ Can throw if the char code given is invalid.
@@ -148,7 +171,10 @@ function getBase64Code(charCode: number): number {
148
171
  * @param {Array.<number>|Uint8Array} bytes
149
172
  * @returns {string}
150
173
  */
151
- export function bytesToBase64(bytes: number[] | Uint8Array): string {
174
+ export function bytesToBase64(bytes: Uint8Array): string {
175
+ if (typeof bytes.toBase64 === "function") {
176
+ return bytes.toBase64();
177
+ }
152
178
  let result = "";
153
179
  let i;
154
180
  const length = bytes.length;
@@ -182,6 +208,9 @@ export function bytesToBase64(bytes: number[] | Uint8Array): string {
182
208
  * @returns {string}
183
209
  */
184
210
  export function base64ToBytes(str: string): Uint8Array<ArrayBuffer> {
211
+ if (typeof Uint8Array.fromBase64 === "function") {
212
+ return Uint8Array.fromBase64(str);
213
+ }
185
214
  const paddingNeeded = str.length % 4;
186
215
  let paddedStr = str;
187
216
  if (paddingNeeded !== 0) {
@@ -135,7 +135,7 @@ function isTimeInRanges(ranges: IRange[], time: number): boolean {
135
135
  /**
136
136
  * Returns true if the time given can be considered as part of the given range.
137
137
  * @param {Object} range1
138
- * @param {Number} Time
138
+ * @param {number} time
139
139
  * @returns {Boolean}
140
140
  */
141
141
  function isTimeInRange({ start, end }: IRange, time: number): boolean {