rx-player 3.27.0 → 3.27.1-dev.2022041500

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 (79) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/VERSION +1 -1
  3. package/dist/_esm5.processed/core/abr/abr_manager.d.ts +7 -3
  4. package/dist/_esm5.processed/core/abr/abr_manager.js +4 -3
  5. package/dist/_esm5.processed/core/abr/representation_estimator.d.ts +13 -8
  6. package/dist/_esm5.processed/core/abr/representation_estimator.js +4 -4
  7. package/dist/_esm5.processed/core/api/public_api.js +13 -14
  8. package/dist/_esm5.processed/core/init/content_time_boundaries_observer.d.ts +52 -0
  9. package/dist/_esm5.processed/core/init/content_time_boundaries_observer.js +223 -0
  10. package/dist/_esm5.processed/core/init/create_stream_playback_observer.js +17 -6
  11. package/dist/_esm5.processed/core/init/get_initial_time.d.ts +30 -5
  12. package/dist/_esm5.processed/core/init/get_initial_time.js +20 -13
  13. package/dist/_esm5.processed/core/init/load_on_media_source.js +16 -3
  14. package/dist/_esm5.processed/core/init/media_duration_updater.d.ts +56 -0
  15. package/dist/_esm5.processed/core/init/media_duration_updater.js +188 -0
  16. package/dist/_esm5.processed/core/stream/adaptation/adaptation_stream.d.ts +2 -5
  17. package/dist/_esm5.processed/core/stream/adaptation/create_representation_estimator.d.ts +3 -2
  18. package/dist/_esm5.processed/core/stream/adaptation/create_representation_estimator.js +3 -3
  19. package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.js +2 -22
  20. package/dist/_esm5.processed/core/stream/period/period_stream.d.ts +2 -5
  21. package/dist/_esm5.processed/core/stream/period/period_stream.js +6 -4
  22. package/dist/_esm5.processed/core/stream/representation/get_buffer_status.d.ts +4 -2
  23. package/dist/_esm5.processed/core/stream/representation/get_buffer_status.js +85 -42
  24. package/dist/_esm5.processed/core/stream/representation/representation_stream.js +3 -3
  25. package/dist/_esm5.processed/manifest/manifest.d.ts +14 -5
  26. package/dist/_esm5.processed/manifest/manifest.js +31 -12
  27. package/dist/_esm5.processed/manifest/period.d.ts +6 -0
  28. package/dist/_esm5.processed/manifest/period.js +9 -0
  29. package/dist/_esm5.processed/manifest/representation_index/types.d.ts +7 -2
  30. package/dist/_esm5.processed/parsers/manifest/dash/common/get_minimum_and_maximum_positions.d.ts +5 -1
  31. package/dist/_esm5.processed/parsers/manifest/dash/common/get_minimum_and_maximum_positions.js +6 -4
  32. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/base.js +2 -1
  33. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/list.d.ts +4 -0
  34. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/list.js +4 -2
  35. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/template.js +4 -2
  36. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.js +3 -3
  37. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_mpd.js +28 -20
  38. package/dist/_esm5.processed/parsers/manifest/local/parse_local_manifest.js +3 -2
  39. package/dist/_esm5.processed/parsers/manifest/metaplaylist/metaplaylist_parser.js +9 -3
  40. package/dist/_esm5.processed/parsers/manifest/smooth/create_parser.js +26 -17
  41. package/dist/_esm5.processed/parsers/manifest/types.d.ts +45 -17
  42. package/dist/_esm5.processed/parsers/manifest/utils/{get_maximum_position.d.ts → get_maximum_positions.d.ts} +4 -1
  43. package/dist/_esm5.processed/parsers/manifest/utils/{get_maximum_position.js → get_maximum_positions.js} +10 -6
  44. package/dist/rx-player.js +854 -351
  45. package/dist/rx-player.min.js +1 -1
  46. package/package.json +1 -1
  47. package/sonar-project.properties +1 -1
  48. package/src/core/abr/abr_manager.ts +11 -3
  49. package/src/core/abr/representation_estimator.ts +17 -10
  50. package/src/core/api/public_api.ts +13 -15
  51. package/src/core/init/content_time_boundaries_observer.ts +312 -0
  52. package/src/core/init/create_stream_playback_observer.ts +18 -7
  53. package/src/core/init/get_initial_time.ts +52 -19
  54. package/src/core/init/load_on_media_source.ts +22 -5
  55. package/src/core/init/media_duration_updater.ts +268 -0
  56. package/src/core/stream/adaptation/adaptation_stream.ts +2 -5
  57. package/src/core/stream/adaptation/create_representation_estimator.ts +6 -3
  58. package/src/core/stream/orchestrator/stream_orchestrator.ts +2 -29
  59. package/src/core/stream/period/period_stream.ts +12 -9
  60. package/src/core/stream/representation/get_buffer_status.ts +102 -41
  61. package/src/core/stream/representation/representation_stream.ts +3 -3
  62. package/src/manifest/__tests__/manifest.test.ts +94 -68
  63. package/src/manifest/manifest.ts +73 -33
  64. package/src/manifest/period.ts +10 -0
  65. package/src/manifest/representation_index/types.ts +7 -2
  66. package/src/parsers/manifest/dash/common/get_minimum_and_maximum_positions.ts +10 -5
  67. package/src/parsers/manifest/dash/common/indexes/base.ts +4 -3
  68. package/src/parsers/manifest/dash/common/indexes/list.ts +8 -1
  69. package/src/parsers/manifest/dash/common/indexes/template.ts +8 -3
  70. package/src/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.ts +7 -7
  71. package/src/parsers/manifest/dash/common/parse_mpd.ts +38 -20
  72. package/src/parsers/manifest/local/parse_local_manifest.ts +3 -2
  73. package/src/parsers/manifest/metaplaylist/metaplaylist_parser.ts +9 -4
  74. package/src/parsers/manifest/smooth/create_parser.ts +36 -18
  75. package/src/parsers/manifest/types.ts +45 -17
  76. package/src/parsers/manifest/utils/{get_maximum_position.ts → get_maximum_positions.ts} +13 -7
  77. package/dist/_esm5.processed/core/init/duration_updater.d.ts +0 -27
  78. package/dist/_esm5.processed/core/init/duration_updater.js +0 -136
  79. package/src/core/init/duration_updater.ts +0 -206
