rx-player 3.33.2 → 3.33.4-dev.2024080600

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 (94) hide show
  1. package/CHANGELOG.md +1079 -1128
  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/template.js +1 -1
  63. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.js +5 -6
  64. package/dist/_esm5.processed/parsers/manifest/dash/common/manifest_bounds_calculator.d.ts +6 -2
  65. package/dist/_esm5.processed/parsers/manifest/dash/common/manifest_bounds_calculator.js +7 -3
  66. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_mpd.js +17 -1
  67. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representation_index.js +9 -5
  68. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/utils.d.ts +0 -1
  69. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/utils.js +1 -2
  70. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/ContentComponent.d.ts +1 -1
  71. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/ContentComponent.js +1 -1
  72. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/ContentProtection.d.ts +1 -1
  73. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/ContentProtection.js +1 -1
  74. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/Scheme.d.ts +1 -1
  75. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/Scheme.js +1 -1
  76. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/parsers_stack.d.ts +2 -1
  77. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/types.d.ts +55 -55
  78. package/dist/_esm5.processed/parsers/manifest/smooth/parse_protection_node.js +1 -1
  79. package/dist/_esm5.processed/transports/dash/extract_complete_chunks.d.ts +1 -1
  80. package/dist/_esm5.processed/transports/dash/extract_complete_chunks.js +6 -2
  81. package/dist/_esm5.processed/transports/dash/low_latency_segment_loader.js +4 -2
  82. package/dist/_esm5.processed/utils/languages/ISO_639-1_to_ISO_639-3.js +182 -182
  83. package/dist/_esm5.processed/utils/languages/ISO_639-2_to_ISO_639-3.js +19 -19
  84. package/dist/_esm5.processed/utils/languages/normalize.js +4 -1
  85. package/dist/_esm5.processed/utils/resolve_url.d.ts +13 -10
  86. package/dist/_esm5.processed/utils/resolve_url.js +220 -69
  87. package/dist/_esm5.processed/utils/string_parsing.d.ts +1 -1
  88. package/dist/_esm5.processed/utils/string_parsing.js +1 -1
  89. package/dist/_esm5.processed/utils/task_canceller.d.ts +0 -1
  90. package/dist/_esm5.processed/utils/task_canceller.js +3 -2
  91. package/dist/mpd-parser.wasm +0 -0
  92. package/dist/rx-player.js +3978 -3404
  93. package/dist/rx-player.min.js +1 -1
  94. package/package.json +40 -40
@@ -28,6 +28,7 @@ import config from "../../../../../../config";
28
28
  import { NetworkError } from "../../../../../../errors";
29
29
  import log from "../../../../../../log";
30
30
  import assert from "../../../../../../utils/assert";
31
+ import isNullOrUndefined from "../../../../../../utils/is_null_or_undefined";
31
32
  import clearTimelineFromPosition from "../../../../utils/clear_timeline_from_position";
32
33
  import { checkDiscontinuity, fromIndexTime, getIndexSegmentEnd, toIndexTime, } from "../../../../utils/index_helpers";
33
34
  import updateSegmentTimeline from "../../../../utils/update_segment_timeline";
