rx-player 3.33.4 → 3.33.5-dev.2025040100
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 +29 -1
- package/VERSION +1 -1
- package/dist/_esm5.processed/compat/browser_detection.js +1 -1
- package/dist/_esm5.processed/compat/eme/eme-api-implementation.js +1 -1
- package/dist/_esm5.processed/core/api/debug/modules/segment_buffer_content.js +39 -1
- package/dist/_esm5.processed/core/api/public_api.js +2 -2
- package/dist/_esm5.processed/core/api/tracks_management/track_choice_manager.js +5 -1
- package/dist/_esm5.processed/core/decrypt/find_key_system.js +104 -66
- package/dist/_esm5.processed/core/decrypt/session_events_listener.js +26 -18
- package/dist/_esm5.processed/core/init/utils/rebuffering_controller.js +4 -2
- package/dist/_esm5.processed/core/segment_buffers/garbage_collector.js +4 -0
- package/dist/_esm5.processed/core/stream/representation/representation_stream.js +27 -45
- package/dist/_esm5.processed/core/stream/representation/utils/push_init_segment.js +0 -3
- package/dist/_esm5.processed/core/stream/representation/utils/push_media_segment.js +0 -3
- package/dist/mpd-parser.wasm +0 -0
- package/dist/rx-player.js +248 -206
- package/dist/rx-player.min.js +1 -1
- package/package.json +3 -3
- package/.vscode/settings.json +0 -9
- package/experimental/features/index.d.ts-E +0 -16
- package/experimental/features/index.js-E +0 -16
- package/experimental/index.d.ts-E +0 -16
- package/experimental/index.js-E +0 -16
- package/experimental/tools/VideoThumbnailLoader/index.d.ts-E +0 -18
- package/experimental/tools/VideoThumbnailLoader/index.js-E +0 -18
- package/experimental/tools/index.d.ts-E +0 -16
- package/experimental/tools/index.js-E +0 -16
- package/features/index.d.ts-E +0 -16
- package/features/index.js-E +0 -16
- package/logger/index.d.ts-E +0 -17
- package/logger/index.js-E +0 -17
- package/minimal/index.d.ts-E +0 -17
- package/minimal/index.js-E +0 -17
- package/tools/TextTrackRenderer.d.ts-E +0 -18
- package/tools/TextTrackRenderer.js-E +0 -18
- package/tools/index.d.ts-E +0 -16
- package/tools/index.js-E +0 -16
- package/tools/string-utils.d.ts-E +0 -18
- package/tools/string-utils.js-E +0 -18
- package/types/index.d.ts-E +0 -16
- package/types/index.js-E +0 -15
|
@@ -71,23 +71,16 @@ export default function RepresentationStream(_a, callbacks, parentCancelSignal)
|
|
|
71
71
|
var period = content.period, adaptation = content.adaptation, representation = content.representation;
|
|
72
72
|
var bufferGoal = options.bufferGoal, maxBufferSize = options.maxBufferSize, drmSystemId = options.drmSystemId, fastSwitchThreshold = options.fastSwitchThreshold;
|
|
73
73
|
var bufferType = adaptation.type;
|
|
74
|
-
/** `TaskCanceller` stopping
|
|
75
|
-
var
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* `TaskCanceller` allowing to only stop segment loading and checking operations.
|
|
79
|
-
* This allows to stop only tasks linked to network resource usage, which is
|
|
80
|
-
* often a limited resource, while still letting buffer operations to finish.
|
|
81
|
-
*/
|
|
82
|
-
var segmentsLoadingCanceller = new TaskCanceller();
|
|
83
|
-
segmentsLoadingCanceller.linkToSignal(globalCanceller.signal);
|
|
74
|
+
/** `TaskCanceller` stopping operations performed by the `RepresentationStream` */
|
|
75
|
+
var canceller = new TaskCanceller();
|
|
76
|
+
canceller.linkToSignal(parentCancelSignal);
|
|
84
77
|
/** Saved initialization segment state for this representation. */
|
|
85
78
|
var initSegmentState = {
|
|
86
79
|
segment: representation.index.getInitSegment(),
|
|
87
80
|
uniqueId: null,
|
|
88
81
|
isLoaded: false,
|
|
89
82
|
};
|
|
90
|
-
|
|
83
|
+
canceller.signal.register(function () {
|
|
91
84
|
// Free initialization segment if one has been declared
|
|
92
85
|
if (initSegmentState.uniqueId !== null) {
|
|
93
86
|
segmentBuffer.freeInitSegment(initSegmentState.uniqueId);
|
|
@@ -97,7 +90,7 @@ export default function RepresentationStream(_a, callbacks, parentCancelSignal)
|
|
|
97
90
|
var lastSegmentQueue = new SharedReference({
|
|
98
91
|
initSegment: null,
|
|
99
92
|
segmentQueue: [],
|
|
100
|
-
},
|
|
93
|
+
}, canceller.signal);
|
|
101
94
|
/** If `true`, the current Representation has a linked initialization segment. */
|
|
102
95
|
var hasInitSegment = initSegmentState.segment !== null;
|
|
103
96
|
if (!hasInitSegment) {
|
|
@@ -120,7 +113,7 @@ export default function RepresentationStream(_a, callbacks, parentCancelSignal)
|
|
|
120
113
|
encryptionData.every(function (e) { return e.keyIds !== undefined; })) {
|
|
121
114
|
hasSentEncryptionData = true;
|
|
122
115
|
callbacks.encryptionDataEncountered(encryptionData.map(function (d) { return objectAssign({ content: content }, d); }));
|
|
123
|
-
if (
|
|
116
|
+
if (canceller.isUsed()) {
|
|
124
117
|
return; // previous callback has stopped everything by side-effect
|
|
125
118
|
}
|
|
126
119
|
}
|
|
@@ -128,10 +121,10 @@ export default function RepresentationStream(_a, callbacks, parentCancelSignal)
|
|
|
128
121
|
/** Will load every segments in `lastSegmentQueue` */
|
|
129
122
|
var downloadingQueue = new DownloadingQueue(content, lastSegmentQueue, segmentFetcher, hasInitSegment);
|
|
130
123
|
downloadingQueue.addEventListener("error", function (err) {
|
|
131
|
-
if (
|
|
124
|
+
if (canceller.signal.isCancelled()) {
|
|
132
125
|
return; // ignore post requests-cancellation loading-related errors,
|
|
133
126
|
}
|
|
134
|
-
|
|
127
|
+
canceller.cancel(); // Stop every operations
|
|
135
128
|
callbacks.error(err);
|
|
136
129
|
});
|
|
137
130
|
downloadingQueue.addEventListener("parsedInitSegment", onParsedChunk);
|
|
@@ -139,7 +132,7 @@ export default function RepresentationStream(_a, callbacks, parentCancelSignal)
|
|
|
139
132
|
downloadingQueue.addEventListener("emptyQueue", checkStatus);
|
|
140
133
|
downloadingQueue.addEventListener("requestRetry", function (payload) {
|
|
141
134
|
callbacks.warning(payload.error);
|
|
142
|
-
if (
|
|
135
|
+
if (canceller.signal.isCancelled()) {
|
|
143
136
|
return; // If the previous callback led to loading operations being stopped, skip
|
|
144
137
|
}
|
|
145
138
|
var retriedSegment = payload.segment;
|
|
@@ -153,30 +146,30 @@ export default function RepresentationStream(_a, callbacks, parentCancelSignal)
|
|
|
153
146
|
});
|
|
154
147
|
downloadingQueue.addEventListener("fullyLoadedSegment", function (segment) {
|
|
155
148
|
segmentBuffer
|
|
156
|
-
.endOfSegment(objectAssign({ segment: segment }, content),
|
|
149
|
+
.endOfSegment(objectAssign({ segment: segment }, content), canceller.signal)
|
|
157
150
|
.catch(onFatalBufferError);
|
|
158
151
|
});
|
|
159
152
|
downloadingQueue.start();
|
|
160
|
-
|
|
153
|
+
canceller.signal.register(function () {
|
|
161
154
|
downloadingQueue.removeEventListener();
|
|
162
155
|
downloadingQueue.stop();
|
|
163
156
|
});
|
|
164
157
|
playbackObserver.listen(checkStatus, {
|
|
165
158
|
includeLastObservation: false,
|
|
166
|
-
clearSignal:
|
|
159
|
+
clearSignal: canceller.signal,
|
|
167
160
|
});
|
|
168
|
-
content.manifest.addEventListener("manifestUpdate", checkStatus,
|
|
161
|
+
content.manifest.addEventListener("manifestUpdate", checkStatus, canceller.signal);
|
|
169
162
|
bufferGoal.onUpdate(checkStatus, {
|
|
170
163
|
emitCurrentValue: false,
|
|
171
|
-
clearSignal:
|
|
164
|
+
clearSignal: canceller.signal,
|
|
172
165
|
});
|
|
173
166
|
maxBufferSize.onUpdate(checkStatus, {
|
|
174
167
|
emitCurrentValue: false,
|
|
175
|
-
clearSignal:
|
|
168
|
+
clearSignal: canceller.signal,
|
|
176
169
|
});
|
|
177
170
|
terminate.onUpdate(checkStatus, {
|
|
178
171
|
emitCurrentValue: false,
|
|
179
|
-
clearSignal:
|
|
172
|
+
clearSignal: canceller.signal,
|
|
180
173
|
});
|
|
181
174
|
checkStatus();
|
|
182
175
|
return;
|
|
@@ -187,7 +180,7 @@ export default function RepresentationStream(_a, callbacks, parentCancelSignal)
|
|
|
187
180
|
*/
|
|
188
181
|
function checkStatus() {
|
|
189
182
|
var _a, _b;
|
|
190
|
-
if (
|
|
183
|
+
if (canceller.isUsed()) {
|
|
191
184
|
return; // Stop all buffer status checking if load operations are stopped
|
|
192
185
|
}
|
|
193
186
|
var observation = playbackObserver.getReference().getValue();
|
|
@@ -232,7 +225,7 @@ export default function RepresentationStream(_a, callbacks, parentCancelSignal)
|
|
|
232
225
|
log.debug("Stream: Urgent switch, terminate now.", bufferType);
|
|
233
226
|
lastSegmentQueue.setValue({ initSegment: null, segmentQueue: [] });
|
|
234
227
|
lastSegmentQueue.finish();
|
|
235
|
-
|
|
228
|
+
canceller.cancel();
|
|
236
229
|
callbacks.terminating();
|
|
237
230
|
return;
|
|
238
231
|
}
|
|
@@ -254,7 +247,7 @@ export default function RepresentationStream(_a, callbacks, parentCancelSignal)
|
|
|
254
247
|
if (nextQueue.length === 0 && nextInit === null) {
|
|
255
248
|
log.debug("Stream: No request left, terminate", bufferType);
|
|
256
249
|
lastSegmentQueue.finish();
|
|
257
|
-
|
|
250
|
+
canceller.cancel();
|
|
258
251
|
callbacks.terminating();
|
|
259
252
|
return;
|
|
260
253
|
}
|
|
@@ -268,7 +261,7 @@ export default function RepresentationStream(_a, callbacks, parentCancelSignal)
|
|
|
268
261
|
hasFinishedLoading: status.hasFinishedLoading,
|
|
269
262
|
neededSegments: status.neededSegments,
|
|
270
263
|
});
|
|
271
|
-
if (
|
|
264
|
+
if (canceller.signal.isCancelled()) {
|
|
272
265
|
return; // previous callback has stopped loading operations by side-effect
|
|
273
266
|
}
|
|
274
267
|
var UPTO_CURRENT_POSITION_CLEANUP = config.getCurrent().UPTO_CURRENT_POSITION_CLEANUP;
|
|
@@ -276,7 +269,7 @@ export default function RepresentationStream(_a, callbacks, parentCancelSignal)
|
|
|
276
269
|
var gcedPosition = Math.max(0, initialWantedTime - UPTO_CURRENT_POSITION_CLEANUP);
|
|
277
270
|
if (gcedPosition > 0) {
|
|
278
271
|
segmentBuffer
|
|
279
|
-
.removeBuffer(0, gcedPosition,
|
|
272
|
+
.removeBuffer(0, gcedPosition, canceller.signal)
|
|
280
273
|
.catch(onFatalBufferError);
|
|
281
274
|
}
|
|
282
275
|
}
|
|
@@ -290,11 +283,6 @@ export default function RepresentationStream(_a, callbacks, parentCancelSignal)
|
|
|
290
283
|
* @param {Object} evt
|
|
291
284
|
*/
|
|
292
285
|
function onParsedChunk(evt) {
|
|
293
|
-
if (globalCanceller.isUsed()) {
|
|
294
|
-
// We should not do anything with segments if the `RepresentationStream`
|
|
295
|
-
// is not running anymore.
|
|
296
|
-
return;
|
|
297
|
-
}
|
|
298
286
|
if (evt.segmentType === "init") {
|
|
299
287
|
initSegmentState.isLoaded = true;
|
|
300
288
|
// Now that the initialization segment has been parsed - which may have
|
|
@@ -304,9 +292,6 @@ export default function RepresentationStream(_a, callbacks, parentCancelSignal)
|
|
|
304
292
|
var allEncryptionData = representation.getAllEncryptionData();
|
|
305
293
|
if (allEncryptionData.length > 0) {
|
|
306
294
|
callbacks.encryptionDataEncountered(allEncryptionData.map(function (p) { return objectAssign({ content: content }, p); }));
|
|
307
|
-
if (globalCanceller.isUsed()) {
|
|
308
|
-
return; // previous callback has stopped everything by side-effect
|
|
309
|
-
}
|
|
310
295
|
}
|
|
311
296
|
}
|
|
312
297
|
if (evt.initializationData !== null) {
|
|
@@ -320,7 +305,7 @@ export default function RepresentationStream(_a, callbacks, parentCancelSignal)
|
|
|
320
305
|
segment: evt.segment,
|
|
321
306
|
segmentData: evt.initializationData,
|
|
322
307
|
segmentBuffer: segmentBuffer,
|
|
323
|
-
},
|
|
308
|
+
}, canceller.signal)
|
|
324
309
|
.then(function (result) {
|
|
325
310
|
if (result !== null) {
|
|
326
311
|
callbacks.addedSegment(result);
|
|
@@ -340,20 +325,17 @@ export default function RepresentationStream(_a, callbacks, parentCancelSignal)
|
|
|
340
325
|
var allEncryptionData = representation.getAllEncryptionData();
|
|
341
326
|
if (allEncryptionData.length > 0) {
|
|
342
327
|
callbacks.encryptionDataEncountered(allEncryptionData.map(function (p) { return objectAssign({ content: content }, p); }));
|
|
343
|
-
if (globalCanceller.isUsed()) {
|
|
344
|
-
return; // previous callback has stopped everything by side-effect
|
|
345
|
-
}
|
|
346
328
|
}
|
|
347
329
|
}
|
|
348
330
|
if (needsManifestRefresh === true) {
|
|
349
331
|
callbacks.needsManifestRefresh();
|
|
350
|
-
if (
|
|
332
|
+
if (canceller.isUsed()) {
|
|
351
333
|
return; // previous callback has stopped everything by side-effect
|
|
352
334
|
}
|
|
353
335
|
}
|
|
354
336
|
if (inbandEvents !== undefined && inbandEvents.length > 0) {
|
|
355
337
|
callbacks.inbandEvent(inbandEvents);
|
|
356
|
-
if (
|
|
338
|
+
if (canceller.isUsed()) {
|
|
357
339
|
return; // previous callback has stopped everything by side-effect
|
|
358
340
|
}
|
|
359
341
|
}
|
|
@@ -365,7 +347,7 @@ export default function RepresentationStream(_a, callbacks, parentCancelSignal)
|
|
|
365
347
|
parsedSegment: evt,
|
|
366
348
|
segment: evt.segment,
|
|
367
349
|
segmentBuffer: segmentBuffer,
|
|
368
|
-
},
|
|
350
|
+
}, canceller.signal)
|
|
369
351
|
.then(function (result) {
|
|
370
352
|
if (result !== null) {
|
|
371
353
|
callbacks.addedSegment(result);
|
|
@@ -381,13 +363,13 @@ export default function RepresentationStream(_a, callbacks, parentCancelSignal)
|
|
|
381
363
|
* @param {*} err
|
|
382
364
|
*/
|
|
383
365
|
function onFatalBufferError(err) {
|
|
384
|
-
if (
|
|
366
|
+
if (canceller.isUsed() && err instanceof CancellationError) {
|
|
385
367
|
// The error is linked to cancellation AND we explicitely cancelled buffer
|
|
386
368
|
// operations.
|
|
387
369
|
// We can thus ignore it, it is very unlikely to lead to true buffer issues.
|
|
388
370
|
return;
|
|
389
371
|
}
|
|
390
|
-
|
|
372
|
+
canceller.cancel();
|
|
391
373
|
callbacks.error(err);
|
|
392
374
|
}
|
|
393
375
|
}
|
|
@@ -64,9 +64,6 @@ export default function pushInitSegment(_a, cancelSignal_1) {
|
|
|
64
64
|
return __generator(this, function (_c) {
|
|
65
65
|
switch (_c.label) {
|
|
66
66
|
case 0:
|
|
67
|
-
if (cancelSignal.cancellationError !== null) {
|
|
68
|
-
throw cancelSignal.cancellationError;
|
|
69
|
-
}
|
|
70
67
|
codec = content.representation.getMimeTypeString();
|
|
71
68
|
data = {
|
|
72
69
|
initSegmentUniqueId: initSegmentUniqueId,
|
|
@@ -69,9 +69,6 @@ export default function pushMediaSegment(_a, cancelSignal_1) {
|
|
|
69
69
|
if (parsedSegment.chunkData === null) {
|
|
70
70
|
return [2 /*return*/, null];
|
|
71
71
|
}
|
|
72
|
-
if (cancelSignal.cancellationError !== null) {
|
|
73
|
-
throw cancelSignal.cancellationError;
|
|
74
|
-
}
|
|
75
72
|
chunkData = parsedSegment.chunkData, chunkInfos = parsedSegment.chunkInfos, chunkOffset = parsedSegment.chunkOffset, chunkSize = parsedSegment.chunkSize, appendWindow = parsedSegment.appendWindow;
|
|
76
73
|
codec = content.representation.getMimeTypeString();
|
|
77
74
|
APPEND_WINDOW_SECURITIES = config.getCurrent().APPEND_WINDOW_SECURITIES;
|
package/dist/mpd-parser.wasm
CHANGED
|
Binary file
|