@@ -20,6 +20,7 @@ import Manifest, {
20
20
  Period,
21
21
  Representation,
22
22
  } from "../../../manifest";
23
+ import isNullOrUndefined from "../../../utils/is_null_or_undefined";
23
24
  import { IReadOnlyPlaybackObserver } from "../../api";
24
25
  import {
25
26
  IBufferedChunk,
@@ -76,9 +77,11 @@ export interface IBufferStatus {
76
77
  * be filled by any segment, even in the future.
77
78
  *
78
79
  * @param {Object} content
79
- * @param {Object} playbackInfo
80
+ * @param {number} initialWantedTime
81
+ * @param {Object} playbackObserver
80
82
  * @param {number|undefined} fastSwitchThreshold
81
83
  * @param {number} bufferGoal
84
+ * @param {number} maxBufferSize
82
85
  * @param {Object} segmentBuffer
83
86
  * @returns {Object}
84
87
  */
@@ -87,21 +90,21 @@ export default function getBufferStatus(
87
90
  manifest : Manifest;
88
91
  period : Period;
89
92
  representation : Representation; },
90
- wantedStartPosition : number,
93
+ initialWantedTime : number,
91
94
  playbackObserver : IReadOnlyPlaybackObserver<unknown>,
92
95
  fastSwitchThreshold : number | undefined,
93
96
  bufferGoal : number,
94
97
  maxBufferSize : number,
95
98
  segmentBuffer : SegmentBuffer
96
99
  ) : IBufferStatus {
97
- const { period, representation } = content;
98
100
  segmentBuffer.synchronizeInventory();
99
- const wantedEndPosition = wantedStartPosition + bufferGoal;
100
- const neededRange = { start: Math.max(wantedStartPosition, period.start),
101
- end: Math.min(wantedEndPosition, period.end ?? Infinity) };
102
101
 
103
- const shouldRefreshManifest = representation.index.shouldRefresh(wantedStartPosition,
104
- wantedEndPosition);
102
+ const { representation } = content;
103
+ const neededRange = getRangeOfNeededSegments(content,
104
+ initialWantedTime,
105
+ bufferGoal);
106
+ const shouldRefreshManifest = representation.index.shouldRefresh(neededRange.start,
107
+ neededRange.end);
105
108
 
106
109
  /**
107
110
  * Every segment awaiting an "EndOfSegment" operation, which indicates that a
@@ -136,7 +139,7 @@ export default function getBufferStatus(
136
139
 
137
140
  const prioritizedNeededSegments: IQueuedSegment[] = segmentsToLoad.map((segment) => (
138
141
  {
139
- priority: getSegmentPriority(segment.time, wantedStartPosition),
142
+ priority: getSegmentPriority(segment.time, initialWantedTime),
140
143
  segment,
141
144
  }
142
145
  ));
@@ -145,38 +148,9 @@ export default function getBufferStatus(
145
148
  * `true` if the current `RepresentationStream` has loaded all the
146
149
  * needed segments for this Representation until the end of the Period.
147
150
  */
148
- let hasFinishedLoading : boolean;
149
-
150
- const lastPosition = representation.index.getLastPosition();
151
- if (!representation.index.isInitialized() ||
152
- period.end === undefined ||
153
- prioritizedNeededSegments.length > 0 ||
154
- segmentsOnHold.length > 0)
155
- {
156
- hasFinishedLoading = false;
157
- } else {
158
- if (lastPosition === undefined) {
159
- // We do not know the end of this index.
160
- // If we reached the end of the period, check that all segments are
161
- // available.
162
- hasFinishedLoading = neededRange.end >= period.end &&
163
- representation.index.isFinished();
164
- } else if (lastPosition === null) {
165
- // There is no available segment in the index currently. If the index
166
- // tells us it has finished generating new segments, we're done.
167
- hasFinishedLoading = representation.index.isFinished();
168
- } else {
169
- // We have a declared end. Check that our range went until the last
170
- // position available in the index. If that's the case and we're left
171
- // with no segments after filtering them, it means we already have
172
- // downloaded the last segments and have nothing left to do: full.
173
- const endOfRange = period.end !== undefined ? Math.min(period.end,
174
- lastPosition) :
175
- lastPosition;
176
- hasFinishedLoading = neededRange.end >= endOfRange &&
177
- representation.index.isFinished();
178
- }
179
- }
151
+ const hasFinishedLoading = neededRange.hasReachedPeriodEnd &&
152
+ prioritizedNeededSegments.length === 0 &&
153
+ segmentsOnHold.length === 0;
180
154
 
181
155
  let imminentDiscontinuity;
182
156
  if (!representation.index.isInitialized() ||
@@ -218,6 +192,93 @@ export default function getBufferStatus(
218
192
  shouldRefreshManifest };
219
193
  }
220
194
 
195
+ /**
196
+ * Returns both the time range of segments that should be loaded (from a
197
+ * starting position to an ending position) and whether the end of the Period is
198
+ * reached by that range.
199
+ * @param {Object} content
200
+ * @param {number} initialWantedTime
201
+ * @param {number} bufferGoal
202
+ * @returns {Object}
203
+ */
204
+ function getRangeOfNeededSegments(
205
+ content: { adaptation : Adaptation;
206
+ manifest : Manifest;
207
+ period : Period;
208
+ representation : Representation; },
209
+ initialWantedTime : number,
210
+ bufferGoal : number
211
+ ) : { start : number; end : number; hasReachedPeriodEnd : boolean } {
212
+ let wantedStartPosition : number;
213
+ const { manifest, period, representation } = content;
214
+ const lastIndexPosition = representation.index.getLastPosition();
215
+ const representationIndex = representation.index;
216
+
217
+ // There is an exception for when the current initially wanted time is already
218
+ // after the last position with segments AND when we're playing the absolute
219
+ // last Period in the Manifest.
220
+ // In that case, we want to actually request at least the last segment to
221
+ // avoid ending the last Period - and by extension the content - with a
222
+ // segment which isn't the last one.
223
+ if (!isNullOrUndefined(lastIndexPosition) &&
224
+ initialWantedTime >= lastIndexPosition &&
225
+ representationIndex.isInitialized() &&
226
+ representationIndex.isFinished() &&
227
+ isPeriodTheCurrentAndLastOne(manifest, period, initialWantedTime))
228
+ {
229
+ wantedStartPosition = lastIndexPosition - 1;
230
+ } else {
231
+ wantedStartPosition = initialWantedTime;
232
+ }
233
+
234
+ const wantedEndPosition = wantedStartPosition + bufferGoal;
235
+
236
+ let hasReachedPeriodEnd;
237
+ if (!representation.index.isInitialized() ||
238
+ !representation.index.isFinished() ||
239
+ period.end === undefined)
240
+ {
241
+ hasReachedPeriodEnd = false;
242
+ } else if (lastIndexPosition === undefined) {
243
+ // We do not know the end of this index.
244
+ hasReachedPeriodEnd = wantedEndPosition >= period.end;
245
+ } else if (lastIndexPosition === null) {
246
+ // There is no available segment in the index currently.
247
+ hasReachedPeriodEnd = true;
248
+ } else {
249
+ // We have a declared end. Check that our range went until the last
250
+ // position available in the index. If that's the case and we're left
251
+ // with no segments after filtering them, it means we already have
252
+ // downloaded the last segments and have nothing left to do: full.
253
+ hasReachedPeriodEnd = wantedEndPosition >= lastIndexPosition;
254
+ }
255
+
256
+ return { start: Math.max(wantedStartPosition,
257
+ period.start),
258
+ end: Math.min(wantedEndPosition, period.end ?? Infinity),
259
+ hasReachedPeriodEnd };
260
+ }
261
+
262
+ /**
263
+ * Returns `true` if the given Period is both:
264
+ * - the one being played (the current position is known from `time`)
265
+ * - the absolute last one in the Manifest (that is, there will never be a
266
+ * Period after it).
267
+ * @param {Object} manifest
268
+ * @param {Object} period
269
+ * @param {number} time
270
+ * @returns {boolean}
271
+ */
272
+ function isPeriodTheCurrentAndLastOne(
273
+ manifest : Manifest,
274
+ period : Period,
275
+ time : number
276
+ ) : boolean {
277
+ return period.containsTime(time) &&
278
+ manifest.isLastPeriodKnown &&
279
+ period.id === manifest.periods[manifest.periods.length - 1]?.id;
280
+ }
281
+
221
282
  /**
222
283
  * From the given SegmentInventory, filters the "playable" (in a supported codec
223
284
  * and not known to be undecipherable) buffered Segment Objects which overlap
@@ -301,9 +301,9 @@ export default function RepresentationStream<TSegmentDataType>({
301
301
  IStreamNeedsManifestRefresh |
302
302
  IStreamTerminatingEvent>
303
303
  {
304
- const wantedStartPosition = observation.position + observation.wantedTimeOffset;
304
+ const initialWantedTime = observation.position + observation.wantedTimeOffset;
305
305
  const status = getBufferStatus(content,
306
- wantedStartPosition,
306
+ initialWantedTime,
307
307
  playbackObserver,
308
308
  fastSwitchThreshold,
309
309
  bufferGoal,
@@ -383,7 +383,7 @@ export default function RepresentationStream<TSegmentDataType>({
383
383
  if (status.isBufferFull) {
384
384
  const gcedPosition = Math.max(
385
385
  0,
386
- wantedStartPosition - UPTO_CURRENT_POSITION_CLEANUP);
386
+ initialWantedTime - UPTO_CURRENT_POSITION_CLEANUP);
387
387
  if (gcedPosition > 0) {
388
388
  bufferRemoval = segmentBuffer
389
389
  .removeBuffer(0, gcedPosition)
@@ -47,11 +47,13 @@ describe("Manifest - Manifest", () => {
47
47
  isDynamic: false,
48
48
  isLive: false,
49
49
  duration: 5,
50
- timeBounds: { absoluteMinimumTime: 0,
50
+ timeBounds: { minimumSafePosition: 0,
51
51
  timeshiftDepth: null,
52
- maximumTimeData: { isLinear: false,
53
- value: 10,
54
- time: 10 } },
52
+ maximumTimeData: {
53
+ isLinear: false,
54
+ maximumSafePosition: 10,
55
+ time: 10,
56
+ } },
55
57
  periods: [] };
56
58
 
57
59
  const Manifest = require("../manifest").default;
@@ -63,8 +65,8 @@ describe("Manifest - Manifest", () => {
63
65
  expect(manifest.isDynamic).toEqual(false);
64
66
  expect(manifest.isLive).toEqual(false);
65
67
  expect(manifest.lifetime).toEqual(undefined);
66
- expect(manifest.getMaximumPosition()).toEqual(10);
67
- expect(manifest.getMinimumPosition()).toEqual(0);
68
+ expect(manifest.getMaximumSafePosition()).toEqual(10);
69
+ expect(manifest.getMinimumSafePosition()).toEqual(0);
68
70
  expect(manifest.contentWarnings).toEqual([]);
69
71
  expect(manifest.periods).toEqual([]);
70
72
  expect(manifest.suggestedPresentationDelay).toEqual(undefined);
@@ -83,11 +85,13 @@ describe("Manifest - Manifest", () => {
83
85
  isDynamic: false,
84
86
  isLive: false,
85
87
  duration: 5,
86
- timeBounds: { absoluteMinimumTime: 0,
88
+ timeBounds: { minimumSafePosition: 0,
87
89
  timeshiftDepth: null,
88
- maximumTimeData: { isLinear: false,
89
- value: 10,
90
- time: 10 } },
90
+ maximumTimeData: {
91
+ isLinear: false,
92
+ maximumSafePosition: 10,
93
+ time: 10,
94
+ } },
91
95
  periods: [period1, period2] };
92
96
 
93
97
  const fakePeriod = jest.fn((period) => {
@@ -123,11 +127,13 @@ describe("Manifest - Manifest", () => {
123
127
  isDynamic: false,
124
128
  isLive: false,
125
129
  duration: 5,
126
- timeBounds: { absoluteMinimumTime: 0,
130
+ timeBounds: { minimumSafePosition: 0,
127
131
  timeshiftDepth: null,
128
- maximumTimeData: { isLinear: false,
129
- value: 10,
130
- time: 10 } },
132
+ maximumTimeData: {
133
+ isLinear: false,
134
+ maximumSafePosition: 10,
135
+ time: 10,
136
+ } },
131
137
  periods: [period1, period2] };
132
138
 
133
139
  const representationFilter = function() { return false; };
@@ -161,11 +167,13 @@ describe("Manifest - Manifest", () => {
161
167
  isDynamic: false,
162
168
  isLive: false,
163
169
  duration: 5,
164
- timeBounds: { absoluteMinimumTime: 0,
170
+ timeBounds: { minimumSafePosition: 0,
165
171
  timeshiftDepth: null,
166
- maximumTimeData: { isLinear: false,
167
- value: 10,
168
- time: 10 } },
172
+ maximumTimeData: {
173
+ isLinear: false,
174
+ maximumSafePosition: 10,
175
+ time: 10,
176
+ } },
169
177
  periods: [period1, period2] };
170
178
 
171
179
  const fakePeriod = jest.fn((period) => {
@@ -199,11 +207,13 @@ describe("Manifest - Manifest", () => {
199
207
  isDynamic: false,
200
208
  isLive: false,
201
209
  duration: 5,
202
- timeBounds: { absoluteMinimumTime: 0,
210
+ timeBounds: { minimumSafePosition: 0,
203
211
  timeshiftDepth: null,
204
- maximumTimeData: { isLinear: false,
205
- value: 10,
206
- time: 10 } },
212
+ maximumTimeData: {
213
+ isLinear: false,
214
+ maximumSafePosition: 10,
215
+ time: 10,
216
+ } },
207
217
  periods: [period1, period2] };
208
218
 
209
219
  const fakePeriod = jest.fn((period) => {
@@ -242,10 +252,10 @@ describe("Manifest - Manifest", () => {
242
252
  lifetime: 13,
243
253
  contentWarnings: [new Error("a"), new Error("b")],
244
254
  periods: [oldPeriod1, oldPeriod2],
245
- timeBounds: { absoluteMinimumTime: 5,
255
+ timeBounds: { minimumSafePosition: 5,
246
256
  timeshiftDepth: null,
247
257
  maximumTimeData: { isLinear: false,
248
- value: 10,
258
+ maximumSafePosition: 10,
249
259
  time } },
250
260
  suggestedPresentationDelay: 99,
251
261
  uris: ["url1", "url2"] };
@@ -267,8 +277,8 @@ describe("Manifest - Manifest", () => {
267
277
  expect(manifest.isLive).toEqual(false);
268
278
  expect(manifest.lifetime).toEqual(13);
269
279
  expect(manifest.contentWarnings).toEqual([new Error("0"), new Error("1")]);
270
- expect(manifest.getMaximumPosition()).toEqual(10);
271
- expect(manifest.getMinimumPosition()).toEqual(5);
280
+ expect(manifest.getMaximumSafePosition()).toEqual(10);
281
+ expect(manifest.getMinimumSafePosition()).toEqual(5);
272
282
  expect(manifest.periods).toEqual([
273
283
  { id: "foo0", contentWarnings: [new Error("0")], adaptations: {}, start: 4 },
274
284
  { id: "foo1", contentWarnings: [new Error("1")], adaptations: {}, start: 12 },
@@ -301,11 +311,13 @@ describe("Manifest - Manifest", () => {
301
311
  isDynamic: false,
302
312
  isLive: false,
303
313
  lifetime: 13,
304
- timeBounds: { absoluteMinimumTime: 0,
314
+ timeBounds: { minimumSafePosition: 0,
305
315
  timeshiftDepth: null,
306
- maximumTimeData: { isLinear: false,
307
- value: 10,
308
- time: 10 } },
316
+ maximumTimeData: {
317
+ isLinear: false,
318
+ maximumSafePosition: 10,
319
+ time: 10,
320
+ } },
309
321
  contentWarnings: [new Error("a"), new Error("b")],
310
322
  periods: [ { id: "0", start: 4, adaptations: {} },
311
323
  { id: "1", start: 12, adaptations: {} } ],
@@ -325,11 +337,13 @@ describe("Manifest - Manifest", () => {
325
337
  periods: [ { id: "0", start: 4, adaptations: {} },
326
338
  { id: "1", start: 12, adaptations: {} } ],
327
339
  suggestedPresentationDelay: 99,
328
- timeBounds: { absoluteMinimumTime: 0,
340
+ timeBounds: { minimumSafePosition: 0,
329
341
  timeshiftDepth: null,
330
- maximumTimeData: { isLinear: false,
331
- value: 10,
332
- time: 10 } },
342
+ maximumTimeData: {
343
+ isLinear: false,
344
+ maximumSafePosition: 10,
345
+ time: 10,
346
+ } },
333
347
  uris: [] };
334
348
  const manifest2 = new Manifest(oldManifestArgs2, {});
335
349
  expect(manifest2.getUrl()).toEqual(undefined);
@@ -362,11 +376,13 @@ describe("Manifest - Manifest", () => {
362
376
  new Error("b") ],
363
377
  periods: [ { id: "0", start: 4, adaptations: {} },
364
378
  { id: "1", start: 12, adaptations: {} } ],
365
- timeBounds: { absoluteMinimumTime: 7,
379
+ timeBounds: { minimumSafePosition: 7,
366
380
  timeshiftDepth: 10,
367
- maximumTimeData: { isLinear: true,
368
- value: 30,
369
- time: 30000 } },
381
+ maximumTimeData: {
382
+ isLinear: true,
383
+ maximumSafePosition: 30,
384
+ time: 30000,
385
+ } },
370
386
  suggestedPresentationDelay: 99,
371
387
  uris: ["url1", "url2"] };
372
388
 
@@ -389,11 +405,13 @@ describe("Manifest - Manifest", () => {
389
405
  contentWarnings: [new Error("c"), new Error("d")],
390
406
  suggestedPresentationDelay: 100,
391
407
  timeShiftBufferDepth: 3,
392
- _timeBounds: { absoluteMinimumTime: 7,
408
+ _timeBounds: { minimumSafePosition: 7,
393
409
  timeshiftDepth: 5,
394
- maximumTimeData: { isLinear: false,
395
- value: 40,
396
- time: 30000 } },
410
+ maximumTimeData: {
411
+ isLinear: false,
412
+ maximumSafePosition: 40,
413
+ time: 30000,
414
+ } },
397
415
  periods: [newPeriod1, newPeriod2],
398
416
  uris: ["url3", "url4"] };
399
417
 
@@ -405,8 +423,8 @@ describe("Manifest - Manifest", () => {
405
423
  expect(manifest.isLive).toEqual(true);
406
424
  expect(manifest.lifetime).toEqual(14);
407
425
  expect(manifest.contentWarnings).toEqual([new Error("c"), new Error("d")]);
408
- expect(manifest.getMinimumPosition()).toEqual(40 - 5);
409
- expect(manifest.getMaximumPosition()).toEqual(40);
426
+ expect(manifest.getMinimumSafePosition()).toEqual(40 - 5);
427
+ expect(manifest.getMaximumSafePosition()).toEqual(40);
410
428
  expect(manifest.suggestedPresentationDelay).toEqual(100);
411
429
  expect(manifest.uris).toEqual(["url3", "url4"]);
412
430
 
@@ -431,11 +449,13 @@ describe("Manifest - Manifest", () => {
431
449
  isDynamic: false,
432
450
  isLive: false,
433
451
  lifetime: 13,
434
- timeBounds: { absoluteMinimumTime: 0,
452
+ timeBounds: { minimumSafePosition: 0,
435
453
  timeshiftDepth: null,
436
- maximumTimeData: { isLinear: false,
437
- value: 10,
438
- time: 10 } },
454
+ maximumTimeData: {
455
+ isLinear: false,
456
+ maximumSafePosition: 10,
457
+ time: 10,
458
+ } },
439
459
  contentWarnings: [new Error("a"), new Error("b")],
440
460
  periods: [{ id: "1", start: 4, adaptations: {} }],
441
461
  suggestedPresentationDelay: 99,
@@ -493,10 +513,10 @@ describe("Manifest - Manifest", () => {
493
513
  periods: [ newPeriod1,
494
514
  newPeriod2,
495
515
  newPeriod3 ],
496
- timeBounds: { absoluteMinimumTime: 0,
516
+ timeBounds: { minimumSafePosition: 0,
497
517
  timeshiftDepth: null,
498
518
  maximumTimeData: { isLinear: false,
499
- value: 10,
519
+ maximumSafePosition: 10,
500
520
  time: 10 } },
501
521
  uris: ["url3", "url4"] };
502
522
 
@@ -528,11 +548,13 @@ describe("Manifest - Manifest", () => {
528
548
  contentWarnings: [new Error("a"), new Error("b")],
529
549
  periods: [{ id: "1" }],
530
550
  suggestedPresentationDelay: 99,
531
- timeBounds: { absoluteMinimumTime: 0,
551
+ timeBounds: { minimumSafePosition: 0,
532
552
  timeshiftDepth: null,
533
- maximumTimeData: { isLinear: false,
534
- value: 10,
535
- time: 10 } },
553
+ maximumTimeData: {
554
+ isLinear: false,
555
+ maximumSafePosition: 10,
556
+ time: 10,
557
+ } },
536
558
  uris: ["url1", "url2"] };
537
559
 
538
560
  const fakePeriod = jest.fn((period) => {
@@ -570,10 +592,10 @@ describe("Manifest - Manifest", () => {
570
592
  contentWarnings: [new Error("c"), new Error("d")],
571
593
  suggestedPresentationDelay: 100,
572
594
  periods: [newPeriod1, newPeriod2, newPeriod3],
573
- timeBounds: { absoluteMinimumTime: 0,
595
+ timeBounds: { minimumSafePosition: 0,
574
596
  timeshiftDepth: null,
575
597
  maximumTimeData: { isLinear: false,
576
- value: 10,
598
+ maximumSafePosition: 10,
577
599
  time: 10 } },
578
600
  uris: ["url3", "url4"] };
579
601
 
@@ -603,11 +625,13 @@ describe("Manifest - Manifest", () => {
603
625
  contentWarnings: [new Error("a"), new Error("b")],
604
626
  periods: [{ id: "1" }],
605
627
  suggestedPresentationDelay: 99,
606
- timeBounds: { absoluteMinimumTime: 0,
628
+ timeBounds: { minimumSafePosition: 0,
607
629
  timeshiftDepth: null,
608
- maximumTimeData: { isLinear: false,
609
- value: 10,
610
- time: 10 } },
630
+ maximumTimeData: {
631
+ isLinear: false,
632
+ maximumSafePosition: 10,
633
+ time: 10,
634
+ } },
611
635
  uris: ["url1", "url2"] };
612
636
 
613
637
  const fakePeriod = jest.fn((period) => {
@@ -644,10 +668,10 @@ describe("Manifest - Manifest", () => {
644
668
  contentWarnings: [new Error("c"), new Error("d")],
645
669
  suggestedPresentationDelay: 100,
646
670
  periods: [newPeriod1, newPeriod2, newPeriod3],
647
- timeBounds: { absoluteMinimumTime: 0,
671
+ timeBounds: { minimumSafePosition: 0,
648
672
  timeshiftDepth: null,
649
673
  maximumTimeData: { isLinear: false,
650
- value: 10,
674
+ maximumSafePosition: 10,
651
675
  time: 10 } },
652
676
  uris: ["url3", "url4"] };
653
677
 
@@ -675,11 +699,13 @@ describe("Manifest - Manifest", () => {
675
699
  periods: [{ id: "1", start: 2 },
676
700
  { id: "2", start: 4 },
677
701
  { id: "3", start: 6 }],
678
- timeBounds: { absoluteMinimumTime: 0,
702
+ timeBounds: { minimumSafePosition: 0,
679
703
  timeshiftDepth: null,
680
- maximumTimeData: { isLinear: false,
681
- value: 10,
682
- time: 10 } },
704
+ maximumTimeData: {
705
+ isLinear: false,
706
+ maximumSafePosition: 10,
707
+ time: 10,
708
+ } },
683
709
  suggestedPresentationDelay: 99,
684
710
  uris: ["url1", "url2"] };
685
711
 
@@ -725,10 +751,10 @@ describe("Manifest - Manifest", () => {
725
751
  newPeriod3,
726
752
  newPeriod4,
727
753
  newPeriod5 ],
728
- timeBounds: { absoluteMinimumTime: 0,
754
+ timeBounds: { minimumSafePosition: 0,
729
755
  timeshiftDepth: null,
730
756
  maximumTimeData: { isLinear: false,
731
- value: 10,
757
+ maximumSafePosition: 10,
732
758
  time: 10 } },
733
759
  uris: ["url3", "url4"] };
734
760