rx-player 3.33.3 → 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.
package/VERSION CHANGED
@@ -1 +1 @@
1
- 3.33.3
1
+ 3.33.4-dev.2024080600
@@ -88,7 +88,7 @@ var Player = /** @class */ (function (_super) {
88
88
  // Workaround to support Firefox autoplay on FF 42.
89
89
  // See: https://bugzilla.mozilla.org/show_bug.cgi?id=1194624
90
90
  videoElement.preload = "auto";
91
- _this.version = /* PLAYER_VERSION */ "3.33.3";
91
+ _this.version = /* PLAYER_VERSION */ "3.33.4-dev.2024080600";
92
92
  _this.log = log;
93
93
  _this.state = "STOPPED";
94
94
  _this.videoElement = videoElement;
@@ -2511,5 +2511,5 @@ var Player = /** @class */ (function (_super) {
2511
2511
  Player._priv_currentlyUsedVideoElements = new WeakSet();
2512
2512
  return Player;
2513
2513
  }(EventEmitter));
2514
- Player.version = /* PLAYER_VERSION */ "3.33.3";
2514
+ Player.version = /* PLAYER_VERSION */ "3.33.4-dev.2024080600";
2515
2515
  export default Player;
@@ -333,7 +333,7 @@ var TemplateRepresentationIndex = /** @class */ (function () {
333
333
  }
334
334
  }
335
335
  var _b = this._index, duration = _b.duration, timescale = _b.timescale;
336
- var firstPosition = this._manifestBoundsCalculator.getEstimatedMinimumSegmentTime();
336
+ var firstPosition = this._manifestBoundsCalculator.getEstimatedMinimumSegmentTime(duration / timescale);
337
337
  if (firstPosition === undefined) {
338
338
  return undefined;
339
339
  }
@@ -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";
@@ -439,15 +440,15 @@ var TimelineRepresentationIndex = /** @class */ (function () {
439
440
  * available due to timeshifting.
440
441
  */
441
442
  TimelineRepresentationIndex.prototype._refreshTimeline = function () {
443
+ var _a, _b;
442
444
  if (this._index.timeline === null) {
443
445
  this._index.timeline = this._getTimeline();
444
446
  }
445
447
  if (!this._isDynamic) {
446
448
  return;
447
449
  }
448
- var firstPosition = this._manifestBoundsCalculator
449
- .getEstimatedMinimumSegmentTime();
450
- 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)) {
451
452
  return; // we don't know yet
452
453
  }
453
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
  }
Binary file
package/dist/rx-player.js CHANGED
@@ -30052,10 +30052,14 @@ var ManifestBoundsCalculator = /*#__PURE__*/function () {
30052
30052
  /**
30053
30053
  * Estimate a minimum bound for the content from the last set segment time
30054
30054
  * and buffer depth.
30055
- * Consider that it is only an estimation, not the real value.
30055
+ * Consider that it is only an estimate, not the real value.
30056
+ * @param {number} segmentDuration - In DASH, the buffer depth actually also
30057
+ * depend on a corresponding's segment duration (e.g. a segment become
30058
+ * unavailable once the `timeShiftBufferDepth` + its duration has elapsed).
30059
+ * This argument can thus be set the approximate duration of a segment.
30056
30060
  * @return {number|undefined}
30057
30061
  */;
30058
- _proto.getEstimatedMinimumSegmentTime = function getEstimatedMinimumSegmentTime() {
30062
+ _proto.getEstimatedMinimumSegmentTime = function getEstimatedMinimumSegmentTime(segmentDuration) {
30059
30063
  var _a;
30060
30064
  if (!this._isDynamic || this._timeShiftBufferDepth === null) {
30061
30065
  return 0;
@@ -30064,7 +30068,7 @@ var ManifestBoundsCalculator = /*#__PURE__*/function () {
30064
30068
  if (maximumBound === undefined) {
30065
30069
  return undefined;
30066
30070
  }
30067
- var minimumBound = maximumBound - this._timeShiftBufferDepth;
30071
+ var minimumBound = maximumBound - (this._timeShiftBufferDepth + segmentDuration);
30068
30072
  return minimumBound;
30069
30073
  }
30070
30074
  /**
@@ -31203,6 +31207,7 @@ function constructTimelineFromPreviousTimeline(newElements, prevTimeline) {
31203
31207
 
31204
31208
 
31205
31209
 
31210
+
31206
31211
  // eslint-disable-next-line max-len
31207
31212
 
31208
31213
  /**
@@ -31600,14 +31605,15 @@ var TimelineRepresentationIndex = /*#__PURE__*/function () {
31600
31605
  * available due to timeshifting.
31601
31606
  */;
31602
31607
  _proto._refreshTimeline = function _refreshTimeline() {
31608
+ var _a, _b;
31603
31609
  if (this._index.timeline === null) {
31604
31610
  this._index.timeline = this._getTimeline();
31605
31611
  }
31606
31612
  if (!this._isDynamic) {
31607
31613
  return;
31608
31614
  }
31609
- var firstPosition = this._manifestBoundsCalculator.getEstimatedMinimumSegmentTime();
31610
- if (firstPosition == null) {
31615
+ 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);
31616
+ if ((0,is_null_or_undefined/* default */.A)(firstPosition)) {
31611
31617
  return; // we don't know yet
31612
31618
  }
31613
31619
  var scaledFirstPosition = (0,index_helpers/* toIndexTime */.vb)(firstPosition, this._index);
@@ -32171,7 +32177,7 @@ var TemplateRepresentationIndex = /*#__PURE__*/function () {
32171
32177
  var _this$_index = this._index,
32172
32178
  duration = _this$_index.duration,
32173
32179
  timescale = _this$_index.timescale;
32174
- var firstPosition = this._manifestBoundsCalculator.getEstimatedMinimumSegmentTime();
32180
+ var firstPosition = this._manifestBoundsCalculator.getEstimatedMinimumSegmentTime(duration / timescale);
32175
32181
  if (firstPosition === undefined) {
32176
32182
  return undefined;
32177
32183
  }
@@ -33493,6 +33499,7 @@ function parseCompleteIntermediateRepresentation(mpdIR, args, warnings, xlinkInf
33493
33499
  var mpdBaseUrls = resolveBaseURLs(initialBaseUrl, rootChildren.baseURLs);
33494
33500
  var availabilityStartTime = parseAvailabilityStartTime(rootAttributes, args.referenceDateTime);
33495
33501
  var timeShiftBufferDepth = rootAttributes.timeShiftBufferDepth;
33502
+ var maxSegmentDuration = rootAttributes.maxSegmentDuration;
33496
33503
  var clockOffset = args.externalClockOffset,
33497
33504
  unsafelyBaseOnPreviousManifest = args.unsafelyBaseOnPreviousManifest;
33498
33505
  var externalClockOffset = args.externalClockOffset;
@@ -33586,6 +33593,20 @@ function parseCompleteIntermediateRepresentation(mpdIR, args, warnings, xlinkInf
33586
33593
  // can go even lower in terms of depth
33587
33594
  minimumTime = minimumSafePosition;
33588
33595
  timeshiftDepth = timeShiftBufferDepth !== null && timeShiftBufferDepth !== void 0 ? timeShiftBufferDepth : null;
33596
+ if (timeshiftDepth !== null) {
33597
+ // The DASH spec implies that a segment is still available after a given
33598
+ // `timeShiftBufferDepth` for a time equal to its duration
33599
+ // (What I interpret from "ISO/IEC 23009-1 fifth edition 2022-08
33600
+ // A.3.4 Media Segment list restrictions).
33601
+ //
33602
+ // This `timeshiftDepth` property is global for the whole Manifest (and
33603
+ // not per segment), thus we cannot do exactly that, but we can take the
33604
+ // anounced `maxSegmentDuration` by default instead. This may be a little
33605
+ // too optimistic, but would in reality not lead to a lot of issues as
33606
+ // this `timeshiftDepth` property is not the one that should be relied on
33607
+ // to know which segment can or cannot be requested anymore.
33608
+ timeshiftDepth += maxSegmentDuration !== null && maxSegmentDuration !== void 0 ? maxSegmentDuration : 0;
33609
+ }
33589
33610
  if (timeshiftDepth !== null && minimumTime !== undefined && livePosition - minimumTime > timeshiftDepth) {
33590
33611
  timeshiftDepth = livePosition - minimumTime;
33591
33612
  }
@@ -53656,7 +53677,7 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
53656
53677
  // Workaround to support Firefox autoplay on FF 42.
53657
53678
  // See: https://bugzilla.mozilla.org/show_bug.cgi?id=1194624
53658
53679
  videoElement.preload = "auto";
53659
- _this.version = /* PLAYER_VERSION */"3.33.3";
53680
+ _this.version = /* PLAYER_VERSION */"3.33.4-dev.2024080600";
53660
53681
  _this.log = src_log/* default */.A;
53661
53682
  _this.state = "STOPPED";
53662
53683
  _this.videoElement = videoElement;
@@ -56144,7 +56165,7 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
56144
56165
  * Use of a WeakSet ensure the object is garbage collected if it's not used anymore.
56145
56166
  */
56146
56167
  Player._priv_currentlyUsedVideoElements = new WeakSet();
56147
- Player.version = /* PLAYER_VERSION */"3.33.3";
56168
+ Player.version = /* PLAYER_VERSION */"3.33.4-dev.2024080600";
56148
56169
  /* harmony default export */ var public_api = (Player);
56149
56170
  ;// CONCATENATED MODULE: ./src/core/api/index.ts
56150
56171
  /**