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.
- package/CHANGELOG.md +12 -0
- package/VERSION +1 -1
- package/dist/_esm5.processed/core/abr/abr_manager.d.ts +7 -3
- package/dist/_esm5.processed/core/abr/abr_manager.js +4 -3
- package/dist/_esm5.processed/core/abr/representation_estimator.d.ts +13 -8
- package/dist/_esm5.processed/core/abr/representation_estimator.js +4 -4
- package/dist/_esm5.processed/core/api/public_api.js +13 -14
- package/dist/_esm5.processed/core/init/content_time_boundaries_observer.d.ts +52 -0
- package/dist/_esm5.processed/core/init/content_time_boundaries_observer.js +223 -0
- package/dist/_esm5.processed/core/init/create_stream_playback_observer.js +17 -6
- package/dist/_esm5.processed/core/init/get_initial_time.d.ts +30 -5
- package/dist/_esm5.processed/core/init/get_initial_time.js +20 -13
- package/dist/_esm5.processed/core/init/load_on_media_source.js +16 -3
- package/dist/_esm5.processed/core/init/media_duration_updater.d.ts +56 -0
- package/dist/_esm5.processed/core/init/media_duration_updater.js +188 -0
- package/dist/_esm5.processed/core/stream/adaptation/adaptation_stream.d.ts +2 -5
- package/dist/_esm5.processed/core/stream/adaptation/create_representation_estimator.d.ts +3 -2
- package/dist/_esm5.processed/core/stream/adaptation/create_representation_estimator.js +3 -3
- package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.js +2 -22
- package/dist/_esm5.processed/core/stream/period/period_stream.d.ts +2 -5
- package/dist/_esm5.processed/core/stream/period/period_stream.js +6 -4
- package/dist/_esm5.processed/core/stream/representation/get_buffer_status.d.ts +4 -2
- package/dist/_esm5.processed/core/stream/representation/get_buffer_status.js +85 -42
- package/dist/_esm5.processed/core/stream/representation/representation_stream.js +3 -3
- package/dist/_esm5.processed/manifest/manifest.d.ts +14 -5
- package/dist/_esm5.processed/manifest/manifest.js +31 -12
- package/dist/_esm5.processed/manifest/period.d.ts +6 -0
- package/dist/_esm5.processed/manifest/period.js +9 -0
- package/dist/_esm5.processed/manifest/representation_index/types.d.ts +7 -2
- package/dist/_esm5.processed/parsers/manifest/dash/common/get_minimum_and_maximum_positions.d.ts +5 -1
- package/dist/_esm5.processed/parsers/manifest/dash/common/get_minimum_and_maximum_positions.js +6 -4
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/base.js +2 -1
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/list.d.ts +4 -0
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/list.js +4 -2
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/template.js +4 -2
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.js +3 -3
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_mpd.js +28 -20
- package/dist/_esm5.processed/parsers/manifest/local/parse_local_manifest.js +3 -2
- package/dist/_esm5.processed/parsers/manifest/metaplaylist/metaplaylist_parser.js +9 -3
- package/dist/_esm5.processed/parsers/manifest/smooth/create_parser.js +26 -17
- package/dist/_esm5.processed/parsers/manifest/types.d.ts +45 -17
- package/dist/_esm5.processed/parsers/manifest/utils/{get_maximum_position.d.ts → get_maximum_positions.d.ts} +4 -1
- package/dist/_esm5.processed/parsers/manifest/utils/{get_maximum_position.js → get_maximum_positions.js} +10 -6
- package/dist/rx-player.js +854 -351
- package/dist/rx-player.min.js +1 -1
- package/package.json +1 -1
- package/sonar-project.properties +1 -1
- package/src/core/abr/abr_manager.ts +11 -3
- package/src/core/abr/representation_estimator.ts +17 -10
- package/src/core/api/public_api.ts +13 -15
- package/src/core/init/content_time_boundaries_observer.ts +312 -0
- package/src/core/init/create_stream_playback_observer.ts +18 -7
- package/src/core/init/get_initial_time.ts +52 -19
- package/src/core/init/load_on_media_source.ts +22 -5
- package/src/core/init/media_duration_updater.ts +268 -0
- package/src/core/stream/adaptation/adaptation_stream.ts +2 -5
- package/src/core/stream/adaptation/create_representation_estimator.ts +6 -3
- package/src/core/stream/orchestrator/stream_orchestrator.ts +2 -29
- package/src/core/stream/period/period_stream.ts +12 -9
- package/src/core/stream/representation/get_buffer_status.ts +102 -41
- package/src/core/stream/representation/representation_stream.ts +3 -3
- package/src/manifest/__tests__/manifest.test.ts +94 -68
- package/src/manifest/manifest.ts +73 -33
- package/src/manifest/period.ts +10 -0
- package/src/manifest/representation_index/types.ts +7 -2
- package/src/parsers/manifest/dash/common/get_minimum_and_maximum_positions.ts +10 -5
- package/src/parsers/manifest/dash/common/indexes/base.ts +4 -3
- package/src/parsers/manifest/dash/common/indexes/list.ts +8 -1
- package/src/parsers/manifest/dash/common/indexes/template.ts +8 -3
- package/src/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.ts +7 -7
- package/src/parsers/manifest/dash/common/parse_mpd.ts +38 -20
- package/src/parsers/manifest/local/parse_local_manifest.ts +3 -2
- package/src/parsers/manifest/metaplaylist/metaplaylist_parser.ts +9 -4
- package/src/parsers/manifest/smooth/create_parser.ts +36 -18
- package/src/parsers/manifest/types.ts +45 -17
- package/src/parsers/manifest/utils/{get_maximum_position.ts → get_maximum_positions.ts} +13 -7
- package/dist/_esm5.processed/core/init/duration_updater.d.ts +0 -27
- package/dist/_esm5.processed/core/init/duration_updater.js +0 -136
- 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 {
|
|
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
|
-
|
|
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
|
|
104
|
-
|
|
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,
|
|
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
|
-
|
|
149
|
-
|
|
150
|
-
|
|
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
|
|
304
|
+
const initialWantedTime = observation.position + observation.wantedTimeOffset;
|
|
305
305
|
const status = getBufferStatus(content,
|
|
306
|
-
|
|
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
|
-
|
|
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: {
|
|
50
|
+
timeBounds: { minimumSafePosition: 0,
|
|
51
51
|
timeshiftDepth: null,
|
|
52
|
-
maximumTimeData: {
|
|
53
|
-
|
|
54
|
-
|
|
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.
|
|
67
|
-
expect(manifest.
|
|
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: {
|
|
88
|
+
timeBounds: { minimumSafePosition: 0,
|
|
87
89
|
timeshiftDepth: null,
|
|
88
|
-
maximumTimeData: {
|
|
89
|
-
|
|
90
|
-
|
|
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: {
|
|
130
|
+
timeBounds: { minimumSafePosition: 0,
|
|
127
131
|
timeshiftDepth: null,
|
|
128
|
-
maximumTimeData: {
|
|
129
|
-
|
|
130
|
-
|
|
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: {
|
|
170
|
+
timeBounds: { minimumSafePosition: 0,
|
|
165
171
|
timeshiftDepth: null,
|
|
166
|
-
maximumTimeData: {
|
|
167
|
-
|
|
168
|
-
|
|
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: {
|
|
210
|
+
timeBounds: { minimumSafePosition: 0,
|
|
203
211
|
timeshiftDepth: null,
|
|
204
|
-
maximumTimeData: {
|
|
205
|
-
|
|
206
|
-
|
|
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: {
|
|
255
|
+
timeBounds: { minimumSafePosition: 5,
|
|
246
256
|
timeshiftDepth: null,
|
|
247
257
|
maximumTimeData: { isLinear: false,
|
|
248
|
-
|
|
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.
|
|
271
|
-
expect(manifest.
|
|
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: {
|
|
314
|
+
timeBounds: { minimumSafePosition: 0,
|
|
305
315
|
timeshiftDepth: null,
|
|
306
|
-
maximumTimeData: {
|
|
307
|
-
|
|
308
|
-
|
|
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: {
|
|
340
|
+
timeBounds: { minimumSafePosition: 0,
|
|
329
341
|
timeshiftDepth: null,
|
|
330
|
-
maximumTimeData: {
|
|
331
|
-
|
|
332
|
-
|
|
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: {
|
|
379
|
+
timeBounds: { minimumSafePosition: 7,
|
|
366
380
|
timeshiftDepth: 10,
|
|
367
|
-
maximumTimeData: {
|
|
368
|
-
|
|
369
|
-
|
|
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: {
|
|
408
|
+
_timeBounds: { minimumSafePosition: 7,
|
|
393
409
|
timeshiftDepth: 5,
|
|
394
|
-
maximumTimeData: {
|
|
395
|
-
|
|
396
|
-
|
|
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.
|
|
409
|
-
expect(manifest.
|
|
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: {
|
|
452
|
+
timeBounds: { minimumSafePosition: 0,
|
|
435
453
|
timeshiftDepth: null,
|
|
436
|
-
maximumTimeData: {
|
|
437
|
-
|
|
438
|
-
|
|
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: {
|
|
516
|
+
timeBounds: { minimumSafePosition: 0,
|
|
497
517
|
timeshiftDepth: null,
|
|
498
518
|
maximumTimeData: { isLinear: false,
|
|
499
|
-
|
|
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: {
|
|
551
|
+
timeBounds: { minimumSafePosition: 0,
|
|
532
552
|
timeshiftDepth: null,
|
|
533
|
-
maximumTimeData: {
|
|
534
|
-
|
|
535
|
-
|
|
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: {
|
|
595
|
+
timeBounds: { minimumSafePosition: 0,
|
|
574
596
|
timeshiftDepth: null,
|
|
575
597
|
maximumTimeData: { isLinear: false,
|
|
576
|
-
|
|
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: {
|
|
628
|
+
timeBounds: { minimumSafePosition: 0,
|
|
607
629
|
timeshiftDepth: null,
|
|
608
|
-
maximumTimeData: {
|
|
609
|
-
|
|
610
|
-
|
|
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: {
|
|
671
|
+
timeBounds: { minimumSafePosition: 0,
|
|
648
672
|
timeshiftDepth: null,
|
|
649
673
|
maximumTimeData: { isLinear: false,
|
|
650
|
-
|
|
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: {
|
|
702
|
+
timeBounds: { minimumSafePosition: 0,
|
|
679
703
|
timeshiftDepth: null,
|
|
680
|
-
maximumTimeData: {
|
|
681
|
-
|
|
682
|
-
|
|
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: {
|
|
754
|
+
timeBounds: { minimumSafePosition: 0,
|
|
729
755
|
timeshiftDepth: null,
|
|
730
756
|
maximumTimeData: { isLinear: false,
|
|
731
|
-
|
|
757
|
+
maximumSafePosition: 10,
|
|
732
758
|
time: 10 } },
|
|
733
759
|
uris: ["url3", "url4"] };
|
|
734
760
|
|