@@ -137,9 +138,7 @@ var TimelineRepresentationIndex = /** @class */ (function () {
137
138
  if (this._index.timeline === null) {
138
139
  this._index.timeline = this._getTimeline();
139
140
  }
140
- // destructuring to please TypeScript
141
- var _a = this._index, segmentUrlTemplate = _a.segmentUrlTemplate, startNumber = _a.startNumber, endNumber = _a.endNumber, timeline = _a.timeline, timescale = _a.timescale, indexTimeOffset = _a.indexTimeOffset;
142
- return getSegmentsFromTimeline({ segmentUrlTemplate: segmentUrlTemplate, startNumber: startNumber, endNumber: endNumber, timeline: timeline, timescale: timescale, indexTimeOffset: indexTimeOffset }, from, duration, this._manifestBoundsCalculator, this._scaledPeriodEnd, this._isEMSGWhitelisted);
141
+ return getSegmentsFromTimeline(this._index, from, duration, this._manifestBoundsCalculator, this._scaledPeriodEnd, this._isEMSGWhitelisted);
143
142
  };
144
143
  /**
145
144
  * Returns true if the index should be refreshed.
@@ -441,15 +440,15 @@ var TimelineRepresentationIndex = /** @class */ (function () {
441
440
  * available due to timeshifting.
442
441
  */
443
442
  TimelineRepresentationIndex.prototype._refreshTimeline = function () {
443
+ var _a, _b;
444
444
  if (this._index.timeline === null) {
445
445
  this._index.timeline = this._getTimeline();
446
446
  }
447
447
  if (!this._isDynamic) {
448
448
  return;
449
449
  }
450
- var firstPosition = this._manifestBoundsCalculator
451
- .getEstimatedMinimumSegmentTime();
452
- if (firstPosition == null) {
450
+ var firstPosition = this._manifestBoundsCalculator.getEstimatedMinimumSegmentTime(((_b = (_a = this._index.timeline[0]) === null || _a === void 0 ? void 0 : _a.duration) !== null && _b !== void 0 ? _b : 0) / this._index.timescale);
451
+ if (isNullOrUndefined(firstPosition)) {
453
452
  return; // we don't know yet
454
453
  }
455
454
  var scaledFirstPosition = toIndexTime(firstPosition, this._index);
@@ -82,10 +82,14 @@ export default class ManifestBoundsCalculator {
82
82
  /**
83
83
  * Estimate a minimum bound for the content from the last set segment time
84
84
  * and buffer depth.
85
- * Consider that it is only an estimation, not the real value.
85
+ * Consider that it is only an estimate, not the real value.
86
+ * @param {number} segmentDuration - In DASH, the buffer depth actually also
87
+ * depend on a corresponding's segment duration (e.g. a segment become
88
+ * unavailable once the `timeShiftBufferDepth` + its duration has elapsed).
89
+ * This argument can thus be set the approximate duration of a segment.
86
90
  * @return {number|undefined}
87
91
  */
88
- getEstimatedMinimumSegmentTime(): number | undefined;
92
+ getEstimatedMinimumSegmentTime(segmentDuration: number): number | undefined;
89
93
  /**
90
94
  * Estimate the segment time in seconds that corresponds to what could be
91
95
  * considered the live edge (or `undefined` for non-live contents).
@@ -70,10 +70,14 @@ var ManifestBoundsCalculator = /** @class */ (function () {
70
70
  /**
71
71
  * Estimate a minimum bound for the content from the last set segment time
72
72
  * and buffer depth.
73
- * Consider that it is only an estimation, not the real value.
73
+ * Consider that it is only an estimate, not the real value.
74
+ * @param {number} segmentDuration - In DASH, the buffer depth actually also
75
+ * depend on a corresponding's segment duration (e.g. a segment become
76
+ * unavailable once the `timeShiftBufferDepth` + its duration has elapsed).
77
+ * This argument can thus be set the approximate duration of a segment.
74
78
  * @return {number|undefined}
75
79
  */
76
- ManifestBoundsCalculator.prototype.getEstimatedMinimumSegmentTime = function () {
80
+ ManifestBoundsCalculator.prototype.getEstimatedMinimumSegmentTime = function (segmentDuration) {
77
81
  var _a;
78
82
  if (!this._isDynamic || this._timeShiftBufferDepth === null) {
79
83
  return 0;
@@ -82,7 +86,7 @@ var ManifestBoundsCalculator = /** @class */ (function () {
82
86
  if (maximumBound === undefined) {
83
87
  return undefined;
84
88
  }
85
- var minimumBound = maximumBound - this._timeShiftBufferDepth;
89
+ var minimumBound = maximumBound - (this._timeShiftBufferDepth + segmentDuration);
86
90
  return minimumBound;
87
91
  };
88
92
  /**
@@ -143,6 +143,7 @@ function parseCompleteIntermediateRepresentation(mpdIR, args, warnings, xlinkInf
143
143
  var mpdBaseUrls = resolveBaseURLs(initialBaseUrl, rootChildren.baseURLs);
144
144
  var availabilityStartTime = parseAvailabilityStartTime(rootAttributes, args.referenceDateTime);
145
145
  var timeShiftBufferDepth = rootAttributes.timeShiftBufferDepth;
146
+ var maxSegmentDuration = rootAttributes.maxSegmentDuration;
146
147
  var clockOffset = args.externalClockOffset, unsafelyBaseOnPreviousManifest = args.unsafelyBaseOnPreviousManifest;
147
148
  var externalClockOffset = args.externalClockOffset;
148
149
  var manifestBoundsCalculator = new ManifestBoundsCalculator({
@@ -225,7 +226,22 @@ function parseCompleteIntermediateRepresentation(mpdIR, args, warnings, xlinkInf
225
226
  // can go even lower in terms of depth
226
227
  minimumTime = minimumSafePosition;
227
228
  timeshiftDepth = timeShiftBufferDepth !== null && timeShiftBufferDepth !== void 0 ? timeShiftBufferDepth : null;
228
- if (timeshiftDepth !== null && minimumTime !== undefined &&
229
+ if (timeshiftDepth !== null) {
230
+ // The DASH spec implies that a segment is still available after a given
231
+ // `timeShiftBufferDepth` for a time equal to its duration
232
+ // (What I interpret from "ISO/IEC 23009-1 fifth edition 2022-08
233
+ // A.3.4 Media Segment list restrictions).
234
+ //
235
+ // This `timeshiftDepth` property is global for the whole Manifest (and
236
+ // not per segment), thus we cannot do exactly that, but we can take the
237
+ // anounced `maxSegmentDuration` by default instead. This may be a little
238
+ // too optimistic, but would in reality not lead to a lot of issues as
239
+ // this `timeshiftDepth` property is not the one that should be relied on
240
+ // to know which segment can or cannot be requested anymore.
241
+ timeshiftDepth += maxSegmentDuration !== null && maxSegmentDuration !== void 0 ? maxSegmentDuration : 0;
242
+ }
243
+ if (timeshiftDepth !== null &&
244
+ minimumTime !== undefined &&
229
245
  livePosition - minimumTime > timeshiftDepth) {
230
246
  timeshiftDepth = livePosition - minimumTime;
231
247
  }
@@ -32,7 +32,7 @@ import { BaseRepresentationIndex, ListRepresentationIndex, TemplateRepresentatio
32
32
  * @returns {Array.<Object>}
33
33
  */
34
34
  export default function parseRepresentationIndex(representation, context) {
35
- var _a, _b;
35
+ var _a, _b, _c;
36
36
  var availabilityTimeOffset = context.availabilityTimeOffset, manifestBoundsCalculator = context.manifestBoundsCalculator, isDynamic = context.isDynamic, periodEnd = context.end, periodStart = context.start, receivedTime = context.receivedTime, unsafelyBaseOnPreviousRepresentation = context.unsafelyBaseOnPreviousRepresentation, inbandEventStreams = context.inbandEventStreams, isLastPeriod = context.isLastPeriod;
37
37
  var isEMSGWhitelisted = function (inbandEvent) {
38
38
  if (inbandEventStreams === undefined) {
@@ -81,10 +81,14 @@ export default function parseRepresentationIndex(representation, context) {
81
81
  ((_a = segmentTemplate.availabilityTimeOffset) !== null && _a !== void 0 ? _a : 0) +
82
82
  ((_b = context.availabilityTimeOffset) !== null && _b !== void 0 ? _b : 0);
83
83
  }
84
- representationIndex = TimelineRepresentationIndex
85
- .isTimelineIndexArgument(segmentTemplate) ?
86
- new TimelineRepresentationIndex(segmentTemplate, reprIndexCtxt) :
87
- new TemplateRepresentationIndex(segmentTemplate, reprIndexCtxt);
84
+ if (segmentTemplate.availabilityTimeComplete !== undefined ||
85
+ context.availabilityTimeComplete !== undefined) {
86
+ reprIndexCtxt.availabilityTimeComplete =
87
+ (_c = segmentTemplate.availabilityTimeComplete) !== null && _c !== void 0 ? _c : context.availabilityTimeComplete;
88
+ }
89
+ representationIndex = TimelineRepresentationIndex.isTimelineIndexArgument(segmentTemplate)
90
+ ? new TimelineRepresentationIndex(segmentTemplate, reprIndexCtxt)
91
+ : new TemplateRepresentationIndex(segmentTemplate, reprIndexCtxt);
88
92
  }
89
93
  else {
90
94
  var adaptationChildren = context.adaptation.children;
@@ -169,7 +169,6 @@ declare function ValueParser<T>(dest: T, warnings: Error[]): (val: string, { asK
169
169
  */
170
170
  declare class MPDError extends Error {
171
171
  readonly name: "MPDError";
172
- readonly message: string;
173
172
  /**
174
173
  * @param {string} message
175
174
  */
@@ -296,11 +296,10 @@ var MPDError = /** @class */ (function (_super) {
296
296
  * @param {string} message
297
297
  */
298
298
  function MPDError(message) {
299
- var _this = _super.call(this) || this;
299
+ var _this = _super.call(this, message) || this;
300
300
  // @see https://stackoverflow.com/questions/41102060/typescript-extending-error-class
301
301
  Object.setPrototypeOf(_this, MPDError.prototype);
302
302
  _this.name = "MPDError";
303
- _this.message = message;
304
303
  return _this;
305
304
  }
306
305
  return MPDError;
@@ -17,7 +17,7 @@ import { IContentComponentAttributes } from "../../../node_parser_types";
17
17
  import { IAttributeParser } from "../parsers_stack";
18
18
  /**
19
19
  * Generate an "attribute parser" once inside a `BaseURL` node.
20
- * @param {Object} baseUrlAttrs
20
+ * @param {Object} ccAttrs
21
21
  * @param {WebAssembly.Memory} linearMemory
22
22
  * @returns {Function}
23
23
  */
@@ -16,7 +16,7 @@
16
16
  import { parseString } from "../utils";
17
17
  /**
18
18
  * Generate an "attribute parser" once inside a `BaseURL` node.
19
- * @param {Object} baseUrlAttrs
19
+ * @param {Object} ccAttrs
20
20
  * @param {WebAssembly.Memory} linearMemory
21
21
  * @returns {Function}
22
22
  */
@@ -16,7 +16,7 @@
16
16
  import { IContentProtectionIntermediateRepresentation } from "../../../node_parser_types";
17
17
  import { IAttributeParser } from "../parsers_stack";
18
18
  /**
19
- * @param {Object} cpAttrs
19
+ * @param {Object} cp
20
20
  * @param {WebAssembly.Memory} linearMemory
21
21
  * @returns {Function}
22
22
  */
@@ -17,7 +17,7 @@ import { base64ToBytes } from "../../../../../../utils/base64";
17
17
  import { hexToBytes } from "../../../../../../utils/string_parsing";
18
18
  import { parseString } from "../utils";
19
19
  /**
20
- * @param {Object} cpAttrs
20
+ * @param {Object} cp
21
21
  * @param {WebAssembly.Memory} linearMemory
22
22
  * @returns {Function}
23
23
  */
@@ -17,7 +17,7 @@ import { IScheme } from "../../../node_parser_types";
17
17
  import { IAttributeParser } from "../parsers_stack";
18
18
  /**
19
19
  * Generate an "attribute parser" once inside a `BaseURL` node.
20
- * @param {Object} baseUrlAttrs
20
+ * @param {Object} schemeAttrs
21
21
  * @param {WebAssembly.Memory} linearMemory
22
22
  * @returns {Function}
23
23
  */
@@ -16,7 +16,7 @@
16
16
  import { parseString } from "../utils";
17
17
  /**
18
18
  * Generate an "attribute parser" once inside a `BaseURL` node.
19
- * @param {Object} baseUrlAttrs
19
+ * @param {Object} schemeAttrs
20
20
  * @param {WebAssembly.Memory} linearMemory
21
21
  * @returns {Function}
22
22
  */
@@ -13,10 +13,11 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ import { AttributeName } from "./types";
16
17
  /** Type of the function called when a Node opening is encountered. */
17
18
  export type IChildrenParser = (node: number) => void;
18
19
  /** Type of the function called when an attribute is encountered. */
19
- export type IAttributeParser = (attr: number, ptr: number, len: number) => void;
20
+ export type IAttributeParser = (attr: AttributeName, ptr: number, len: number) => void;
20
21
  /**
21
22
  * Maintains a stack of children and attributes parsers, to easily parse
22
23
  * the very hierarchical MPDs.
@@ -68,66 +68,66 @@ export declare const enum AttributeName {
68
68
  Duration = 1,
69
69
  Profiles = 2,
70
70
  AudioSamplingRate = 3,
71
- Codecs = 4,
71
+ Codecs = 4,// String
72
72
  CodingDependency = 5,
73
73
  FrameRate = 6,
74
- Height = 7,
75
- Width = 8,
74
+ Height = 7,// f64
75
+ Width = 8,// f64
76
76
  MaxPlayoutRate = 9,
77
77
  MaxSAPPeriod = 10,
78
- MimeType = 11,
78
+ MimeType = 11,// f64
79
79
  SegmentProfiles = 12,
80
- ContentProtectionValue = 13,
81
- ContentProtectionKeyId = 14,
82
- ContentProtectionCencPSSH = 15,
83
- SchemeIdUri = 16,
84
- SchemeValue = 17,
85
- MediaRange = 18,
86
- SegmentTimeline = 19,
87
- StartNumber = 20,
88
- SegmentBaseSegment = 21,
89
- AvailabilityTimeComplete = 22,
90
- IndexRangeExact = 23,
91
- PresentationTimeOffset = 24,
92
- EventPresentationTime = 25,
93
- Element = 26,
94
- TimeScale = 27,
95
- Index = 28,
96
- InitializationRange = 29,
97
- Media = 30,
98
- IndexRange = 31,
99
- BitstreamSwitching = 32,
100
- Type = 33,
101
- AvailabilityStartTime = 34,
102
- AvailabilityEndTime = 35,
103
- PublishTime = 36,
104
- MinimumUpdatePeriod = 37,
105
- MinBufferTime = 38,
106
- TimeShiftBufferDepth = 39,
107
- SuggestedPresentationDelay = 40,
108
- MaxSegmentDuration = 41,
109
- MaxSubsegmentDuration = 42,
110
- AvailabilityTimeOffset = 43,
111
- BaseUrlValue = 44,
112
- Start = 45,
113
- XLinkHref = 46,
114
- XLinkActuate = 47,
80
+ ContentProtectionValue = 13,// String
81
+ ContentProtectionKeyId = 14,// ArrayBuffer
82
+ ContentProtectionCencPSSH = 15,// ArrayBuffer
83
+ SchemeIdUri = 16,// String
84
+ SchemeValue = 17,// String
85
+ MediaRange = 18,// [f64, f64]
86
+ SegmentTimeline = 19,// Vec<SElement>
87
+ StartNumber = 20,// f64
88
+ SegmentBaseSegment = 21,// SegmentBaseSegment
89
+ AvailabilityTimeComplete = 22,// u8 (bool)
90
+ IndexRangeExact = 23,// u8 (bool)
91
+ PresentationTimeOffset = 24,// f64
92
+ EventPresentationTime = 25,// f64
93
+ Element = 26,// String (XML)
94
+ TimeScale = 27,// f64
95
+ Index = 28,// String
96
+ InitializationRange = 29,// [f64, f64]
97
+ Media = 30,// String
98
+ IndexRange = 31,// [f64, f64]
99
+ BitstreamSwitching = 32,// u8 (bool)
100
+ Type = 33,// String
101
+ AvailabilityStartTime = 34,// f64
102
+ AvailabilityEndTime = 35,// f64
103
+ PublishTime = 36,// f64
104
+ MinimumUpdatePeriod = 37,// f64
105
+ MinBufferTime = 38,// f64
106
+ TimeShiftBufferDepth = 39,// f64
107
+ SuggestedPresentationDelay = 40,// f64
108
+ MaxSegmentDuration = 41,// f64
109
+ MaxSubsegmentDuration = 42,// f64
110
+ AvailabilityTimeOffset = 43,// f64
111
+ BaseUrlValue = 44,// String
112
+ Start = 45,// f64
113
+ XLinkHref = 46,// String
114
+ XLinkActuate = 47,// String
115
115
  Group = 48,
116
- MaxBandwidth = 49,
117
- MaxFrameRate = 50,
118
- MaxHeight = 51,
119
- MaxWidth = 52,
120
- MinBandwidth = 53,
121
- MinFrameRate = 54,
122
- MinHeight = 55,
123
- MinWidth = 56,
116
+ MaxBandwidth = 49,// f64
117
+ MaxFrameRate = 50,// f64
118
+ MaxHeight = 51,// f64
119
+ MaxWidth = 52,// f64
120
+ MinBandwidth = 53,// f64
121
+ MinFrameRate = 54,// f64
122
+ MinHeight = 55,// f64
123
+ MinWidth = 56,// f64
124
124
  SelectionPriority = 57,
125
125
  SegmentAlignment = 58,
126
126
  SubsegmentAlignment = 59,
127
- Language = 60,
128
- ContentType = 61,
127
+ Language = 60,// String
128
+ ContentType = 61,// String
129
129
  Par = 62,
130
- Bitrate = 63,
130
+ Bitrate = 63,// f64
131
131
  Text = 64,
132
132
  QualityRanking = 65,
133
133
  Location = 66,
@@ -135,11 +135,11 @@ export declare const enum AttributeName {
135
135
  MediaPresentationDuration = 68,
136
136
  EventStreamEltRange = 69,
137
137
  Namespace = 70,
138
- Label = 71,
139
- ServiceLocation = 72,
140
- QueryBeforeStart = 73,
141
- ProxyServerUrl = 74,
138
+ Label = 71,// String
139
+ ServiceLocation = 72,// String
140
+ QueryBeforeStart = 73,// Boolean
141
+ ProxyServerUrl = 74,// String
142
142
  DefaultServiceLocation = 75,
143
- EndNumber = 76,
143
+ EndNumber = 76,// f64
144
144
  SupplementalCodecs = 77
145
145
  }
@@ -22,7 +22,7 @@ import { getPlayReadyKIDFromPrivateData } from "../../containers/isobmff";
22
22
  * @returns {Array.<Object>}
23
23
  */
24
24
  function createWidevineKeySystem(keyIdBytes) {
25
- return [{ systemId: "edef8ba9-79d6-4ace-a3c8-27dcd51d21ed",
25
+ return [{ systemId: "edef8ba9-79d6-4ace-a3c8-27dcd51d21ed", // Widevine
26
26
  privateData: concat([0x08, 0x01, 0x12, 0x10], keyIdBytes) }];
27
27
  }
28
28
  /**
@@ -21,4 +21,4 @@
21
21
  * @param {Uint8Array} buffer
22
22
  * @returns {Array}
23
23
  */
24
- export default function extractCompleteChunks(buffer: Uint8Array): [Uint8Array[], Uint8Array | null];
24
+ export default function extractCompleteChunks(buffer: Uint8Array): [Uint8Array[] | null, Uint8Array | null];
@@ -26,8 +26,9 @@ import findCompleteBox from "../utils/find_complete_box";
26
26
  export default function extractCompleteChunks(buffer) {
27
27
  var _position = 0;
28
28
  var chunks = [];
29
+ var currentBuffer = null;
29
30
  while (_position < buffer.length) {
30
- var currentBuffer = buffer.subarray(_position, Infinity);
31
+ currentBuffer = buffer.subarray(_position, Infinity);
31
32
  var moofIndex = findCompleteBox(currentBuffer, 0x6D6F6F66 /* moof */);
32
33
  if (moofIndex < 0) {
33
34
  // no moof, not a segment.
@@ -55,5 +56,8 @@ export default function extractCompleteChunks(buffer) {
55
56
  chunks.push(chunk);
56
57
  _position = maxEnd;
57
58
  }
58
- return [chunks, null];
59
+ if (chunks.length === 0) {
60
+ return [null, currentBuffer];
61
+ }
62
+ return [chunks, currentBuffer];
59
63
  }
@@ -45,8 +45,10 @@ export default function lowLatencySegmentLoader(url, content, options, callbacks
45
45
  var res = extractCompleteChunks(concatenated);
46
46
  var completeChunks = res[0];
47
47
  partialChunk = res[1];
48
- for (var i = 0; i < completeChunks.length; i++) {
49
- callbacks.onNewChunk(completeChunks[i]);
48
+ if (completeChunks !== null) {
49
+ completeChunks.forEach(function (completedChunk) {
50
+ callbacks.onNewChunk(completedChunk);
51
+ });
50
52
  if (cancelSignal.isCancelled()) {
51
53
  return;
52
54
  }