rx-player 3.30.0-dev.2023020100 → 3.30.0-dev.2023022200
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 +2 -1
- package/VERSION +1 -1
- package/dist/_esm5.processed/compat/eme/close_session.js +2 -2
- package/dist/_esm5.processed/compat/event_listeners.js +1 -1
- package/dist/_esm5.processed/core/adaptive/adaptive_representation_selector.js +4 -2
- package/dist/_esm5.processed/core/api/debug/buffer_graph.d.ts +28 -0
- package/dist/_esm5.processed/core/api/debug/buffer_graph.js +175 -0
- package/dist/_esm5.processed/core/api/debug/buffer_size_graph.d.ts +10 -0
- package/dist/_esm5.processed/core/api/debug/buffer_size_graph.js +105 -0
- package/dist/_esm5.processed/core/api/debug/constants.d.ts +2 -0
- package/dist/_esm5.processed/core/api/debug/constants.js +2 -0
- package/dist/_esm5.processed/core/api/debug/index.d.ts +2 -0
- package/dist/_esm5.processed/core/api/debug/index.js +2 -0
- package/dist/_esm5.processed/core/api/debug/modules/general_info.d.ts +3 -0
- package/dist/_esm5.processed/core/api/debug/modules/general_info.js +199 -0
- package/dist/_esm5.processed/core/api/debug/modules/segment_buffer_content.d.ts +4 -0
- package/dist/_esm5.processed/core/api/debug/modules/segment_buffer_content.js +121 -0
- package/dist/_esm5.processed/core/api/debug/modules/segment_buffer_size.d.ts +3 -0
- package/dist/_esm5.processed/core/api/debug/modules/segment_buffer_size.js +35 -0
- package/dist/_esm5.processed/core/api/debug/render.d.ts +3 -0
- package/dist/_esm5.processed/core/api/debug/render.js +32 -0
- package/dist/_esm5.processed/core/api/debug/utils.d.ts +39 -0
- package/dist/_esm5.processed/core/api/debug/utils.js +57 -0
- package/dist/_esm5.processed/core/api/playback_observer.js +3 -2
- package/dist/_esm5.processed/core/api/public_api.d.ts +3 -0
- package/dist/_esm5.processed/core/api/public_api.js +24 -13
- package/dist/_esm5.processed/core/api/utils.js +3 -3
- package/dist/_esm5.processed/core/decrypt/__tests__/__global__/utils.d.ts +5 -5
- package/dist/_esm5.processed/core/decrypt/attach_media_keys.js +1 -1
- package/dist/_esm5.processed/core/decrypt/content_decryptor.js +1 -1
- package/dist/_esm5.processed/core/decrypt/session_events_listener.js +37 -47
- package/dist/_esm5.processed/core/decrypt/utils/check_key_statuses.js +4 -0
- package/dist/_esm5.processed/core/fetchers/cdn_prioritizer.d.ts +17 -8
- package/dist/_esm5.processed/core/fetchers/cdn_prioritizer.js +10 -6
- package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.js +5 -4
- package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.d.ts +22 -5
- package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.js +37 -21
- package/dist/_esm5.processed/core/fetchers/segment/task_prioritizer.js +21 -23
- package/dist/_esm5.processed/core/fetchers/utils/schedule_request.js +6 -5
- package/dist/_esm5.processed/core/init/directfile_content_initializer.js +1 -1
- package/dist/_esm5.processed/core/init/media_source_content_initializer.js +27 -31
- package/dist/_esm5.processed/core/init/utils/content_time_boundaries_observer.js +2 -2
- package/dist/_esm5.processed/core/init/utils/create_media_source.js +3 -12
- package/dist/_esm5.processed/core/init/utils/end_of_stream.js +6 -3
- package/dist/_esm5.processed/core/init/utils/get_loaded_reference.js +2 -1
- package/dist/_esm5.processed/core/init/utils/initial_seek_and_play.js +9 -5
- package/dist/_esm5.processed/core/init/utils/initialize_content_decryption.js +2 -1
- package/dist/_esm5.processed/core/init/utils/media_duration_updater.js +23 -19
- package/dist/_esm5.processed/core/init/utils/stream_events_emitter/stream_events_emitter.js +6 -4
- package/dist/_esm5.processed/core/init/utils/throw_on_media_error.js +1 -1
- package/dist/_esm5.processed/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.js +7 -10
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/html_text_segment_buffer.js +4 -2
- package/dist/_esm5.processed/core/segment_buffers/segment_buffers_store.js +13 -9
- package/dist/_esm5.processed/core/stream/adaptation/adaptation_stream.js +10 -11
- package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.js +26 -12
- package/dist/_esm5.processed/core/stream/period/period_stream.js +11 -10
- package/dist/_esm5.processed/core/stream/representation/representation_stream.js +15 -15
- package/dist/_esm5.processed/core/stream/representation/utils/append_segment_to_buffer.js +1 -1
- package/dist/_esm5.processed/core/stream/representation/utils/downloading_queue.js +16 -6
- package/dist/_esm5.processed/experimental/features/debug_element.d.ts +8 -0
- package/dist/_esm5.processed/experimental/features/debug_element.js +10 -0
- package/dist/_esm5.processed/experimental/features/index.d.ts +1 -0
- package/dist/_esm5.processed/experimental/features/index.js +1 -0
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/prepare_source_buffer.js +7 -4
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.js +5 -4
- package/dist/_esm5.processed/features/features_object.js +1 -0
- package/dist/_esm5.processed/features/initialize_features.js +13 -10
- package/dist/_esm5.processed/features/types.d.ts +3 -0
- package/dist/_esm5.processed/manifest/adaptation.js +4 -0
- package/dist/_esm5.processed/manifest/manifest.js +2 -0
- package/dist/_esm5.processed/manifest/representation.js +11 -4
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_adaptation_sets.js +105 -137
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representations.js +25 -5
- package/dist/_esm5.processed/public_types.d.ts +1 -0
- package/dist/_esm5.processed/transports/dash/add_segment_integrity_checks_to_loader.js +13 -12
- package/dist/_esm5.processed/transports/dash/low_latency_segment_loader.js +2 -2
- package/dist/_esm5.processed/transports/dash/manifest_parser.js +1 -1
- package/dist/_esm5.processed/transports/dash/segment_loader.js +4 -4
- package/dist/_esm5.processed/transports/local/segment_loader.js +13 -26
- package/dist/_esm5.processed/transports/smooth/segment_loader.js +4 -4
- package/dist/_esm5.processed/transports/utils/call_custom_manifest_loader.js +3 -3
- package/dist/_esm5.processed/utils/cancellable_sleep.js +4 -10
- package/dist/_esm5.processed/utils/create_cancellable_promise.d.ts +26 -0
- package/dist/_esm5.processed/utils/create_cancellable_promise.js +52 -0
- package/dist/_esm5.processed/utils/reference.js +6 -0
- package/dist/_esm5.processed/utils/request/xhr.js +1 -1
- package/dist/_esm5.processed/utils/task_canceller.d.ts +34 -15
- package/dist/_esm5.processed/utils/task_canceller.js +55 -22
- package/dist/rx-player.js +739 -626
- package/dist/rx-player.min.js +1 -1
- package/jest.config.js +1 -0
- package/package.json +18 -18
- package/scripts/build/constants.d.ts +1 -0
- package/scripts/report_build_sizes +4 -0
- package/sonar-project.properties +1 -1
- package/src/compat/eme/close_session.ts +2 -2
- package/src/compat/event_listeners.ts +1 -1
- package/src/core/adaptive/adaptive_representation_selector.ts +4 -2
- package/src/core/api/debug/buffer_graph.ts +247 -0
- package/src/core/api/debug/buffer_size_graph.ts +131 -0
- package/src/core/api/debug/constants.ts +2 -0
- package/src/core/api/debug/index.ts +3 -0
- package/src/core/api/debug/modules/general_info.ts +204 -0
- package/src/core/api/debug/modules/segment_buffer_content.ts +155 -0
- package/src/core/api/debug/modules/segment_buffer_size.ts +48 -0
- package/src/core/api/debug/render.ts +40 -0
- package/src/core/api/debug/utils.ts +103 -0
- package/src/core/api/playback_observer.ts +4 -2
- package/src/core/api/public_api.ts +27 -13
- package/src/core/api/utils.ts +3 -3
- package/src/core/decrypt/attach_media_keys.ts +1 -1
- package/src/core/decrypt/content_decryptor.ts +1 -1
- package/src/core/decrypt/session_events_listener.ts +37 -49
- package/src/core/decrypt/utils/check_key_statuses.ts +6 -0
- package/src/core/fetchers/cdn_prioritizer.ts +18 -9
- package/src/core/fetchers/manifest/manifest_fetcher.ts +5 -4
- package/src/core/fetchers/segment/segment_fetcher.ts +36 -14
- package/src/core/fetchers/segment/task_prioritizer.ts +25 -30
- package/src/core/fetchers/utils/schedule_request.ts +6 -5
- package/src/core/init/directfile_content_initializer.ts +1 -1
- package/src/core/init/media_source_content_initializer.ts +37 -41
- package/src/core/init/utils/content_time_boundaries_observer.ts +2 -2
- package/src/core/init/utils/create_media_source.ts +4 -16
- package/src/core/init/utils/end_of_stream.ts +6 -3
- package/src/core/init/utils/get_loaded_reference.ts +2 -1
- package/src/core/init/utils/initial_seek_and_play.ts +9 -5
- package/src/core/init/utils/initialize_content_decryption.ts +2 -1
- package/src/core/init/utils/media_duration_updater.ts +25 -20
- package/src/core/init/utils/stream_events_emitter/stream_events_emitter.ts +6 -4
- package/src/core/init/utils/throw_on_media_error.ts +1 -1
- package/src/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.ts +7 -11
- package/src/core/segment_buffers/implementations/text/html/html_text_segment_buffer.ts +4 -2
- package/src/core/segment_buffers/segment_buffers_store.ts +16 -13
- package/src/core/stream/adaptation/adaptation_stream.ts +10 -11
- package/src/core/stream/orchestrator/stream_orchestrator.ts +26 -12
- package/src/core/stream/period/period_stream.ts +11 -10
- package/src/core/stream/representation/representation_stream.ts +15 -15
- package/src/core/stream/representation/utils/append_segment_to_buffer.ts +1 -1
- package/src/core/stream/representation/utils/downloading_queue.ts +16 -4
- package/src/experimental/features/__tests__/debug_element.test.ts +26 -0
- package/src/experimental/features/debug_element.ts +13 -0
- package/src/experimental/features/index.ts +1 -0
- package/src/experimental/tools/VideoThumbnailLoader/prepare_source_buffer.ts +7 -4
- package/src/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.ts +5 -4
- package/src/features/__tests__/initialize_features.test.ts +11 -0
- package/src/features/features_object.ts +1 -0
- package/src/features/initialize_features.ts +15 -10
- package/src/features/types.ts +9 -0
- package/src/manifest/adaptation.ts +7 -0
- package/src/manifest/manifest.ts +4 -0
- package/src/manifest/representation.ts +10 -4
- package/src/parsers/manifest/dash/common/parse_adaptation_sets.ts +116 -151
- package/src/parsers/manifest/dash/common/parse_representations.ts +21 -4
- package/src/public_types.ts +1 -0
- package/src/transports/dash/add_segment_integrity_checks_to_loader.ts +30 -24
- package/src/transports/dash/low_latency_segment_loader.ts +2 -2
- package/src/transports/dash/manifest_parser.ts +1 -1
- package/src/transports/dash/segment_loader.ts +4 -4
- package/src/transports/local/segment_loader.ts +14 -30
- package/src/transports/smooth/segment_loader.ts +4 -4
- package/src/transports/utils/call_custom_manifest_loader.ts +3 -3
- package/src/typings/globals.d.ts +2 -0
- package/src/utils/cancellable_sleep.ts +5 -14
- package/src/utils/create_cancellable_promise.ts +69 -0
- package/src/utils/reference.ts +6 -0
- package/src/utils/request/xhr.ts +1 -1
- package/src/utils/task_canceller.ts +63 -34
package/dist/rx-player.js
CHANGED
|
@@ -1276,7 +1276,7 @@ function createCompatibleEventListener(eventNames, prefixes) {
|
|
|
1276
1276
|
var mem;
|
|
1277
1277
|
var prefixedEvents = eventPrefixed(eventNames, prefixes);
|
|
1278
1278
|
return function (element, listener, cancelSignal) {
|
|
1279
|
-
if (cancelSignal.isCancelled) {
|
|
1279
|
+
if (cancelSignal.isCancelled()) {
|
|
1280
1280
|
return;
|
|
1281
1281
|
}
|
|
1282
1282
|
// if the element is a HTMLElement we can detect
|
|
@@ -4147,7 +4147,7 @@ function _attachMediaKeys() {
|
|
|
4147
4147
|
_context.next = 5;
|
|
4148
4148
|
return closeAllSessions;
|
|
4149
4149
|
case 5:
|
|
4150
|
-
if (!cancelSignal.isCancelled) {
|
|
4150
|
+
if (!cancelSignal.isCancelled()) {
|
|
4151
4151
|
_context.next = 7;
|
|
4152
4152
|
break;
|
|
4153
4153
|
}
|
|
@@ -5311,7 +5311,7 @@ function closeSession(session) {
|
|
|
5311
5311
|
case 5:
|
|
5312
5312
|
_context2.prev = 5;
|
|
5313
5313
|
_context2.t0 = _context2["catch"](0);
|
|
5314
|
-
if (!timeoutCanceller.isUsed) {
|
|
5314
|
+
if (!timeoutCanceller.isUsed()) {
|
|
5315
5315
|
_context2.next = 9;
|
|
5316
5316
|
break;
|
|
5317
5317
|
}
|
|
@@ -5326,7 +5326,7 @@ function closeSession(session) {
|
|
|
5326
5326
|
_context2.next = 13;
|
|
5327
5327
|
return (0,cancellable_sleep/* default */.Z)(1000, timeoutCanceller.signal);
|
|
5328
5328
|
case 13:
|
|
5329
|
-
if (!timeoutCanceller.isUsed) {
|
|
5329
|
+
if (!timeoutCanceller.isUsed()) {
|
|
5330
5330
|
_context2.next = 15;
|
|
5331
5331
|
break;
|
|
5332
5332
|
}
|
|
@@ -7182,6 +7182,7 @@ var assert_unreachable = __webpack_require__(7904);
|
|
|
7182
7182
|
|
|
7183
7183
|
|
|
7184
7184
|
|
|
7185
|
+
|
|
7185
7186
|
/**
|
|
7186
7187
|
* Error thrown when the MediaKeySession has to be closed due to a trigger
|
|
7187
7188
|
* specified by user configuration.
|
|
@@ -7244,6 +7245,9 @@ function checkKeyStatuses(session, options, keySystem) {
|
|
|
7244
7245
|
keyId: keyId.buffer,
|
|
7245
7246
|
keyStatus: keyStatus
|
|
7246
7247
|
};
|
|
7248
|
+
if (log/* default.hasLevel */.Z.hasLevel("DEBUG")) {
|
|
7249
|
+
log/* default.debug */.Z.debug("DRM: key status update (" + (0,string_parsing/* bytesToHex */.ci)(keyId) + "): " + keyStatus);
|
|
7250
|
+
}
|
|
7247
7251
|
switch (keyStatus) {
|
|
7248
7252
|
case KEY_STATUSES.EXPIRED:
|
|
7249
7253
|
{
|
|
@@ -7358,14 +7362,13 @@ function SessionEventsListener(session, keySystemOptions, keySystem, callbacks,
|
|
|
7358
7362
|
var _keySystemOptions$get = keySystemOptions.getLicenseConfig,
|
|
7359
7363
|
getLicenseConfig = _keySystemOptions$get === void 0 ? {} : _keySystemOptions$get;
|
|
7360
7364
|
/** Allows to manually cancel everything the `SessionEventsListener` is doing. */
|
|
7361
|
-
var manualCanceller = new task_canceller/* default */.ZP(
|
|
7362
|
-
|
|
7363
|
-
});
|
|
7365
|
+
var manualCanceller = new task_canceller/* default */.ZP();
|
|
7366
|
+
manualCanceller.linkToSignal(cancelSignal);
|
|
7364
7367
|
if (!(0,is_null_or_undefined/* default */.Z)(session.closed)) {
|
|
7365
7368
|
session.closed.then(function () {
|
|
7366
7369
|
return manualCanceller.cancel();
|
|
7367
7370
|
})["catch"](function (err) {
|
|
7368
|
-
if (cancelSignal.isCancelled) {
|
|
7371
|
+
if (cancelSignal.isCancelled()) {
|
|
7369
7372
|
return;
|
|
7370
7373
|
}
|
|
7371
7374
|
manualCanceller.cancel();
|
|
@@ -7378,7 +7381,7 @@ function SessionEventsListener(session, keySystemOptions, keySystem, callbacks,
|
|
|
7378
7381
|
}, manualCanceller.signal);
|
|
7379
7382
|
onKeyStatusesChange(session, function (keyStatusesEvent) {
|
|
7380
7383
|
handleKeyStatusesChangeEvent(keyStatusesEvent)["catch"](function (error) {
|
|
7381
|
-
if (cancelSignal.isCancelled || manualCanceller.isUsed && error instanceof task_canceller/* CancellationSignal */.XG) {
|
|
7384
|
+
if (cancelSignal.isCancelled() || manualCanceller.isUsed() && error instanceof task_canceller/* CancellationSignal */.XG) {
|
|
7382
7385
|
return;
|
|
7383
7386
|
}
|
|
7384
7387
|
manualCanceller.cancel();
|
|
@@ -7394,7 +7397,7 @@ function SessionEventsListener(session, keySystemOptions, keySystem, callbacks,
|
|
|
7394
7397
|
retryPromiseWithBackoff(function () {
|
|
7395
7398
|
return runGetLicense(message, messageType);
|
|
7396
7399
|
}, backoffOptions, manualCanceller.signal).then(function (licenseObject) {
|
|
7397
|
-
if (manualCanceller.isUsed) {
|
|
7400
|
+
if (manualCanceller.isUsed()) {
|
|
7398
7401
|
return Promise.resolve();
|
|
7399
7402
|
}
|
|
7400
7403
|
if ((0,is_null_or_undefined/* default */.Z)(licenseObject)) {
|
|
@@ -7403,7 +7406,7 @@ function SessionEventsListener(session, keySystemOptions, keySystem, callbacks,
|
|
|
7403
7406
|
return updateSessionWithMessage(session, licenseObject);
|
|
7404
7407
|
}
|
|
7405
7408
|
})["catch"](function (err) {
|
|
7406
|
-
if (manualCanceller.isUsed) {
|
|
7409
|
+
if (manualCanceller.isUsed()) {
|
|
7407
7410
|
return;
|
|
7408
7411
|
}
|
|
7409
7412
|
manualCanceller.cancel();
|
|
@@ -7419,6 +7422,8 @@ function SessionEventsListener(session, keySystemOptions, keySystem, callbacks,
|
|
|
7419
7422
|
callbacks.onError(formattedError);
|
|
7420
7423
|
});
|
|
7421
7424
|
}, manualCanceller.signal);
|
|
7425
|
+
checkAndHandleCurrentKeyStatuses();
|
|
7426
|
+
return;
|
|
7422
7427
|
/**
|
|
7423
7428
|
* @param {Event} keyStatusesEvent
|
|
7424
7429
|
* @returns {Promise}
|
|
@@ -7426,32 +7431,19 @@ function SessionEventsListener(session, keySystemOptions, keySystem, callbacks,
|
|
|
7426
7431
|
function handleKeyStatusesChangeEvent(_x) {
|
|
7427
7432
|
return _handleKeyStatusesChangeEvent.apply(this, arguments);
|
|
7428
7433
|
}
|
|
7434
|
+
/**
|
|
7435
|
+
* Check current MediaKeyStatus for each key in the given MediaKeySession and:
|
|
7436
|
+
* - throw if at least one status is a non-recoverable error
|
|
7437
|
+
* - call warning callback for recoverable errors
|
|
7438
|
+
* - call onKeyUpdate callback when the MediaKeyStatus of any key is updated
|
|
7439
|
+
*/
|
|
7429
7440
|
function _handleKeyStatusesChangeEvent() {
|
|
7430
7441
|
_handleKeyStatusesChangeEvent = (0,asyncToGenerator/* default */.Z)( /*#__PURE__*/regenerator_default().mark(function _callee2(keyStatusesEvent) {
|
|
7431
|
-
var runOnKeyStatusesChangeCallback, _runOnKeyStatusesChangeCallback
|
|
7442
|
+
var runOnKeyStatusesChangeCallback, _runOnKeyStatusesChangeCallback;
|
|
7432
7443
|
return regenerator_default().wrap(function _callee2$(_context2) {
|
|
7433
7444
|
while (1) {
|
|
7434
7445
|
switch (_context2.prev = _context2.next) {
|
|
7435
7446
|
case 0:
|
|
7436
|
-
handleKeyStatusEvent = function _handleKeyStatusEvent() {
|
|
7437
|
-
if (manualCanceller.isUsed || session.keyStatuses.size === 0) {
|
|
7438
|
-
return;
|
|
7439
|
-
}
|
|
7440
|
-
var _checkKeyStatuses = checkKeyStatuses(session, keySystemOptions, keySystem),
|
|
7441
|
-
warning = _checkKeyStatuses.warning,
|
|
7442
|
-
blacklistedKeyIds = _checkKeyStatuses.blacklistedKeyIds,
|
|
7443
|
-
whitelistedKeyIds = _checkKeyStatuses.whitelistedKeyIds;
|
|
7444
|
-
if (warning !== undefined) {
|
|
7445
|
-
callbacks.onWarning(warning);
|
|
7446
|
-
if (manualCanceller.isUsed) {
|
|
7447
|
-
return;
|
|
7448
|
-
}
|
|
7449
|
-
}
|
|
7450
|
-
callbacks.onKeyUpdate({
|
|
7451
|
-
whitelistedKeyIds: whitelistedKeyIds,
|
|
7452
|
-
blacklistedKeyIds: blacklistedKeyIds
|
|
7453
|
-
});
|
|
7454
|
-
};
|
|
7455
7447
|
_runOnKeyStatusesChangeCallback = function _runOnKeyStatusesChan2() {
|
|
7456
7448
|
_runOnKeyStatusesChangeCallback = (0,asyncToGenerator/* default */.Z)( /*#__PURE__*/regenerator_default().mark(function _callee() {
|
|
7457
7449
|
var ret, err;
|
|
@@ -7459,7 +7451,7 @@ function SessionEventsListener(session, keySystemOptions, keySystem, callbacks,
|
|
|
7459
7451
|
while (1) {
|
|
7460
7452
|
switch (_context.prev = _context.next) {
|
|
7461
7453
|
case 0:
|
|
7462
|
-
if (!manualCanceller.isUsed) {
|
|
7454
|
+
if (!manualCanceller.isUsed()) {
|
|
7463
7455
|
_context.next = 2;
|
|
7464
7456
|
break;
|
|
7465
7457
|
}
|
|
@@ -7474,7 +7466,7 @@ function SessionEventsListener(session, keySystemOptions, keySystem, callbacks,
|
|
|
7474
7466
|
return keySystemOptions.onKeyStatusesChange(keyStatusesEvent, session);
|
|
7475
7467
|
case 6:
|
|
7476
7468
|
ret = _context.sent;
|
|
7477
|
-
if (!manualCanceller.isUsed) {
|
|
7469
|
+
if (!manualCanceller.isUsed()) {
|
|
7478
7470
|
_context.next = 9;
|
|
7479
7471
|
break;
|
|
7480
7472
|
}
|
|
@@ -7485,7 +7477,7 @@ function SessionEventsListener(session, keySystemOptions, keySystem, callbacks,
|
|
|
7485
7477
|
case 11:
|
|
7486
7478
|
_context.prev = 11;
|
|
7487
7479
|
_context.t0 = _context["catch"](3);
|
|
7488
|
-
if (!cancelSignal.isCancelled) {
|
|
7480
|
+
if (!cancelSignal.isCancelled()) {
|
|
7489
7481
|
_context.next = 15;
|
|
7490
7482
|
break;
|
|
7491
7483
|
}
|
|
@@ -7520,9 +7512,9 @@ function SessionEventsListener(session, keySystemOptions, keySystem, callbacks,
|
|
|
7520
7512
|
return _runOnKeyStatusesChangeCallback.apply(this, arguments);
|
|
7521
7513
|
};
|
|
7522
7514
|
log/* default.info */.Z.info("DRM: keystatuseschange event received", session.sessionId);
|
|
7523
|
-
_context2.next =
|
|
7524
|
-
return Promise.all([runOnKeyStatusesChangeCallback(), Promise.resolve(
|
|
7525
|
-
case
|
|
7515
|
+
_context2.next = 5;
|
|
7516
|
+
return Promise.all([runOnKeyStatusesChangeCallback(), Promise.resolve(checkAndHandleCurrentKeyStatuses())]);
|
|
7517
|
+
case 5:
|
|
7526
7518
|
case "end":
|
|
7527
7519
|
return _context2.stop();
|
|
7528
7520
|
}
|
|
@@ -7531,33 +7523,40 @@ function SessionEventsListener(session, keySystemOptions, keySystem, callbacks,
|
|
|
7531
7523
|
}));
|
|
7532
7524
|
return _handleKeyStatusesChangeEvent.apply(this, arguments);
|
|
7533
7525
|
}
|
|
7526
|
+
function checkAndHandleCurrentKeyStatuses() {
|
|
7527
|
+
if (manualCanceller.isUsed() || session.keyStatuses.size === 0) {
|
|
7528
|
+
return;
|
|
7529
|
+
}
|
|
7530
|
+
var _checkKeyStatuses = checkKeyStatuses(session, keySystemOptions, keySystem),
|
|
7531
|
+
warning = _checkKeyStatuses.warning,
|
|
7532
|
+
blacklistedKeyIds = _checkKeyStatuses.blacklistedKeyIds,
|
|
7533
|
+
whitelistedKeyIds = _checkKeyStatuses.whitelistedKeyIds;
|
|
7534
|
+
if (warning !== undefined) {
|
|
7535
|
+
callbacks.onWarning(warning);
|
|
7536
|
+
if (manualCanceller.isUsed()) {
|
|
7537
|
+
return;
|
|
7538
|
+
}
|
|
7539
|
+
}
|
|
7540
|
+
callbacks.onKeyUpdate({
|
|
7541
|
+
whitelistedKeyIds: whitelistedKeyIds,
|
|
7542
|
+
blacklistedKeyIds: blacklistedKeyIds
|
|
7543
|
+
});
|
|
7544
|
+
}
|
|
7534
7545
|
function runGetLicense(message, messageType) {
|
|
7546
|
+
var timeoutId;
|
|
7535
7547
|
return new Promise(function (res, rej) {
|
|
7536
7548
|
log/* default.debug */.Z.debug("DRM: Calling `getLicense`", messageType);
|
|
7537
7549
|
var getLicense = keySystemOptions.getLicense(message, messageType);
|
|
7538
7550
|
var getLicenseTimeout = (0,is_null_or_undefined/* default */.Z)(getLicenseConfig.timeout) ? 10 * 1000 : getLicenseConfig.timeout;
|
|
7539
|
-
var timeoutId;
|
|
7540
7551
|
if (getLicenseTimeout >= 0) {
|
|
7541
7552
|
timeoutId = setTimeout(function () {
|
|
7542
7553
|
rej(new GetLicenseTimeoutError("\"getLicense\" timeout exceeded (" + getLicenseTimeout + " ms)"));
|
|
7543
7554
|
}, getLicenseTimeout);
|
|
7544
7555
|
}
|
|
7545
|
-
|
|
7546
|
-
|
|
7547
|
-
|
|
7548
|
-
|
|
7549
|
-
}, function (err) {
|
|
7550
|
-
clearTimeoutIfOne();
|
|
7551
|
-
rej(err);
|
|
7552
|
-
});
|
|
7553
|
-
} catch (err) {
|
|
7554
|
-
clearTimeoutIfOne();
|
|
7555
|
-
rej(err);
|
|
7556
|
-
}
|
|
7557
|
-
function clearTimeoutIfOne() {
|
|
7558
|
-
if (timeoutId !== undefined) {
|
|
7559
|
-
clearTimeout(timeoutId);
|
|
7560
|
-
}
|
|
7556
|
+
Promise.resolve(getLicense).then(res, rej);
|
|
7557
|
+
})["finally"](function () {
|
|
7558
|
+
if (timeoutId !== undefined) {
|
|
7559
|
+
clearTimeout(timeoutId);
|
|
7561
7560
|
}
|
|
7562
7561
|
});
|
|
7563
7562
|
}
|
|
@@ -8630,7 +8629,7 @@ var ContentDecryptor = /*#__PURE__*/function (_EventEmitter) {
|
|
|
8630
8629
|
* formatted and sent in an "error" event.
|
|
8631
8630
|
*/;
|
|
8632
8631
|
_proto._onFatalError = function _onFatalError(err) {
|
|
8633
|
-
if (this._canceller.isUsed) {
|
|
8632
|
+
if (this._canceller.isUsed()) {
|
|
8634
8633
|
return;
|
|
8635
8634
|
}
|
|
8636
8635
|
var formattedErr = err instanceof Error ? err : new other_error/* default */.Z("NONE", "Unknown decryption error");
|
|
@@ -9270,7 +9269,7 @@ var DirectFileContentInitializer = /*#__PURE__*/function (_ContentInitializer) {
|
|
|
9270
9269
|
clearSignal: cancelSignal
|
|
9271
9270
|
});
|
|
9272
9271
|
})["catch"](function (err) {
|
|
9273
|
-
if (!cancelSignal.isCancelled) {
|
|
9272
|
+
if (!cancelSignal.isCancelled()) {
|
|
9274
9273
|
_this3._onFatalError(err);
|
|
9275
9274
|
}
|
|
9276
9275
|
});
|
|
@@ -9443,9 +9442,8 @@ var task_canceller = __webpack_require__(288);
|
|
|
9443
9442
|
* @returns {Object}
|
|
9444
9443
|
*/
|
|
9445
9444
|
function getLoadedReference(playbackObserver, mediaElement, isDirectfile, cancelSignal) {
|
|
9446
|
-
var listenCanceller = new task_canceller/* default */.ZP(
|
|
9447
|
-
|
|
9448
|
-
});
|
|
9445
|
+
var listenCanceller = new task_canceller/* default */.ZP();
|
|
9446
|
+
listenCanceller.linkToSignal(cancelSignal);
|
|
9449
9447
|
var isLoaded = (0,reference/* default */.ZP)(false, listenCanceller.signal);
|
|
9450
9448
|
playbackObserver.listen(function (observation) {
|
|
9451
9449
|
if (observation.rebuffering !== null || observation.freezing !== null || observation.readyState === 0) {
|
|
@@ -9530,7 +9528,7 @@ function performInitialSeekAndPlay(mediaElement, playbackObserver, startTime, mu
|
|
|
9530
9528
|
if (mediaElement.readyState >= _compat_browser_compatibility_types__WEBPACK_IMPORTED_MODULE_1__/* .READY_STATES.HAVE_METADATA */ .c.HAVE_METADATA) {
|
|
9531
9529
|
onLoadedMetadata();
|
|
9532
9530
|
}
|
|
9533
|
-
cancelSignal.register(function (err) {
|
|
9531
|
+
var deregisterCancellation = cancelSignal.register(function (err) {
|
|
9534
9532
|
mediaElement.removeEventListener("loadedmetadata", onLoadedMetadata);
|
|
9535
9533
|
rejectAutoPlay(err);
|
|
9536
9534
|
});
|
|
@@ -9550,7 +9548,7 @@ function performInitialSeekAndPlay(mediaElement, playbackObserver, startTime, mu
|
|
|
9550
9548
|
var error = new _errors__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z("MEDIA_ERR_NOT_LOADED_METADATA", "Cannot load automatically: your browser " + "falsely announced having loaded the content.");
|
|
9551
9549
|
onWarning(error);
|
|
9552
9550
|
}
|
|
9553
|
-
if (cancelSignal.isCancelled) {
|
|
9551
|
+
if (cancelSignal.isCancelled()) {
|
|
9554
9552
|
return;
|
|
9555
9553
|
}
|
|
9556
9554
|
playbackObserver.listen(function (observation, stopListening) {
|
|
@@ -9572,6 +9570,7 @@ function performInitialSeekAndPlay(mediaElement, playbackObserver, startTime, mu
|
|
|
9572
9570
|
}
|
|
9573
9571
|
initialPlayPerformed.setValue(true);
|
|
9574
9572
|
initialPlayPerformed.finish();
|
|
9573
|
+
deregisterCancellation();
|
|
9575
9574
|
return resolveAutoPlay({
|
|
9576
9575
|
type: "skipped"
|
|
9577
9576
|
});
|
|
@@ -9580,19 +9579,22 @@ function performInitialSeekAndPlay(mediaElement, playbackObserver, startTime, mu
|
|
|
9580
9579
|
try {
|
|
9581
9580
|
playResult = (_a = mediaElement.play()) !== null && _a !== void 0 ? _a : Promise.resolve();
|
|
9582
9581
|
} catch (playError) {
|
|
9582
|
+
deregisterCancellation();
|
|
9583
9583
|
return rejectAutoPlay(playError);
|
|
9584
9584
|
}
|
|
9585
9585
|
playResult.then(function () {
|
|
9586
|
-
if (cancelSignal.isCancelled) {
|
|
9586
|
+
if (cancelSignal.isCancelled()) {
|
|
9587
9587
|
return;
|
|
9588
9588
|
}
|
|
9589
9589
|
initialPlayPerformed.setValue(true);
|
|
9590
9590
|
initialPlayPerformed.finish();
|
|
9591
|
+
deregisterCancellation();
|
|
9591
9592
|
return resolveAutoPlay({
|
|
9592
9593
|
type: "autoplay"
|
|
9593
9594
|
});
|
|
9594
9595
|
})["catch"](function (playError) {
|
|
9595
|
-
|
|
9596
|
+
deregisterCancellation();
|
|
9597
|
+
if (cancelSignal.isCancelled()) {
|
|
9596
9598
|
return;
|
|
9597
9599
|
}
|
|
9598
9600
|
if (playError instanceof Error && playError.name === "NotAllowedError") {
|
|
@@ -9600,7 +9602,7 @@ function performInitialSeekAndPlay(mediaElement, playbackObserver, startTime, mu
|
|
|
9600
9602
|
_log__WEBPACK_IMPORTED_MODULE_2__/* ["default"].warn */ .Z.warn("Init: Media element can't play." + " It may be due to browser auto-play policies.");
|
|
9601
9603
|
var error = new _errors__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z("MEDIA_ERR_BLOCKED_AUTOPLAY", "Cannot trigger auto-play automatically: " + "your browser does not allow it.");
|
|
9602
9604
|
onWarning(error);
|
|
9603
|
-
if (cancelSignal.isCancelled) {
|
|
9605
|
+
if (cancelSignal.isCancelled()) {
|
|
9604
9606
|
return;
|
|
9605
9607
|
}
|
|
9606
9608
|
return resolveAutoPlay({
|
|
@@ -9740,9 +9742,8 @@ function initializeContentDecryption(mediaElement, keySystems, protectionRef, ca
|
|
|
9740
9742
|
_ref.finish(); // We know that no new value will be triggered
|
|
9741
9743
|
return _ref;
|
|
9742
9744
|
}
|
|
9743
|
-
var decryptorCanceller = new task_canceller/* default */.ZP(
|
|
9744
|
-
|
|
9745
|
-
});
|
|
9745
|
+
var decryptorCanceller = new task_canceller/* default */.ZP();
|
|
9746
|
+
decryptorCanceller.linkToSignal(cancelSignal);
|
|
9746
9747
|
var drmStatusRef = (0,reference/* default */.ZP)({
|
|
9747
9748
|
initializationState: {
|
|
9748
9749
|
type: "uninitialized",
|
|
@@ -10356,7 +10357,7 @@ var PlaybackRateUpdater = /*#__PURE__*/function () {
|
|
|
10356
10357
|
* @param {Object} cancelSignal
|
|
10357
10358
|
*/
|
|
10358
10359
|
function listenToMediaError(mediaElement, onError, cancelSignal) {
|
|
10359
|
-
if (cancelSignal.isCancelled) {
|
|
10360
|
+
if (cancelSignal.isCancelled()) {
|
|
10360
10361
|
return;
|
|
10361
10362
|
}
|
|
10362
10363
|
mediaElement.addEventListener("error", onMediaError);
|
|
@@ -11485,9 +11486,8 @@ var HTMLTextSegmentBuffer = /*#__PURE__*/function (_SegmentBuffer) {
|
|
|
11485
11486
|
return cue.resolution !== null;
|
|
11486
11487
|
});
|
|
11487
11488
|
if (proportionalCues.length > 0) {
|
|
11488
|
-
this._sizeUpdateCanceller = new task_canceller/* default */.ZP(
|
|
11489
|
-
|
|
11490
|
-
});
|
|
11489
|
+
this._sizeUpdateCanceller = new task_canceller/* default */.ZP();
|
|
11490
|
+
this._sizeUpdateCanceller.linkToSignal(this._canceller.signal);
|
|
11491
11491
|
var _config$getCurrent = config/* default.getCurrent */.Z.getCurrent(),
|
|
11492
11492
|
TEXT_TRACK_SIZE_CHECKS_INTERVAL = _config$getCurrent.TEXT_TRACK_SIZE_CHECKS_INTERVAL;
|
|
11493
11493
|
// update propertionally-sized elements periodically
|
|
@@ -11519,9 +11519,8 @@ var HTMLTextSegmentBuffer = /*#__PURE__*/function (_SegmentBuffer) {
|
|
|
11519
11519
|
MAXIMUM_HTML_TEXT_TRACK_UPDATE_INTERVAL = _config$getCurrent2.MAXIMUM_HTML_TEXT_TRACK_UPDATE_INTERVAL;
|
|
11520
11520
|
var startAutoRefresh = function startAutoRefresh() {
|
|
11521
11521
|
stopAutoRefresh();
|
|
11522
|
-
autoRefreshCanceller = new task_canceller/* default */.ZP(
|
|
11523
|
-
|
|
11524
|
-
});
|
|
11522
|
+
autoRefreshCanceller = new task_canceller/* default */.ZP();
|
|
11523
|
+
autoRefreshCanceller.linkToSignal(cancellationSignal);
|
|
11525
11524
|
var intervalId = setInterval(function () {
|
|
11526
11525
|
return _this2.refreshSubtitles();
|
|
11527
11526
|
}, MAXIMUM_HTML_TEXT_TRACK_UPDATE_INTERVAL);
|
|
@@ -13805,6 +13804,7 @@ var features = {
|
|
|
13805
13804
|
wasm: null,
|
|
13806
13805
|
js: null
|
|
13807
13806
|
},
|
|
13807
|
+
createDebugElement: null,
|
|
13808
13808
|
directfile: null,
|
|
13809
13809
|
ContentDecryptor: null,
|
|
13810
13810
|
htmlTextTracksBuffer: null,
|
|
@@ -13985,6 +13985,8 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
13985
13985
|
"Z": function() { return /* binding */ Adaptation; }
|
|
13986
13986
|
});
|
|
13987
13987
|
|
|
13988
|
+
// EXTERNAL MODULE: ./src/log.ts + 1 modules
|
|
13989
|
+
var log = __webpack_require__(3887);
|
|
13988
13990
|
// EXTERNAL MODULE: ./src/utils/array_find.ts
|
|
13989
13991
|
var array_find = __webpack_require__(3274);
|
|
13990
13992
|
// EXTERNAL MODULE: ./src/utils/is_null_or_undefined.ts
|
|
@@ -14074,8 +14076,6 @@ function isCodecSupported(mimeType) {
|
|
|
14074
14076
|
}
|
|
14075
14077
|
return true;
|
|
14076
14078
|
}
|
|
14077
|
-
// EXTERNAL MODULE: ./src/log.ts + 1 modules
|
|
14078
|
-
var log = __webpack_require__(3887);
|
|
14079
14079
|
// EXTERNAL MODULE: ./src/utils/are_arrays_of_numbers_equal.ts
|
|
14080
14080
|
var are_arrays_of_numbers_equal = __webpack_require__(4791);
|
|
14081
14081
|
;// CONCATENATED MODULE: ./src/manifest/representation.ts
|
|
@@ -14132,7 +14132,16 @@ var Representation = /*#__PURE__*/function () {
|
|
|
14132
14132
|
}
|
|
14133
14133
|
this.cdnMetadata = args.cdnMetadata;
|
|
14134
14134
|
this.index = args.index;
|
|
14135
|
-
|
|
14135
|
+
if (opts.type === "audio" || opts.type === "video") {
|
|
14136
|
+
var mimeTypeStr = this.getMimeTypeString();
|
|
14137
|
+
var isSupported = isCodecSupported(mimeTypeStr);
|
|
14138
|
+
if (!isSupported) {
|
|
14139
|
+
log/* default.info */.Z.info("Unsupported Representation", mimeTypeStr, this.id, this.bitrate);
|
|
14140
|
+
}
|
|
14141
|
+
this.isSupported = isSupported;
|
|
14142
|
+
} else {
|
|
14143
|
+
this.isSupported = true; // TODO for other types
|
|
14144
|
+
}
|
|
14136
14145
|
}
|
|
14137
14146
|
/**
|
|
14138
14147
|
* Returns "mime-type string" which includes both the mime-type and the codec,
|
|
@@ -14344,6 +14353,7 @@ var Representation = /*#__PURE__*/function () {
|
|
|
14344
14353
|
|
|
14345
14354
|
|
|
14346
14355
|
|
|
14356
|
+
|
|
14347
14357
|
/** List in an array every possible value for the Adaptation's `type` property. */
|
|
14348
14358
|
var SUPPORTED_ADAPTATIONS_TYPE = ["audio", "video", "text", "image"];
|
|
14349
14359
|
/**
|
|
@@ -14421,6 +14431,8 @@ var Adaptation = /*#__PURE__*/function () {
|
|
|
14421
14431
|
if (!isSupported && representation.isSupported) {
|
|
14422
14432
|
isSupported = true;
|
|
14423
14433
|
}
|
|
14434
|
+
} else {
|
|
14435
|
+
log/* default.debug */.Z.debug("Filtering Representation due to representationFilter", this.type, "Adaptation: " + this.id, "Representation: " + representation.id, "(" + representation.bitrate + ")");
|
|
14424
14436
|
}
|
|
14425
14437
|
}
|
|
14426
14438
|
representations.sort(function (a, b) {
|
|
@@ -14489,6 +14501,8 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
14489
14501
|
var inheritsLoose = __webpack_require__(4578);
|
|
14490
14502
|
// EXTERNAL MODULE: ./src/errors/media_error.ts
|
|
14491
14503
|
var media_error = __webpack_require__(3714);
|
|
14504
|
+
// EXTERNAL MODULE: ./src/log.ts + 1 modules
|
|
14505
|
+
var log = __webpack_require__(3887);
|
|
14492
14506
|
// EXTERNAL MODULE: ./src/utils/array_find.ts
|
|
14493
14507
|
var array_find = __webpack_require__(3274);
|
|
14494
14508
|
// EXTERNAL MODULE: ./src/utils/event_emitter.ts
|
|
@@ -14641,8 +14655,6 @@ var Period = /*#__PURE__*/function () {
|
|
|
14641
14655
|
return Period;
|
|
14642
14656
|
}();
|
|
14643
14657
|
|
|
14644
|
-
// EXTERNAL MODULE: ./src/log.ts + 1 modules
|
|
14645
|
-
var log = __webpack_require__(3887);
|
|
14646
14658
|
;// CONCATENATED MODULE: ./src/manifest/representation_index/static.ts
|
|
14647
14659
|
/**
|
|
14648
14660
|
* Copyright 2015 CANAL+ Group
|
|
@@ -15142,6 +15154,7 @@ function manifest_arrayLikeToArray(arr, len) { if (len == null || len > arr.leng
|
|
|
15142
15154
|
|
|
15143
15155
|
|
|
15144
15156
|
|
|
15157
|
+
|
|
15145
15158
|
var generateSupplementaryTrackID = (0,id_generator/* default */.Z)();
|
|
15146
15159
|
var generateNewManifestId = (0,id_generator/* default */.Z)();
|
|
15147
15160
|
/**
|
|
@@ -15588,6 +15601,7 @@ function updateDeciperability(manifest, isDecipherable) {
|
|
|
15588
15601
|
adaptation: adaptation,
|
|
15589
15602
|
representation: representation
|
|
15590
15603
|
});
|
|
15604
|
+
log/* default.debug */.Z.debug("Decipherability changed for \"" + representation.id + "\"", "(" + representation.bitrate + ")", String(representation.decipherable));
|
|
15591
15605
|
representation.decipherable = result;
|
|
15592
15606
|
}
|
|
15593
15607
|
}
|
|
@@ -19941,12 +19955,11 @@ function combineInbandEventStreams(representation, adaptation) {
|
|
|
19941
19955
|
*/
|
|
19942
19956
|
function getHDRInformation(_ref) {
|
|
19943
19957
|
var adaptationProfiles = _ref.adaptationProfiles,
|
|
19958
|
+
essentialProperties = _ref.essentialProperties,
|
|
19959
|
+
supplementalProperties = _ref.supplementalProperties,
|
|
19944
19960
|
manifestProfiles = _ref.manifestProfiles,
|
|
19945
19961
|
codecs = _ref.codecs;
|
|
19946
19962
|
var profiles = (adaptationProfiles !== null && adaptationProfiles !== void 0 ? adaptationProfiles : "") + (manifestProfiles !== null && manifestProfiles !== void 0 ? manifestProfiles : "");
|
|
19947
|
-
if (codecs === undefined) {
|
|
19948
|
-
return undefined;
|
|
19949
|
-
}
|
|
19950
19963
|
if (profiles.indexOf("http://dashif.org/guidelines/dash-if-uhd#hevc-hdr-pq10") !== -1) {
|
|
19951
19964
|
if (codecs === "hvc1.2.4.L153.B0" || codecs === "hev1.2.4.L153.B0") {
|
|
19952
19965
|
return {
|
|
@@ -19956,7 +19969,25 @@ function getHDRInformation(_ref) {
|
|
|
19956
19969
|
};
|
|
19957
19970
|
}
|
|
19958
19971
|
}
|
|
19959
|
-
|
|
19972
|
+
var transferCharacteristicScheme = (0,array_find/* default */.Z)([].concat(essentialProperties !== null && essentialProperties !== void 0 ? essentialProperties : [], supplementalProperties !== null && supplementalProperties !== void 0 ? supplementalProperties : []), function (p) {
|
|
19973
|
+
return p.schemeIdUri === "urn:mpeg:mpegB:cicp:TransferCharacteristics";
|
|
19974
|
+
});
|
|
19975
|
+
if (transferCharacteristicScheme !== undefined) {
|
|
19976
|
+
switch (transferCharacteristicScheme.value) {
|
|
19977
|
+
case "15":
|
|
19978
|
+
return undefined;
|
|
19979
|
+
// SDR
|
|
19980
|
+
case "16":
|
|
19981
|
+
return {
|
|
19982
|
+
eotf: "pq"
|
|
19983
|
+
};
|
|
19984
|
+
case "18":
|
|
19985
|
+
return {
|
|
19986
|
+
eotf: "hlg"
|
|
19987
|
+
};
|
|
19988
|
+
}
|
|
19989
|
+
}
|
|
19990
|
+
if (codecs !== undefined && /^vp(08|09|10)/.exec(codecs)) {
|
|
19960
19991
|
return getWEBMHDRInformation(codecs);
|
|
19961
19992
|
}
|
|
19962
19993
|
}
|
|
@@ -20110,6 +20141,8 @@ function parseRepresentations(representationsIR, adaptation, context) {
|
|
|
20110
20141
|
}
|
|
20111
20142
|
parsedRepresentation.hdrInfo = getHDRInformation({
|
|
20112
20143
|
adaptationProfiles: adaptation.attributes.profiles,
|
|
20144
|
+
supplementalProperties: adaptation.children.supplementalProperties,
|
|
20145
|
+
essentialProperties: adaptation.children.essentialProperties,
|
|
20113
20146
|
manifestProfiles: context.manifestProfiles,
|
|
20114
20147
|
codecs: codecs
|
|
20115
20148
|
});
|
|
@@ -20285,7 +20318,7 @@ function getAdaptationSetSwitchingIDs(adaptation) {
|
|
|
20285
20318
|
* @returns {Array.<Object>}
|
|
20286
20319
|
*/
|
|
20287
20320
|
function parseAdaptationSets(adaptationsIR, context) {
|
|
20288
|
-
var _a, _b, _c, _d, _e, _f
|
|
20321
|
+
var _a, _b, _c, _d, _e, _f;
|
|
20289
20322
|
var parsedAdaptations = {
|
|
20290
20323
|
video: [],
|
|
20291
20324
|
audio: [],
|
|
@@ -20295,14 +20328,6 @@ function parseAdaptationSets(adaptationsIR, context) {
|
|
|
20295
20328
|
var trickModeAdaptations = [];
|
|
20296
20329
|
var adaptationSwitchingInfos = {};
|
|
20297
20330
|
var parsedAdaptationsIDs = [];
|
|
20298
|
-
/**
|
|
20299
|
-
* Index of the last parsed Video AdaptationSet with a Role set as "main" in
|
|
20300
|
-
* `parsedAdaptations.video`.
|
|
20301
|
-
* `-1` if not yet encountered.
|
|
20302
|
-
* Used as we merge all main video AdaptationSet due to a comprehension of the
|
|
20303
|
-
* DASH-IF IOP.
|
|
20304
|
-
*/
|
|
20305
|
-
var lastMainVideoAdapIdx = -1;
|
|
20306
20331
|
for (var adaptationIdx = 0; adaptationIdx < adaptationsIR.length; adaptationIdx++) {
|
|
20307
20332
|
var adaptation = adaptationsIR[adaptationIdx];
|
|
20308
20333
|
var adaptationChildren = adaptation.children;
|
|
@@ -20325,7 +20350,6 @@ function parseAdaptationSets(adaptationsIR, context) {
|
|
|
20325
20350
|
}
|
|
20326
20351
|
var priority = (_c = adaptation.attributes.selectionPriority) !== null && _c !== void 0 ? _c : 1;
|
|
20327
20352
|
var originalID = adaptation.attributes.id;
|
|
20328
|
-
var newID = void 0;
|
|
20329
20353
|
var adaptationSetSwitchingIDs = getAdaptationSetSwitchingIDs(adaptation);
|
|
20330
20354
|
var parentSegmentTemplates = [];
|
|
20331
20355
|
if (context.segmentTemplate !== undefined) {
|
|
@@ -20355,133 +20379,118 @@ function parseAdaptationSets(adaptationsIR, context) {
|
|
|
20355
20379
|
}) : undefined;
|
|
20356
20380
|
var trickModeAttachedAdaptationIds = (_d = trickModeProperty === null || trickModeProperty === void 0 ? void 0 : trickModeProperty.value) === null || _d === void 0 ? void 0 : _d.split(" ");
|
|
20357
20381
|
var isTrickModeTrack = trickModeAttachedAdaptationIds !== undefined;
|
|
20358
|
-
|
|
20359
|
-
|
|
20360
|
-
|
|
20361
|
-
|
|
20362
|
-
|
|
20363
|
-
|
|
20364
|
-
|
|
20382
|
+
var _adaptationChildren = adaptationChildren,
|
|
20383
|
+
accessibilities = _adaptationChildren.accessibilities;
|
|
20384
|
+
var isDub = void 0;
|
|
20385
|
+
if (roles !== undefined && roles.some(function (role) {
|
|
20386
|
+
return role.value === "dub";
|
|
20387
|
+
})) {
|
|
20388
|
+
isDub = true;
|
|
20389
|
+
}
|
|
20390
|
+
var isClosedCaption = void 0;
|
|
20391
|
+
if (type !== "text") {
|
|
20392
|
+
isClosedCaption = false;
|
|
20365
20393
|
} else {
|
|
20366
|
-
|
|
20367
|
-
|
|
20368
|
-
|
|
20369
|
-
|
|
20370
|
-
|
|
20371
|
-
|
|
20372
|
-
|
|
20373
|
-
|
|
20374
|
-
|
|
20375
|
-
|
|
20376
|
-
|
|
20377
|
-
|
|
20378
|
-
|
|
20379
|
-
|
|
20380
|
-
|
|
20381
|
-
|
|
20382
|
-
|
|
20383
|
-
|
|
20384
|
-
|
|
20385
|
-
|
|
20386
|
-
|
|
20387
|
-
|
|
20388
|
-
|
|
20389
|
-
|
|
20390
|
-
|
|
20391
|
-
|
|
20392
|
-
|
|
20393
|
-
|
|
20394
|
-
|
|
20395
|
-
|
|
20396
|
-
|
|
20397
|
-
|
|
20398
|
-
|
|
20399
|
-
|
|
20400
|
-
|
|
20401
|
-
|
|
20402
|
-
|
|
20403
|
-
|
|
20404
|
-
|
|
20394
|
+
isClosedCaption = isCaptionning(accessibilities, roles);
|
|
20395
|
+
}
|
|
20396
|
+
var isForcedSubtitle = void 0;
|
|
20397
|
+
if (type === "text" && roles !== undefined && roles.some(function (role) {
|
|
20398
|
+
return role.value === "forced-subtitle" || role.value === "forced_subtitle";
|
|
20399
|
+
})) {
|
|
20400
|
+
isForcedSubtitle = true;
|
|
20401
|
+
}
|
|
20402
|
+
var isAudioDescription = void 0;
|
|
20403
|
+
if (type !== "audio") {
|
|
20404
|
+
isAudioDescription = false;
|
|
20405
|
+
} else if (accessibilities !== undefined) {
|
|
20406
|
+
isAudioDescription = accessibilities.some(isVisuallyImpaired);
|
|
20407
|
+
}
|
|
20408
|
+
var isSignInterpreted = void 0;
|
|
20409
|
+
if (type !== "video") {
|
|
20410
|
+
isSignInterpreted = false;
|
|
20411
|
+
} else if (accessibilities !== undefined) {
|
|
20412
|
+
isSignInterpreted = accessibilities.some(hasSignLanguageInterpretation);
|
|
20413
|
+
}
|
|
20414
|
+
var adaptationID = getAdaptationID(adaptation, {
|
|
20415
|
+
isAudioDescription: isAudioDescription,
|
|
20416
|
+
isForcedSubtitle: isForcedSubtitle,
|
|
20417
|
+
isClosedCaption: isClosedCaption,
|
|
20418
|
+
isSignInterpreted: isSignInterpreted,
|
|
20419
|
+
isTrickModeTrack: isTrickModeTrack,
|
|
20420
|
+
type: type
|
|
20421
|
+
});
|
|
20422
|
+
// Avoid duplicate IDs
|
|
20423
|
+
while ((0,array_includes/* default */.Z)(parsedAdaptationsIDs, adaptationID)) {
|
|
20424
|
+
adaptationID += "-dup";
|
|
20425
|
+
}
|
|
20426
|
+
var newID = adaptationID;
|
|
20427
|
+
parsedAdaptationsIDs.push(adaptationID);
|
|
20428
|
+
reprCtxt.unsafelyBaseOnPreviousAdaptation = (_f = (_e = context.unsafelyBaseOnPreviousPeriod) === null || _e === void 0 ? void 0 : _e.getAdaptation(adaptationID)) !== null && _f !== void 0 ? _f : null;
|
|
20429
|
+
var representations = parseRepresentations(representationsIR, adaptation, reprCtxt);
|
|
20430
|
+
var parsedAdaptationSet = {
|
|
20431
|
+
id: adaptationID,
|
|
20432
|
+
representations: representations,
|
|
20433
|
+
type: type,
|
|
20434
|
+
isTrickModeTrack: isTrickModeTrack
|
|
20435
|
+
};
|
|
20436
|
+
if (adaptation.attributes.language != null) {
|
|
20437
|
+
parsedAdaptationSet.language = adaptation.attributes.language;
|
|
20438
|
+
}
|
|
20439
|
+
if (isClosedCaption != null) {
|
|
20440
|
+
parsedAdaptationSet.closedCaption = isClosedCaption;
|
|
20441
|
+
}
|
|
20442
|
+
if (isAudioDescription != null) {
|
|
20443
|
+
parsedAdaptationSet.audioDescription = isAudioDescription;
|
|
20444
|
+
}
|
|
20445
|
+
if (isDub === true) {
|
|
20446
|
+
parsedAdaptationSet.isDub = true;
|
|
20447
|
+
}
|
|
20448
|
+
if (isForcedSubtitle !== undefined) {
|
|
20449
|
+
parsedAdaptationSet.forcedSubtitles = isForcedSubtitle;
|
|
20450
|
+
}
|
|
20451
|
+
if (isSignInterpreted === true) {
|
|
20452
|
+
parsedAdaptationSet.isSignInterpreted = true;
|
|
20453
|
+
}
|
|
20454
|
+
if (label !== undefined) {
|
|
20455
|
+
parsedAdaptationSet.label = label;
|
|
20456
|
+
}
|
|
20457
|
+
if (trickModeAttachedAdaptationIds !== undefined) {
|
|
20458
|
+
trickModeAdaptations.push({
|
|
20459
|
+
adaptation: parsedAdaptationSet,
|
|
20460
|
+
trickModeAttachedAdaptationIds: trickModeAttachedAdaptationIds
|
|
20405
20461
|
});
|
|
20406
|
-
|
|
20407
|
-
|
|
20408
|
-
|
|
20409
|
-
|
|
20410
|
-
|
|
20411
|
-
|
|
20412
|
-
|
|
20413
|
-
|
|
20414
|
-
|
|
20415
|
-
|
|
20416
|
-
|
|
20417
|
-
|
|
20418
|
-
|
|
20419
|
-
|
|
20420
|
-
|
|
20421
|
-
|
|
20422
|
-
|
|
20423
|
-
|
|
20424
|
-
|
|
20425
|
-
|
|
20426
|
-
if (isAudioDescription != null) {
|
|
20427
|
-
parsedAdaptationSet.audioDescription = isAudioDescription;
|
|
20428
|
-
}
|
|
20429
|
-
if (isDub === true) {
|
|
20430
|
-
parsedAdaptationSet.isDub = true;
|
|
20431
|
-
}
|
|
20432
|
-
if (isForcedSubtitle !== undefined) {
|
|
20433
|
-
parsedAdaptationSet.forcedSubtitles = isForcedSubtitle;
|
|
20434
|
-
}
|
|
20435
|
-
if (isSignInterpreted === true) {
|
|
20436
|
-
parsedAdaptationSet.isSignInterpreted = true;
|
|
20437
|
-
}
|
|
20438
|
-
if (label !== undefined) {
|
|
20439
|
-
parsedAdaptationSet.label = label;
|
|
20440
|
-
}
|
|
20441
|
-
if (trickModeAttachedAdaptationIds !== undefined) {
|
|
20442
|
-
trickModeAdaptations.push({
|
|
20443
|
-
adaptation: parsedAdaptationSet,
|
|
20444
|
-
trickModeAttachedAdaptationIds: trickModeAttachedAdaptationIds
|
|
20445
|
-
});
|
|
20446
|
-
} else {
|
|
20447
|
-
// look if we have to merge this into another Adaptation
|
|
20448
|
-
var mergedIntoIdx = -1;
|
|
20449
|
-
var _loop = function _loop() {
|
|
20450
|
-
var id = _step2.value;
|
|
20451
|
-
var switchingInfos = adaptationSwitchingInfos[id];
|
|
20452
|
-
if (switchingInfos !== undefined && switchingInfos.newID !== newID && (0,array_includes/* default */.Z)(switchingInfos.adaptationSetSwitchingIDs, originalID)) {
|
|
20453
|
-
mergedIntoIdx = (0,array_find_index/* default */.Z)(parsedAdaptations[type], function (a) {
|
|
20454
|
-
return a[0].id === id;
|
|
20455
|
-
});
|
|
20456
|
-
var mergedInto = parsedAdaptations[type][mergedIntoIdx];
|
|
20457
|
-
if (mergedInto !== undefined && mergedInto[0].audioDescription === parsedAdaptationSet.audioDescription && mergedInto[0].closedCaption === parsedAdaptationSet.closedCaption && mergedInto[0].language === parsedAdaptationSet.language) {
|
|
20458
|
-
var _mergedInto$0$represe;
|
|
20459
|
-
log/* default.info */.Z.info("DASH Parser: merging \"switchable\" AdaptationSets", originalID, id);
|
|
20460
|
-
(_mergedInto$0$represe = mergedInto[0].representations).push.apply(_mergedInto$0$represe, parsedAdaptationSet.representations);
|
|
20461
|
-
if (type === "video" && isMainAdaptation && !mergedInto[1].isMainAdaptation) {
|
|
20462
|
-
lastMainVideoAdapIdx = Math.max(lastMainVideoAdapIdx, mergedIntoIdx);
|
|
20463
|
-
}
|
|
20464
|
-
mergedInto[1] = {
|
|
20465
|
-
priority: Math.max(priority, mergedInto[1].priority),
|
|
20466
|
-
isMainAdaptation: isMainAdaptation || mergedInto[1].isMainAdaptation,
|
|
20467
|
-
indexInMpd: Math.min(adaptationIdx, mergedInto[1].indexInMpd)
|
|
20468
|
-
};
|
|
20469
|
-
}
|
|
20470
|
-
}
|
|
20471
|
-
};
|
|
20472
|
-
for (var _iterator2 = parse_adaptation_sets_createForOfIteratorHelperLoose(adaptationSetSwitchingIDs), _step2; !(_step2 = _iterator2()).done;) {
|
|
20473
|
-
_loop();
|
|
20474
|
-
}
|
|
20475
|
-
if (mergedIntoIdx < 0) {
|
|
20476
|
-
parsedAdaptations[type].push([parsedAdaptationSet, {
|
|
20477
|
-
priority: priority,
|
|
20478
|
-
isMainAdaptation: isMainAdaptation,
|
|
20479
|
-
indexInMpd: adaptationIdx
|
|
20480
|
-
}]);
|
|
20481
|
-
if (type === "video" && isMainAdaptation) {
|
|
20482
|
-
lastMainVideoAdapIdx = parsedAdaptations.video.length - 1;
|
|
20462
|
+
} else {
|
|
20463
|
+
// look if we have to merge this into another Adaptation
|
|
20464
|
+
var mergedIntoIdx = -1;
|
|
20465
|
+
var _loop = function _loop() {
|
|
20466
|
+
var id = _step2.value;
|
|
20467
|
+
var switchingInfos = adaptationSwitchingInfos[id];
|
|
20468
|
+
if (switchingInfos !== undefined && switchingInfos.newID !== newID && (0,array_includes/* default */.Z)(switchingInfos.adaptationSetSwitchingIDs, originalID)) {
|
|
20469
|
+
mergedIntoIdx = (0,array_find_index/* default */.Z)(parsedAdaptations[type], function (a) {
|
|
20470
|
+
return a[0].id === id;
|
|
20471
|
+
});
|
|
20472
|
+
var mergedInto = parsedAdaptations[type][mergedIntoIdx];
|
|
20473
|
+
if (mergedInto !== undefined && mergedInto[0].audioDescription === parsedAdaptationSet.audioDescription && mergedInto[0].closedCaption === parsedAdaptationSet.closedCaption && mergedInto[0].language === parsedAdaptationSet.language) {
|
|
20474
|
+
var _mergedInto$0$represe;
|
|
20475
|
+
log/* default.info */.Z.info("DASH Parser: merging \"switchable\" AdaptationSets", originalID, id);
|
|
20476
|
+
(_mergedInto$0$represe = mergedInto[0].representations).push.apply(_mergedInto$0$represe, parsedAdaptationSet.representations);
|
|
20477
|
+
mergedInto[1] = {
|
|
20478
|
+
priority: Math.max(priority, mergedInto[1].priority),
|
|
20479
|
+
isMainAdaptation: isMainAdaptation || mergedInto[1].isMainAdaptation,
|
|
20480
|
+
indexInMpd: Math.min(adaptationIdx, mergedInto[1].indexInMpd)
|
|
20481
|
+
};
|
|
20483
20482
|
}
|
|
20484
20483
|
}
|
|
20484
|
+
};
|
|
20485
|
+
for (var _iterator2 = parse_adaptation_sets_createForOfIteratorHelperLoose(adaptationSetSwitchingIDs), _step2; !(_step2 = _iterator2()).done;) {
|
|
20486
|
+
_loop();
|
|
20487
|
+
}
|
|
20488
|
+
if (mergedIntoIdx < 0) {
|
|
20489
|
+
parsedAdaptations[type].push([parsedAdaptationSet, {
|
|
20490
|
+
priority: priority,
|
|
20491
|
+
isMainAdaptation: isMainAdaptation,
|
|
20492
|
+
indexInMpd: adaptationIdx
|
|
20493
|
+
}]);
|
|
20485
20494
|
}
|
|
20486
20495
|
}
|
|
20487
20496
|
if (originalID != null && adaptationSwitchingInfos[originalID] == null) {
|
|
@@ -27958,7 +27967,7 @@ function generateManifestParser(options) {
|
|
|
27958
27967
|
if (parserResponse.value.warnings.length > 0) {
|
|
27959
27968
|
onWarnings(parserResponse.value.warnings);
|
|
27960
27969
|
}
|
|
27961
|
-
if (cancelSignal.isCancelled) {
|
|
27970
|
+
if (cancelSignal.isCancelled()) {
|
|
27962
27971
|
return Promise.reject(cancelSignal.cancellationError);
|
|
27963
27972
|
}
|
|
27964
27973
|
var manifest = new src_manifest/* default */.ZP(parserResponse.value.parsed, options);
|
|
@@ -28387,12 +28396,9 @@ var check_isobmff_integrity = __webpack_require__(4460);
|
|
|
28387
28396
|
function addSegmentIntegrityChecks(segmentLoader) {
|
|
28388
28397
|
return function (url, content, loaderOptions, initialCancelSignal, callbacks) {
|
|
28389
28398
|
return new Promise(function (resolve, reject) {
|
|
28390
|
-
var requestCanceller = new task_canceller/* default */.ZP(
|
|
28391
|
-
|
|
28392
|
-
|
|
28393
|
-
// Reject the `CancellationError` when `requestCanceller`'s signal emits
|
|
28394
|
-
// `stopRejectingOnCancel` here is a function allowing to stop this mechanism
|
|
28395
|
-
var stopRejectingOnCancel = requestCanceller.signal.register(reject);
|
|
28399
|
+
var requestCanceller = new task_canceller/* default */.ZP();
|
|
28400
|
+
var unlinkCanceller = requestCanceller.linkToSignal(initialCancelSignal);
|
|
28401
|
+
requestCanceller.signal.register(reject);
|
|
28396
28402
|
segmentLoader(url, content, loaderOptions, requestCanceller.signal, Object.assign(Object.assign({}, callbacks), {
|
|
28397
28403
|
onNewChunk: function onNewChunk(data) {
|
|
28398
28404
|
try {
|
|
@@ -28400,18 +28406,19 @@ function addSegmentIntegrityChecks(segmentLoader) {
|
|
|
28400
28406
|
callbacks.onNewChunk(data);
|
|
28401
28407
|
} catch (err) {
|
|
28402
28408
|
// Do not reject with a `CancellationError` after cancelling the request
|
|
28403
|
-
|
|
28409
|
+
cleanUpCancellers();
|
|
28404
28410
|
// Cancel the request
|
|
28405
28411
|
requestCanceller.cancel();
|
|
28406
28412
|
// Reject with thrown error
|
|
28407
28413
|
reject(err);
|
|
28408
28414
|
}
|
|
28409
28415
|
}
|
|
28410
|
-
}))
|
|
28411
|
-
|
|
28416
|
+
}))["finally"](function () {
|
|
28417
|
+
return cleanUpCancellers();
|
|
28418
|
+
}).then(function (info) {
|
|
28419
|
+
if (requestCanceller.isUsed()) {
|
|
28412
28420
|
return;
|
|
28413
28421
|
}
|
|
28414
|
-
stopRejectingOnCancel();
|
|
28415
28422
|
if (info.resultType === "segment-loaded") {
|
|
28416
28423
|
try {
|
|
28417
28424
|
trowOnIntegrityError(info.resultData.responseData);
|
|
@@ -28421,10 +28428,11 @@ function addSegmentIntegrityChecks(segmentLoader) {
|
|
|
28421
28428
|
}
|
|
28422
28429
|
}
|
|
28423
28430
|
resolve(info);
|
|
28424
|
-
},
|
|
28425
|
-
|
|
28426
|
-
reject
|
|
28427
|
-
|
|
28431
|
+
}, reject);
|
|
28432
|
+
function cleanUpCancellers() {
|
|
28433
|
+
requestCanceller.signal.deregister(reject);
|
|
28434
|
+
unlinkCanceller();
|
|
28435
|
+
}
|
|
28428
28436
|
});
|
|
28429
28437
|
/**
|
|
28430
28438
|
* If the data's seems to be corrupted, throws an `INTEGRITY_ERROR` error.
|
|
@@ -28669,7 +28677,7 @@ function lowLatencySegmentLoader(url, content, options, callbacks, cancelSignal)
|
|
|
28669
28677
|
partialChunk = res[1];
|
|
28670
28678
|
for (var i = 0; i < completeChunks.length; i++) {
|
|
28671
28679
|
callbacks.onNewChunk(completeChunks[i]);
|
|
28672
|
-
if (cancelSignal.isCancelled) {
|
|
28680
|
+
if (cancelSignal.isCancelled()) {
|
|
28673
28681
|
return;
|
|
28674
28682
|
}
|
|
28675
28683
|
}
|
|
@@ -28678,7 +28686,7 @@ function lowLatencySegmentLoader(url, content, options, callbacks, cancelSignal)
|
|
|
28678
28686
|
size: info.size,
|
|
28679
28687
|
totalSize: info.totalSize
|
|
28680
28688
|
});
|
|
28681
|
-
if (cancelSignal.isCancelled) {
|
|
28689
|
+
if (cancelSignal.isCancelled()) {
|
|
28682
28690
|
return;
|
|
28683
28691
|
}
|
|
28684
28692
|
}
|
|
@@ -28801,7 +28809,7 @@ function generateSegmentLoader(_ref) {
|
|
|
28801
28809
|
* @param {Object} _args
|
|
28802
28810
|
*/
|
|
28803
28811
|
var resolve = function resolve(_args) {
|
|
28804
|
-
if (hasFinished || cancelSignal.isCancelled) {
|
|
28812
|
+
if (hasFinished || cancelSignal.isCancelled()) {
|
|
28805
28813
|
return;
|
|
28806
28814
|
}
|
|
28807
28815
|
hasFinished = true;
|
|
@@ -28821,7 +28829,7 @@ function generateSegmentLoader(_ref) {
|
|
|
28821
28829
|
*/
|
|
28822
28830
|
var reject = function reject(err) {
|
|
28823
28831
|
var _a, _b, _c;
|
|
28824
|
-
if (hasFinished || cancelSignal.isCancelled) {
|
|
28832
|
+
if (hasFinished || cancelSignal.isCancelled()) {
|
|
28825
28833
|
return;
|
|
28826
28834
|
}
|
|
28827
28835
|
hasFinished = true;
|
|
@@ -28833,7 +28841,7 @@ function generateSegmentLoader(_ref) {
|
|
|
28833
28841
|
rej(emittedErr);
|
|
28834
28842
|
};
|
|
28835
28843
|
var progress = function progress(_args) {
|
|
28836
|
-
if (hasFinished || cancelSignal.isCancelled) {
|
|
28844
|
+
if (hasFinished || cancelSignal.isCancelled()) {
|
|
28837
28845
|
return;
|
|
28838
28846
|
}
|
|
28839
28847
|
callbacks.onProgress({
|
|
@@ -28847,7 +28855,7 @@ function generateSegmentLoader(_ref) {
|
|
|
28847
28855
|
* the "regular" implementation
|
|
28848
28856
|
*/
|
|
28849
28857
|
var fallback = function fallback() {
|
|
28850
|
-
if (hasFinished || cancelSignal.isCancelled) {
|
|
28858
|
+
if (hasFinished || cancelSignal.isCancelled()) {
|
|
28851
28859
|
return;
|
|
28852
28860
|
}
|
|
28853
28861
|
hasFinished = true;
|
|
@@ -32700,7 +32708,7 @@ var generateSegmentLoader = function generateSegmentLoader(_ref) {
|
|
|
32700
32708
|
* @param {Object} args
|
|
32701
32709
|
*/
|
|
32702
32710
|
var resolve = function resolve(_args) {
|
|
32703
|
-
if (hasFinished || cancelSignal.isCancelled) {
|
|
32711
|
+
if (hasFinished || cancelSignal.isCancelled()) {
|
|
32704
32712
|
return;
|
|
32705
32713
|
}
|
|
32706
32714
|
hasFinished = true;
|
|
@@ -32733,7 +32741,7 @@ var generateSegmentLoader = function generateSegmentLoader(_ref) {
|
|
|
32733
32741
|
*/
|
|
32734
32742
|
var reject = function reject(err) {
|
|
32735
32743
|
var _a, _b, _c;
|
|
32736
|
-
if (hasFinished || cancelSignal.isCancelled) {
|
|
32744
|
+
if (hasFinished || cancelSignal.isCancelled()) {
|
|
32737
32745
|
return;
|
|
32738
32746
|
}
|
|
32739
32747
|
hasFinished = true;
|
|
@@ -32745,7 +32753,7 @@ var generateSegmentLoader = function generateSegmentLoader(_ref) {
|
|
|
32745
32753
|
rej(emittedErr);
|
|
32746
32754
|
};
|
|
32747
32755
|
var progress = function progress(_args) {
|
|
32748
|
-
if (hasFinished || cancelSignal.isCancelled) {
|
|
32756
|
+
if (hasFinished || cancelSignal.isCancelled()) {
|
|
32749
32757
|
return;
|
|
32750
32758
|
}
|
|
32751
32759
|
callbacks.onProgress({
|
|
@@ -32755,7 +32763,7 @@ var generateSegmentLoader = function generateSegmentLoader(_ref) {
|
|
|
32755
32763
|
});
|
|
32756
32764
|
};
|
|
32757
32765
|
var fallback = function fallback() {
|
|
32758
|
-
if (hasFinished || cancelSignal.isCancelled) {
|
|
32766
|
+
if (hasFinished || cancelSignal.isCancelled()) {
|
|
32759
32767
|
return;
|
|
32760
32768
|
}
|
|
32761
32769
|
hasFinished = true;
|
|
@@ -33478,7 +33486,7 @@ function callCustomManifestLoader(customManifestLoader, fallbackManifestLoader)
|
|
|
33478
33486
|
* @param {Object} args
|
|
33479
33487
|
*/
|
|
33480
33488
|
var resolve = function resolve(_args) {
|
|
33481
|
-
if (hasFinished || cancelSignal.isCancelled) {
|
|
33489
|
+
if (hasFinished || cancelSignal.isCancelled()) {
|
|
33482
33490
|
return;
|
|
33483
33491
|
}
|
|
33484
33492
|
hasFinished = true;
|
|
@@ -33500,7 +33508,7 @@ function callCustomManifestLoader(customManifestLoader, fallbackManifestLoader)
|
|
|
33500
33508
|
*/
|
|
33501
33509
|
var reject = function reject(err) {
|
|
33502
33510
|
var _a, _b, _c;
|
|
33503
|
-
if (hasFinished || cancelSignal.isCancelled) {
|
|
33511
|
+
if (hasFinished || cancelSignal.isCancelled()) {
|
|
33504
33512
|
return;
|
|
33505
33513
|
}
|
|
33506
33514
|
hasFinished = true;
|
|
@@ -33516,7 +33524,7 @@ function callCustomManifestLoader(customManifestLoader, fallbackManifestLoader)
|
|
|
33516
33524
|
* the "regular" implementation
|
|
33517
33525
|
*/
|
|
33518
33526
|
var fallback = function fallback() {
|
|
33519
|
-
if (hasFinished || cancelSignal.isCancelled) {
|
|
33527
|
+
if (hasFinished || cancelSignal.isCancelled()) {
|
|
33520
33528
|
return;
|
|
33521
33529
|
}
|
|
33522
33530
|
hasFinished = true;
|
|
@@ -34368,6 +34376,7 @@ function toUint8Array(input) {
|
|
|
34368
34376
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
34369
34377
|
/* harmony export */ "Z": function() { return /* binding */ cancellableSleep; }
|
|
34370
34378
|
/* harmony export */ });
|
|
34379
|
+
/* harmony import */ var _create_cancellable_promise__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7733);
|
|
34371
34380
|
/**
|
|
34372
34381
|
* Copyright 2015 CANAL+ Group
|
|
34373
34382
|
*
|
|
@@ -34383,6 +34392,7 @@ function toUint8Array(input) {
|
|
|
34383
34392
|
* See the License for the specific language governing permissions and
|
|
34384
34393
|
* limitations under the License.
|
|
34385
34394
|
*/
|
|
34395
|
+
|
|
34386
34396
|
/**
|
|
34387
34397
|
* Wait the given `delay`, resolving the Promise when finished.
|
|
34388
34398
|
*
|
|
@@ -34397,15 +34407,75 @@ function toUint8Array(input) {
|
|
|
34397
34407
|
* cancellation with the corresponding `CancellationError`.
|
|
34398
34408
|
*/
|
|
34399
34409
|
function cancellableSleep(delay, cancellationSignal) {
|
|
34400
|
-
return
|
|
34410
|
+
return (0,_create_cancellable_promise__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)(cancellationSignal, function (res) {
|
|
34401
34411
|
var timeout = setTimeout(function () {
|
|
34402
|
-
|
|
34403
|
-
res();
|
|
34412
|
+
return res();
|
|
34404
34413
|
}, delay);
|
|
34405
|
-
|
|
34406
|
-
clearTimeout(timeout);
|
|
34407
|
-
|
|
34414
|
+
return function () {
|
|
34415
|
+
return clearTimeout(timeout);
|
|
34416
|
+
};
|
|
34417
|
+
});
|
|
34418
|
+
}
|
|
34419
|
+
|
|
34420
|
+
/***/ }),
|
|
34421
|
+
|
|
34422
|
+
/***/ 7733:
|
|
34423
|
+
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
34424
|
+
|
|
34425
|
+
"use strict";
|
|
34426
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
34427
|
+
/* harmony export */ "Z": function() { return /* binding */ createCancellablePromise; }
|
|
34428
|
+
/* harmony export */ });
|
|
34429
|
+
/**
|
|
34430
|
+
* Returns a Promise linked to a `CancellationSignal`, which will reject the
|
|
34431
|
+
* corresponding `CancellationError` if that signal emits before the wanted
|
|
34432
|
+
* task finishes (either on success or on error).
|
|
34433
|
+
*
|
|
34434
|
+
* The given callback mimicks the Promise interface with the added possibility
|
|
34435
|
+
* of returning a callback which will be called when and if the task is
|
|
34436
|
+
* cancelled before being either resolved or rejected.
|
|
34437
|
+
* In that case, that logic will be called just before the Promise is rejected
|
|
34438
|
+
* with the corresponding `CancellationError`.
|
|
34439
|
+
* The point of this callback is to implement aborting logic, such as for
|
|
34440
|
+
* example aborting a request.
|
|
34441
|
+
*
|
|
34442
|
+
* @param {Object} cancellationSignal - The `CancellationSignal` the returned
|
|
34443
|
+
* Promise will be linked to.
|
|
34444
|
+
* @param {Function} cb - The function implementing the cancellable Promise. Its
|
|
34445
|
+
* arguments follow Promise's semantics but it can also return a function which
|
|
34446
|
+
* will be called when and if `cancellationSignal` emits before either arguments
|
|
34447
|
+
* are called.
|
|
34448
|
+
* @returns {Promise} - The created Promise, which will resolve when and if the
|
|
34449
|
+
* first argument to `cb` is called first and reject either if the second
|
|
34450
|
+
* argument to `cb` is called first or if the given `CancellationSignal` emits
|
|
34451
|
+
* before either of the two previous conditions.
|
|
34452
|
+
*/
|
|
34453
|
+
function createCancellablePromise(cancellationSignal, cb) {
|
|
34454
|
+
var abortingLogic;
|
|
34455
|
+
return new Promise(function (res, rej) {
|
|
34456
|
+
if (cancellationSignal.cancellationError !== null) {
|
|
34457
|
+
// If the signal was already triggered before, do not even call `cb`
|
|
34458
|
+
return rej(cancellationSignal.cancellationError);
|
|
34459
|
+
}
|
|
34460
|
+
var hasUnregistered = false;
|
|
34461
|
+
abortingLogic = cb(function onCancellablePromiseSuccess(val) {
|
|
34462
|
+
cancellationSignal.deregister(onCancellablePromiseCancellation);
|
|
34463
|
+
hasUnregistered = true;
|
|
34464
|
+
res(val);
|
|
34465
|
+
}, function onCancellablePromiseFailure(err) {
|
|
34466
|
+
cancellationSignal.deregister(onCancellablePromiseCancellation);
|
|
34467
|
+
hasUnregistered = true;
|
|
34468
|
+
rej(err);
|
|
34408
34469
|
});
|
|
34470
|
+
if (!hasUnregistered) {
|
|
34471
|
+
cancellationSignal.register(onCancellablePromiseCancellation);
|
|
34472
|
+
}
|
|
34473
|
+
function onCancellablePromiseCancellation(error) {
|
|
34474
|
+
if (abortingLogic !== undefined) {
|
|
34475
|
+
abortingLogic();
|
|
34476
|
+
}
|
|
34477
|
+
rej(error);
|
|
34478
|
+
}
|
|
34409
34479
|
});
|
|
34410
34480
|
}
|
|
34411
34481
|
|
|
@@ -35908,6 +35978,9 @@ function createSharedReference(initialValue, cancelSignal) {
|
|
|
35908
35978
|
}
|
|
35909
35979
|
options.clearSignal.register(unlisten);
|
|
35910
35980
|
function unlisten() {
|
|
35981
|
+
if ((options === null || options === void 0 ? void 0 : options.clearSignal) !== undefined) {
|
|
35982
|
+
options.clearSignal.deregister(unlisten);
|
|
35983
|
+
}
|
|
35911
35984
|
if (cbObj.hasBeenCleared) {
|
|
35912
35985
|
return;
|
|
35913
35986
|
}
|
|
@@ -35950,6 +36023,9 @@ function createSharedReference(initialValue, cancelSignal) {
|
|
|
35950
36023
|
finish: finish
|
|
35951
36024
|
};
|
|
35952
36025
|
function finish() {
|
|
36026
|
+
if (cancelSignal !== undefined) {
|
|
36027
|
+
cancelSignal.deregister(finish);
|
|
36028
|
+
}
|
|
35953
36029
|
isFinished = true;
|
|
35954
36030
|
var clonedCbs = cbs.slice();
|
|
35955
36031
|
for (var _iterator2 = _createForOfIteratorHelperLoose(clonedCbs), _step2; !(_step2 = _iterator2()).done;) {
|
|
@@ -36083,7 +36159,7 @@ function request(options) {
|
|
|
36083
36159
|
}
|
|
36084
36160
|
reject(err);
|
|
36085
36161
|
});
|
|
36086
|
-
if (cancelSignal.isCancelled) {
|
|
36162
|
+
if (cancelSignal.isCancelled()) {
|
|
36087
36163
|
return;
|
|
36088
36164
|
}
|
|
36089
36165
|
}
|
|
@@ -36785,11 +36861,12 @@ function takeFirstSet() {
|
|
|
36785
36861
|
/* harmony export */ "XG": function() { return /* binding */ CancellationSignal; },
|
|
36786
36862
|
/* harmony export */ "ZP": function() { return /* binding */ TaskCanceller; }
|
|
36787
36863
|
/* harmony export */ });
|
|
36788
|
-
/* harmony import */ var
|
|
36789
|
-
/* harmony import */ var
|
|
36790
|
-
/* harmony import */ var
|
|
36791
|
-
/* harmony import */ var
|
|
36792
|
-
/* harmony import */ var
|
|
36864
|
+
/* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(7326);
|
|
36865
|
+
/* harmony import */ var _babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(4578);
|
|
36866
|
+
/* harmony import */ var _babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(2146);
|
|
36867
|
+
/* harmony import */ var _log__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3887);
|
|
36868
|
+
/* harmony import */ var _assert__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(811);
|
|
36869
|
+
/* harmony import */ var _noop__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(8894);
|
|
36793
36870
|
|
|
36794
36871
|
|
|
36795
36872
|
|
|
@@ -36810,6 +36887,7 @@ function takeFirstSet() {
|
|
|
36810
36887
|
*/
|
|
36811
36888
|
|
|
36812
36889
|
|
|
36890
|
+
|
|
36813
36891
|
/**
|
|
36814
36892
|
* Class facilitating asynchronous task cancellation.
|
|
36815
36893
|
*
|
|
@@ -36912,22 +36990,44 @@ var TaskCanceller = /*#__PURE__*/function () {
|
|
|
36912
36990
|
* Creates a new `TaskCanceller`, with its own `CancellationSignal` created
|
|
36913
36991
|
* as its `signal` provide.
|
|
36914
36992
|
* You can then pass this property to async task you wish to be cancellable.
|
|
36915
|
-
* @param {Object|undefined} options
|
|
36916
36993
|
*/
|
|
36917
|
-
function TaskCanceller(
|
|
36918
|
-
var _this = this;
|
|
36994
|
+
function TaskCanceller() {
|
|
36919
36995
|
var _createCancellationFu = createCancellationFunctions(),
|
|
36920
36996
|
trigger = _createCancellationFu[0],
|
|
36921
36997
|
register = _createCancellationFu[1];
|
|
36922
|
-
this.
|
|
36998
|
+
this._isUsed = false;
|
|
36923
36999
|
this._trigger = trigger;
|
|
36924
37000
|
this.signal = new CancellationSignal(register);
|
|
36925
|
-
|
|
36926
|
-
|
|
36927
|
-
|
|
36928
|
-
|
|
36929
|
-
|
|
36930
|
-
|
|
37001
|
+
}
|
|
37002
|
+
/**
|
|
37003
|
+
* Returns `true` if this `TaskCanceller` has already been triggered.
|
|
37004
|
+
* `false` otherwise.
|
|
37005
|
+
*/
|
|
37006
|
+
var _proto = TaskCanceller.prototype;
|
|
37007
|
+
_proto.isUsed = function isUsed() {
|
|
37008
|
+
return this._isUsed;
|
|
37009
|
+
}
|
|
37010
|
+
/**
|
|
37011
|
+
* Bind this `TaskCanceller` to a `CancellationSignal`, so the former
|
|
37012
|
+
* is automatically cancelled when the latter is triggered.
|
|
37013
|
+
*
|
|
37014
|
+
* Note that this call registers a callback on the given signal, until either
|
|
37015
|
+
* the current `TaskCanceller` is cancelled or until this given
|
|
37016
|
+
* `CancellationSignal` is triggered.
|
|
37017
|
+
* To avoid leaking memory, the returned callback allow to undo this link.
|
|
37018
|
+
* It should be called if/when that link is not needed anymore, such as when
|
|
37019
|
+
* there is no need for this `TaskCanceller` anymore.
|
|
37020
|
+
*
|
|
37021
|
+
* @param {Object} signal
|
|
37022
|
+
* @returns {Function}
|
|
37023
|
+
*/;
|
|
37024
|
+
_proto.linkToSignal = function linkToSignal(signal) {
|
|
37025
|
+
var _this = this;
|
|
37026
|
+
var unregister = signal.register(function () {
|
|
37027
|
+
_this.cancel();
|
|
37028
|
+
});
|
|
37029
|
+
this.signal.register(unregister);
|
|
37030
|
+
return unregister;
|
|
36931
37031
|
}
|
|
36932
37032
|
/**
|
|
36933
37033
|
* "Trigger" the `TaskCanceller`, notify through its associated
|
|
@@ -36939,13 +37039,12 @@ var TaskCanceller = /*#__PURE__*/function () {
|
|
|
36939
37039
|
* cancellation is actually triggered as a chain reaction from a previous
|
|
36940
37040
|
* cancellation.
|
|
36941
37041
|
* @param {Error} [srcError]
|
|
36942
|
-
|
|
36943
|
-
var _proto = TaskCanceller.prototype;
|
|
37042
|
+
*/;
|
|
36944
37043
|
_proto.cancel = function cancel(srcError) {
|
|
36945
|
-
if (this.
|
|
37044
|
+
if (this._isUsed) {
|
|
36946
37045
|
return;
|
|
36947
37046
|
}
|
|
36948
|
-
this.
|
|
37047
|
+
this._isUsed = true;
|
|
36949
37048
|
var cancellationError = srcError !== null && srcError !== void 0 ? srcError : new CancellationError();
|
|
36950
37049
|
this._trigger(cancellationError);
|
|
36951
37050
|
}
|
|
@@ -36975,18 +37074,31 @@ var CancellationSignal = /*#__PURE__*/function () {
|
|
|
36975
37074
|
*/
|
|
36976
37075
|
function CancellationSignal(registerToSource) {
|
|
36977
37076
|
var _this2 = this;
|
|
36978
|
-
this.
|
|
37077
|
+
this._isCancelled = false;
|
|
36979
37078
|
this.cancellationError = null;
|
|
36980
37079
|
this._listeners = [];
|
|
36981
37080
|
registerToSource(function (cancellationError) {
|
|
36982
37081
|
_this2.cancellationError = cancellationError;
|
|
36983
|
-
_this2.
|
|
37082
|
+
_this2._isCancelled = true;
|
|
36984
37083
|
while (_this2._listeners.length > 0) {
|
|
36985
|
-
|
|
36986
|
-
|
|
37084
|
+
try {
|
|
37085
|
+
var listener = _this2._listeners.pop();
|
|
37086
|
+
listener === null || listener === void 0 ? void 0 : listener(cancellationError);
|
|
37087
|
+
} catch (err) {
|
|
37088
|
+
_log__WEBPACK_IMPORTED_MODULE_0__/* ["default"].error */ .Z.error("Error while calling clean up listener", err instanceof Error ? err.toString() : "Unknown error");
|
|
37089
|
+
}
|
|
36987
37090
|
}
|
|
36988
37091
|
});
|
|
36989
37092
|
}
|
|
37093
|
+
/**
|
|
37094
|
+
* Returns `true` when the cancellation order was already triggered, meaning
|
|
37095
|
+
* that the linked task needs to be aborted.
|
|
37096
|
+
* @returns boolean
|
|
37097
|
+
*/
|
|
37098
|
+
var _proto2 = CancellationSignal.prototype;
|
|
37099
|
+
_proto2.isCancelled = function isCancelled() {
|
|
37100
|
+
return this._isCancelled;
|
|
37101
|
+
}
|
|
36990
37102
|
/**
|
|
36991
37103
|
* Registers a function that will be called when/if the current task is
|
|
36992
37104
|
* cancelled.
|
|
@@ -37007,13 +37119,13 @@ var CancellationSignal = /*#__PURE__*/function () {
|
|
|
37007
37119
|
* task succeeded or failed).
|
|
37008
37120
|
* You don't need to call that function when cancellation has already been
|
|
37009
37121
|
* performed.
|
|
37010
|
-
|
|
37011
|
-
var _proto2 = CancellationSignal.prototype;
|
|
37122
|
+
*/;
|
|
37012
37123
|
_proto2.register = function register(fn) {
|
|
37013
37124
|
var _this3 = this;
|
|
37014
|
-
if (this.
|
|
37015
|
-
(0,
|
|
37125
|
+
if (this._isCancelled) {
|
|
37126
|
+
(0,_assert__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)(this.cancellationError !== null);
|
|
37016
37127
|
fn(this.cancellationError);
|
|
37128
|
+
return _noop__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z;
|
|
37017
37129
|
}
|
|
37018
37130
|
this._listeners.push(fn);
|
|
37019
37131
|
return function () {
|
|
@@ -37029,13 +37141,9 @@ var CancellationSignal = /*#__PURE__*/function () {
|
|
|
37029
37141
|
* @param {Function} fn
|
|
37030
37142
|
*/;
|
|
37031
37143
|
_proto2.deregister = function deregister(fn) {
|
|
37032
|
-
|
|
37033
|
-
return;
|
|
37034
|
-
}
|
|
37035
|
-
for (var i = 0; i < this._listeners.length; i++) {
|
|
37144
|
+
for (var i = this._listeners.length - 1; i >= 0; i--) {
|
|
37036
37145
|
if (this._listeners[i] === fn) {
|
|
37037
37146
|
this._listeners.splice(i, 1);
|
|
37038
|
-
return;
|
|
37039
37147
|
}
|
|
37040
37148
|
}
|
|
37041
37149
|
};
|
|
@@ -37047,25 +37155,25 @@ var CancellationSignal = /*#__PURE__*/function () {
|
|
|
37047
37155
|
* @extends Error
|
|
37048
37156
|
*/
|
|
37049
37157
|
var CancellationError = /*#__PURE__*/function (_Error) {
|
|
37050
|
-
(0,
|
|
37158
|
+
(0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)(CancellationError, _Error);
|
|
37051
37159
|
function CancellationError() {
|
|
37052
37160
|
var _this4;
|
|
37053
37161
|
_this4 = _Error.call(this) || this;
|
|
37054
37162
|
// @see https://stackoverflow.com/questions/41102060/typescript-extending-error-class
|
|
37055
|
-
Object.setPrototypeOf((0,
|
|
37163
|
+
Object.setPrototypeOf((0,_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)(_this4), CancellationError.prototype);
|
|
37056
37164
|
_this4.name = "CancellationError";
|
|
37057
37165
|
_this4.message = "This task was cancelled.";
|
|
37058
37166
|
return _this4;
|
|
37059
37167
|
}
|
|
37060
37168
|
return CancellationError;
|
|
37061
|
-
}( /*#__PURE__*/(0,
|
|
37169
|
+
}( /*#__PURE__*/(0,_babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z)(Error));
|
|
37062
37170
|
/**
|
|
37063
37171
|
* Helper function allowing communication between a `TaskCanceller` and a
|
|
37064
37172
|
* `CancellationSignal`.
|
|
37065
37173
|
* @returns {Array.<Function>}
|
|
37066
37174
|
*/
|
|
37067
37175
|
function createCancellationFunctions() {
|
|
37068
|
-
var listener =
|
|
37176
|
+
var listener = _noop__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z;
|
|
37069
37177
|
return [function trigger(error) {
|
|
37070
37178
|
listener(error);
|
|
37071
37179
|
}, function register(newListener) {
|
|
@@ -38335,6 +38443,8 @@ function clearOnStop(mediaElement) {
|
|
|
38335
38443
|
function shouldReloadMediaSourceOnDecipherabilityUpdate(currentKeySystem) {
|
|
38336
38444
|
return currentKeySystem === undefined || currentKeySystem.indexOf("widevine") < 0;
|
|
38337
38445
|
}
|
|
38446
|
+
// EXTERNAL MODULE: ./src/utils/create_cancellable_promise.ts
|
|
38447
|
+
var create_cancellable_promise = __webpack_require__(7733);
|
|
38338
38448
|
// EXTERNAL MODULE: ./src/utils/noop.ts
|
|
38339
38449
|
var noop = __webpack_require__(8894);
|
|
38340
38450
|
// EXTERNAL MODULE: ./src/utils/take_first_set.ts
|
|
@@ -39727,9 +39837,8 @@ function getEstimateReference(_ref, stopAllEstimates) {
|
|
|
39727
39837
|
* This TaskCanceller is used both for restarting estimates with a new
|
|
39728
39838
|
* configuration and to cancel them altogether.
|
|
39729
39839
|
*/
|
|
39730
|
-
var currentEstimatesCanceller = new task_canceller/* default */.ZP(
|
|
39731
|
-
|
|
39732
|
-
});
|
|
39840
|
+
var currentEstimatesCanceller = new task_canceller/* default */.ZP();
|
|
39841
|
+
currentEstimatesCanceller.linkToSignal(stopAllEstimates);
|
|
39733
39842
|
// Create `ISharedReference` on which estimates will be emitted.
|
|
39734
39843
|
var estimateRef = createEstimateReference(manualBitrate.getValue(), representationsRef.getValue(), currentEstimatesCanceller.signal);
|
|
39735
39844
|
manualBitrate.onUpdate(restartEstimatesProductionFromCurrentConditions, {
|
|
@@ -39955,9 +40064,8 @@ function getEstimateReference(_ref, stopAllEstimates) {
|
|
|
39955
40064
|
var manualBitrateVal = manualBitrate.getValue();
|
|
39956
40065
|
var representations = representationsRef.getValue();
|
|
39957
40066
|
currentEstimatesCanceller.cancel();
|
|
39958
|
-
currentEstimatesCanceller = new task_canceller/* default */.ZP(
|
|
39959
|
-
|
|
39960
|
-
});
|
|
40067
|
+
currentEstimatesCanceller = new task_canceller/* default */.ZP();
|
|
40068
|
+
currentEstimatesCanceller.linkToSignal(stopAllEstimates);
|
|
39961
40069
|
var newRef = createEstimateReference(manualBitrateVal, representations, currentEstimatesCanceller.signal);
|
|
39962
40070
|
newRef.onUpdate(function onNewEstimate(newEstimate) {
|
|
39963
40071
|
estimateRef.setValue(newEstimate);
|
|
@@ -40315,14 +40423,13 @@ function _scheduleRequestWithCdns() {
|
|
|
40315
40423
|
if (blockedFor <= 0) {
|
|
40316
40424
|
return requestCdn(nextWantedCdn);
|
|
40317
40425
|
}
|
|
40318
|
-
var canceller = new task_canceller/* default */.ZP(
|
|
40319
|
-
|
|
40320
|
-
});
|
|
40426
|
+
var canceller = new task_canceller/* default */.ZP();
|
|
40427
|
+
var unlinkCanceller = canceller.linkToSignal(cancellationSignal);
|
|
40321
40428
|
return new Promise(function (res, rej) {
|
|
40322
40429
|
/* eslint-disable-next-line @typescript-eslint/no-misused-promises */
|
|
40323
40430
|
cdnPrioritizer === null || cdnPrioritizer === void 0 ? void 0 : cdnPrioritizer.addEventListener("priorityChange", function () {
|
|
40324
40431
|
var updatedPrioritaryCdn = getCdnToRequest();
|
|
40325
|
-
if (cancellationSignal.isCancelled) {
|
|
40432
|
+
if (cancellationSignal.isCancelled()) {
|
|
40326
40433
|
throw cancellationSignal.cancellationError;
|
|
40327
40434
|
}
|
|
40328
40435
|
if (updatedPrioritaryCdn === undefined) {
|
|
@@ -40336,7 +40443,7 @@ function _scheduleRequestWithCdns() {
|
|
|
40336
40443
|
(0,cancellable_sleep/* default */.Z)(blockedFor, canceller.signal).then(function () {
|
|
40337
40444
|
return requestCdn(nextWantedCdn).then(res, rej);
|
|
40338
40445
|
}, noop/* default */.Z);
|
|
40339
|
-
});
|
|
40446
|
+
})["finally"](unlinkCanceller);
|
|
40340
40447
|
};
|
|
40341
40448
|
_retryWithNextCdn = function _retryWithNextCdn3() {
|
|
40342
40449
|
_retryWithNextCdn = (0,asyncToGenerator/* default */.Z)( /*#__PURE__*/regenerator_default().mark(function _callee2(prevRequestError) {
|
|
@@ -40346,7 +40453,7 @@ function _scheduleRequestWithCdns() {
|
|
|
40346
40453
|
switch (_context2.prev = _context2.next) {
|
|
40347
40454
|
case 0:
|
|
40348
40455
|
nextCdn = getCdnToRequest();
|
|
40349
|
-
if (!cancellationSignal.isCancelled) {
|
|
40456
|
+
if (!cancellationSignal.isCancelled()) {
|
|
40350
40457
|
_context2.next = 3;
|
|
40351
40458
|
break;
|
|
40352
40459
|
}
|
|
@@ -40359,7 +40466,7 @@ function _scheduleRequestWithCdns() {
|
|
|
40359
40466
|
throw prevRequestError;
|
|
40360
40467
|
case 5:
|
|
40361
40468
|
onRetry(prevRequestError);
|
|
40362
|
-
if (!cancellationSignal.isCancelled) {
|
|
40469
|
+
if (!cancellationSignal.isCancelled()) {
|
|
40363
40470
|
_context2.next = 8;
|
|
40364
40471
|
break;
|
|
40365
40472
|
}
|
|
@@ -40609,7 +40716,7 @@ var ManifestFetcher = /*#__PURE__*/function (_EventEmitter) {
|
|
|
40609
40716
|
}
|
|
40610
40717
|
manifestProm.then(function (val) {
|
|
40611
40718
|
_this2.trigger("manifestReady", val.manifest);
|
|
40612
|
-
if (!_this2._canceller.isUsed) {
|
|
40719
|
+
if (!_this2._canceller.isUsed()) {
|
|
40613
40720
|
_this2._recursivelyRefreshManifest(val.manifest, val);
|
|
40614
40721
|
}
|
|
40615
40722
|
})["catch"](function (err) {
|
|
@@ -40764,7 +40871,7 @@ var ManifestFetcher = /*#__PURE__*/function (_EventEmitter) {
|
|
|
40764
40871
|
onWarnings = function _onWarnings(warnings) {
|
|
40765
40872
|
for (var _iterator = manifest_fetcher_createForOfIteratorHelperLoose(warnings), _step; !(_step = _iterator()).done;) {
|
|
40766
40873
|
var warning = _step.value;
|
|
40767
|
-
if (cancelSignal.isCancelled) {
|
|
40874
|
+
if (cancelSignal.isCancelled()) {
|
|
40768
40875
|
return;
|
|
40769
40876
|
}
|
|
40770
40877
|
var _formattedError = (0,format_error/* default */.Z)(warning, {
|
|
@@ -40920,9 +41027,8 @@ var ManifestFetcher = /*#__PURE__*/function (_EventEmitter) {
|
|
|
40920
41027
|
* be effectively considered.
|
|
40921
41028
|
* `nextRefreshCanceller` will allow to cancel every other when one is triggered.
|
|
40922
41029
|
*/
|
|
40923
|
-
var nextRefreshCanceller = new task_canceller/* default */.ZP(
|
|
40924
|
-
|
|
40925
|
-
});
|
|
41030
|
+
var nextRefreshCanceller = new task_canceller/* default */.ZP();
|
|
41031
|
+
nextRefreshCanceller.linkToSignal(this._canceller.signal);
|
|
40926
41032
|
/* Function to manually schedule a Manifest refresh */
|
|
40927
41033
|
this.scheduleManualRefresh = function (settings) {
|
|
40928
41034
|
var enablePartialRefresh = settings.enablePartialRefresh,
|
|
@@ -41099,7 +41205,7 @@ var ManifestFetcher = /*#__PURE__*/function (_EventEmitter) {
|
|
|
41099
41205
|
});
|
|
41100
41206
|
};
|
|
41101
41207
|
_proto._onFatalError = function _onFatalError(err) {
|
|
41102
|
-
if (this._canceller.isUsed) {
|
|
41208
|
+
if (this._canceller.isUsed()) {
|
|
41103
41209
|
return;
|
|
41104
41210
|
}
|
|
41105
41211
|
this.trigger("error", err);
|
|
@@ -41159,13 +41265,17 @@ function cdn_prioritizer_arrayLikeToArray(arr, len) { if (len == null || len > a
|
|
|
41159
41265
|
|
|
41160
41266
|
|
|
41161
41267
|
/**
|
|
41162
|
-
* Class signaling the priority between multiple CDN available for
|
|
41163
|
-
* resource.
|
|
41268
|
+
* Class storing and signaling the priority between multiple CDN available for
|
|
41269
|
+
* any given resource.
|
|
41164
41270
|
*
|
|
41165
|
-
* This class
|
|
41166
|
-
*
|
|
41167
|
-
*
|
|
41168
|
-
*
|
|
41271
|
+
* This class was first created to implement the complexities behind
|
|
41272
|
+
* Content Steering features, though its handling hasn't been added yet as we
|
|
41273
|
+
* wait for its specification to be both standardized and relied on in the wild.
|
|
41274
|
+
* In the meantime, it acts as an abstraction for the simple concept of
|
|
41275
|
+
* avoiding to request a CDN for any segment when an issue is encountered with
|
|
41276
|
+
* one (e.g. HTTP 500 statuses) and several CDN exist for a given resource. It
|
|
41277
|
+
* should be noted that this is also one of the planified features of the
|
|
41278
|
+
* Content Steering specification.
|
|
41169
41279
|
*
|
|
41170
41280
|
* @class CdnPrioritizer
|
|
41171
41281
|
*/
|
|
@@ -41476,10 +41586,22 @@ var generateRequestID = (0,id_generator/* default */.Z)();
|
|
|
41476
41586
|
* An `ISegmentFetcher` also implements a retry mechanism, based on the given
|
|
41477
41587
|
* `options` argument, which may retry a segment request when it fails.
|
|
41478
41588
|
*
|
|
41479
|
-
* @param {string} bufferType
|
|
41480
|
-
*
|
|
41481
|
-
* @param {Object}
|
|
41482
|
-
*
|
|
41589
|
+
* @param {string} bufferType - Type of buffer concerned (e.g. `"audio"`,
|
|
41590
|
+
* `"video"`, `"text" etc.)
|
|
41591
|
+
* @param {Object} pipeline - The transport-specific logic allowing to load
|
|
41592
|
+
* segments of the given buffer type and transport protocol (e.g. DASH).
|
|
41593
|
+
* @param {Object|null} cdnPrioritizer - Abstraction allowing to synchronize,
|
|
41594
|
+
* update and keep track of the priorization of the CDN to use to load any given
|
|
41595
|
+
* segment, in cases where multiple ones are available.
|
|
41596
|
+
*
|
|
41597
|
+
* Can be set to `null` in which case a minimal priorization logic will be used
|
|
41598
|
+
* instead.
|
|
41599
|
+
* @param {Object} lifecycleCallbacks - Callbacks that can be registered to be
|
|
41600
|
+
* informed when new requests are made, ended, new metrics are available etc.
|
|
41601
|
+
* This should be mainly useful to implement an adaptive logic relying on those
|
|
41602
|
+
* metrics and events.
|
|
41603
|
+
* @param {Object} options - Various tweaking options allowing to configure the
|
|
41604
|
+
* behavior of the returned `ISegmentFetcher`.
|
|
41483
41605
|
* @returns {Function}
|
|
41484
41606
|
*/
|
|
41485
41607
|
function segment_fetcher_createSegmentFetcher(bufferType, pipeline, cdnPrioritizer, lifecycleCallbacks, options) {
|
|
@@ -41503,7 +41625,7 @@ function segment_fetcher_createSegmentFetcher(bufferType, pipeline, cdnPrioritiz
|
|
|
41503
41625
|
*/
|
|
41504
41626
|
return /*#__PURE__*/function () {
|
|
41505
41627
|
var _fetchSegment = (0,asyncToGenerator/* default */.Z)( /*#__PURE__*/regenerator_default().mark(function _callee(content, fetcherCallbacks, cancellationSignal) {
|
|
41506
|
-
var _a, _b, segmentIdString, requestId, requestInfo, parsedChunks, segmentDurationAcc, metricsSent, loaderCallbacks, cached, res, loadedData, callLoaderWithUrl, generateParserFunction, onRetry, sendNetworkMetricsIfAvailable;
|
|
41628
|
+
var _a, _b, _c, segmentIdString, requestId, requestInfo, parsedChunks, segmentDurationAcc, metricsSent, loaderCallbacks, cached, res, loadedData, onCancellation, callLoaderWithUrl, generateParserFunction, onRetry, sendNetworkMetricsIfAvailable;
|
|
41507
41629
|
return regenerator_default().wrap(function _callee$(_context) {
|
|
41508
41630
|
while (1) {
|
|
41509
41631
|
switch (_context.prev = _context.next) {
|
|
@@ -41555,6 +41677,18 @@ function segment_fetcher_createSegmentFetcher(bufferType, pipeline, cdnPrioritiz
|
|
|
41555
41677
|
callLoaderWithUrl = function _callLoaderWithUrl(cdnMetadata) {
|
|
41556
41678
|
return loadSegment(cdnMetadata, content, requestOptions, cancellationSignal, loaderCallbacks);
|
|
41557
41679
|
};
|
|
41680
|
+
onCancellation = function _onCancellation() {
|
|
41681
|
+
var _a;
|
|
41682
|
+
if (requestInfo !== undefined) {
|
|
41683
|
+
return; // Request already terminated
|
|
41684
|
+
}
|
|
41685
|
+
|
|
41686
|
+
log/* default.debug */.Z.debug("SF: Segment request cancelled", segmentIdString);
|
|
41687
|
+
requestInfo = null;
|
|
41688
|
+
(_a = lifecycleCallbacks.onRequestEnd) === null || _a === void 0 ? void 0 : _a.call(lifecycleCallbacks, {
|
|
41689
|
+
id: requestId
|
|
41690
|
+
});
|
|
41691
|
+
};
|
|
41558
41692
|
// used by logs
|
|
41559
41693
|
segmentIdString = (0,utils/* getLoggableSegmentId */.K)(content);
|
|
41560
41694
|
requestId = generateRequestID();
|
|
@@ -41618,37 +41752,26 @@ function segment_fetcher_createSegmentFetcher(bufferType, pipeline, cdnPrioritiz
|
|
|
41618
41752
|
}; // Retrieve from cache if it exists
|
|
41619
41753
|
cached = cache !== undefined ? cache.get(content) : null;
|
|
41620
41754
|
if (!(cached !== null)) {
|
|
41621
|
-
_context.next =
|
|
41755
|
+
_context.next = 16;
|
|
41622
41756
|
break;
|
|
41623
41757
|
}
|
|
41624
41758
|
log/* default.debug */.Z.debug("SF: Found wanted segment in cache", segmentIdString);
|
|
41625
41759
|
fetcherCallbacks.onChunk(generateParserFunction(cached, false));
|
|
41626
41760
|
return _context.abrupt("return", Promise.resolve());
|
|
41627
|
-
case
|
|
41761
|
+
case 16:
|
|
41628
41762
|
log/* default.debug */.Z.debug("SF: Beginning request", segmentIdString);
|
|
41629
41763
|
(_a = lifecycleCallbacks.onRequestBegin) === null || _a === void 0 ? void 0 : _a.call(lifecycleCallbacks, {
|
|
41630
41764
|
requestTimestamp: performance.now(),
|
|
41631
41765
|
id: requestId,
|
|
41632
41766
|
content: content
|
|
41633
41767
|
});
|
|
41634
|
-
cancellationSignal.register(
|
|
41635
|
-
|
|
41636
|
-
|
|
41637
|
-
return; // Request already terminated
|
|
41638
|
-
}
|
|
41639
|
-
|
|
41640
|
-
log/* default.debug */.Z.debug("SF: Segment request cancelled", segmentIdString);
|
|
41641
|
-
requestInfo = null;
|
|
41642
|
-
(_a = lifecycleCallbacks.onRequestEnd) === null || _a === void 0 ? void 0 : _a.call(lifecycleCallbacks, {
|
|
41643
|
-
id: requestId
|
|
41644
|
-
});
|
|
41645
|
-
});
|
|
41646
|
-
_context.prev = 18;
|
|
41647
|
-
_context.next = 21;
|
|
41768
|
+
cancellationSignal.register(onCancellation);
|
|
41769
|
+
_context.prev = 19;
|
|
41770
|
+
_context.next = 22;
|
|
41648
41771
|
return scheduleRequestWithCdns(content.representation.cdnMetadata, cdnPrioritizer, callLoaderWithUrl, (0,object_assign/* default */.Z)({
|
|
41649
41772
|
onRetry: onRetry
|
|
41650
41773
|
}, options), cancellationSignal);
|
|
41651
|
-
case
|
|
41774
|
+
case 22:
|
|
41652
41775
|
res = _context.sent;
|
|
41653
41776
|
if (res.resultType === "segment-loaded") {
|
|
41654
41777
|
loadedData = res.resultData.responseData;
|
|
@@ -41667,7 +41790,7 @@ function segment_fetcher_createSegmentFetcher(bufferType, pipeline, cdnPrioritiz
|
|
|
41667
41790
|
} else {
|
|
41668
41791
|
requestInfo = null;
|
|
41669
41792
|
}
|
|
41670
|
-
if (!cancellationSignal.isCancelled) {
|
|
41793
|
+
if (!cancellationSignal.isCancelled()) {
|
|
41671
41794
|
// The current task could have been canceled as a result of one
|
|
41672
41795
|
// of the previous callbacks call. In that case, we don't want to send
|
|
41673
41796
|
// a "requestEnd" again as it has already been sent on cancellation.
|
|
@@ -41675,27 +41798,32 @@ function segment_fetcher_createSegmentFetcher(bufferType, pipeline, cdnPrioritiz
|
|
|
41675
41798
|
id: requestId
|
|
41676
41799
|
});
|
|
41677
41800
|
}
|
|
41678
|
-
|
|
41801
|
+
cancellationSignal.deregister(onCancellation);
|
|
41802
|
+
_context.next = 41;
|
|
41679
41803
|
break;
|
|
41680
|
-
case
|
|
41681
|
-
_context.prev =
|
|
41682
|
-
_context.t0 = _context["catch"](
|
|
41804
|
+
case 31:
|
|
41805
|
+
_context.prev = 31;
|
|
41806
|
+
_context.t0 = _context["catch"](19);
|
|
41807
|
+
cancellationSignal.deregister(onCancellation);
|
|
41683
41808
|
requestInfo = null;
|
|
41684
41809
|
if (!(_context.t0 instanceof task_canceller/* CancellationError */.FU)) {
|
|
41685
|
-
_context.next =
|
|
41810
|
+
_context.next = 38;
|
|
41686
41811
|
break;
|
|
41687
41812
|
}
|
|
41688
41813
|
log/* default.debug */.Z.debug("SF: Segment request aborted", segmentIdString);
|
|
41689
41814
|
throw _context.t0;
|
|
41690
|
-
case
|
|
41815
|
+
case 38:
|
|
41691
41816
|
log/* default.debug */.Z.debug("SF: Segment request failed", segmentIdString);
|
|
41817
|
+
(_c = lifecycleCallbacks.onRequestEnd) === null || _c === void 0 ? void 0 : _c.call(lifecycleCallbacks, {
|
|
41818
|
+
id: requestId
|
|
41819
|
+
});
|
|
41692
41820
|
throw errorSelector(_context.t0);
|
|
41693
|
-
case
|
|
41821
|
+
case 41:
|
|
41694
41822
|
case "end":
|
|
41695
41823
|
return _context.stop();
|
|
41696
41824
|
}
|
|
41697
41825
|
}
|
|
41698
|
-
}, _callee, null, [[
|
|
41826
|
+
}, _callee, null, [[19, 31]]);
|
|
41699
41827
|
}));
|
|
41700
41828
|
function fetchSegment(_x, _x2, _x3) {
|
|
41701
41829
|
return _fetchSegment.apply(this, arguments);
|
|
@@ -41731,6 +41859,7 @@ function getSegmentFetcherOptions(bufferType, _ref) {
|
|
|
41731
41859
|
|
|
41732
41860
|
|
|
41733
41861
|
|
|
41862
|
+
|
|
41734
41863
|
var TaskPrioritizer = /*#__PURE__*/function () {
|
|
41735
41864
|
/**
|
|
41736
41865
|
* @param {Options} prioritizerOptions
|
|
@@ -41771,49 +41900,43 @@ var TaskPrioritizer = /*#__PURE__*/function () {
|
|
|
41771
41900
|
_proto.create = function create(taskFn, priority, callbacks, cancelSignal) {
|
|
41772
41901
|
var _this = this;
|
|
41773
41902
|
var newTask;
|
|
41774
|
-
return
|
|
41903
|
+
return (0,create_cancellable_promise/* default */.Z)(cancelSignal, function (resolve, reject) {
|
|
41775
41904
|
/** Function allowing to start the underlying Promise. */
|
|
41776
41905
|
var trigger = function trigger() {
|
|
41777
41906
|
if (newTask.hasEnded) {
|
|
41778
|
-
unregisterCancelSignal();
|
|
41779
41907
|
return;
|
|
41780
41908
|
}
|
|
41781
|
-
var
|
|
41782
|
-
|
|
41783
|
-
|
|
41909
|
+
var finishTask = function finishTask() {
|
|
41910
|
+
unlinkInterrupter();
|
|
41911
|
+
_this._endTask(newTask);
|
|
41912
|
+
};
|
|
41913
|
+
var onResolve = function onResolve(value) {
|
|
41914
|
+
callbacks.beforeEnded();
|
|
41915
|
+
finishTask();
|
|
41916
|
+
resolve(value);
|
|
41917
|
+
};
|
|
41918
|
+
var onReject = function onReject(err) {
|
|
41919
|
+
finishTask();
|
|
41920
|
+
reject(err);
|
|
41921
|
+
};
|
|
41922
|
+
var interrupter = new task_canceller/* default */.ZP();
|
|
41923
|
+
var unlinkInterrupter = interrupter.linkToSignal(cancelSignal);
|
|
41784
41924
|
newTask.interrupter = interrupter;
|
|
41785
41925
|
interrupter.signal.register(function () {
|
|
41786
41926
|
newTask.interrupter = null;
|
|
41787
|
-
if (!cancelSignal.isCancelled) {
|
|
41927
|
+
if (!cancelSignal.isCancelled()) {
|
|
41788
41928
|
callbacks.beforeInterrupted();
|
|
41789
41929
|
}
|
|
41790
41930
|
});
|
|
41791
41931
|
_this._minPendingPriority = _this._minPendingPriority === null ? newTask.priority : Math.min(_this._minPendingPriority, newTask.priority);
|
|
41792
41932
|
_this._pendingTasks.push(newTask);
|
|
41793
41933
|
newTask.taskFn(interrupter.signal).then(onResolve)["catch"](function (err) {
|
|
41794
|
-
if (!cancelSignal.isCancelled && interrupter.isUsed && err instanceof task_canceller/* CancellationError */.FU) {
|
|
41934
|
+
if (!cancelSignal.isCancelled() && interrupter.isUsed() && err instanceof task_canceller/* CancellationError */.FU) {
|
|
41795
41935
|
return;
|
|
41796
41936
|
}
|
|
41797
41937
|
onReject(err);
|
|
41798
41938
|
});
|
|
41799
41939
|
};
|
|
41800
|
-
var unregisterCancelSignal = cancelSignal.register(function (cancellationError) {
|
|
41801
|
-
_this._endTask(newTask);
|
|
41802
|
-
reject(cancellationError);
|
|
41803
|
-
});
|
|
41804
|
-
var finishTask = function finishTask() {
|
|
41805
|
-
unregisterCancelSignal();
|
|
41806
|
-
_this._endTask(newTask);
|
|
41807
|
-
};
|
|
41808
|
-
var onResolve = function onResolve(value) {
|
|
41809
|
-
callbacks.beforeEnded();
|
|
41810
|
-
finishTask();
|
|
41811
|
-
resolve(value);
|
|
41812
|
-
};
|
|
41813
|
-
var onReject = function onReject(err) {
|
|
41814
|
-
finishTask();
|
|
41815
|
-
reject(err);
|
|
41816
|
-
};
|
|
41817
41940
|
newTask = {
|
|
41818
41941
|
hasEnded: false,
|
|
41819
41942
|
priority: priority,
|
|
@@ -41837,6 +41960,9 @@ var TaskPrioritizer = /*#__PURE__*/function () {
|
|
|
41837
41960
|
_this._interruptCancellableTasks();
|
|
41838
41961
|
}
|
|
41839
41962
|
}
|
|
41963
|
+
return function () {
|
|
41964
|
+
return _this._endTask(newTask);
|
|
41965
|
+
};
|
|
41840
41966
|
});
|
|
41841
41967
|
};
|
|
41842
41968
|
_proto._endTask = function _endTask(task) {
|
|
@@ -42205,6 +42331,7 @@ var types = __webpack_require__(9612);
|
|
|
42205
42331
|
|
|
42206
42332
|
|
|
42207
42333
|
|
|
42334
|
+
|
|
42208
42335
|
/**
|
|
42209
42336
|
* Allows to push and remove new segments to a SourceBuffer in a FIFO queue (not
|
|
42210
42337
|
* doing so can lead to browser Errors) while keeping an inventory of what has
|
|
@@ -42407,17 +42534,17 @@ var AudioVideoSegmentBuffer = /*#__PURE__*/function (_SegmentBuffer) {
|
|
|
42407
42534
|
*/;
|
|
42408
42535
|
_proto._addToQueue = function _addToQueue(operation, cancellationSignal) {
|
|
42409
42536
|
var _this2 = this;
|
|
42410
|
-
return
|
|
42411
|
-
if (cancellationSignal.cancellationError !== null) {
|
|
42412
|
-
return reject(cancellationSignal.cancellationError);
|
|
42413
|
-
}
|
|
42537
|
+
return (0,create_cancellable_promise/* default */.Z)(cancellationSignal, function (resolve, reject) {
|
|
42414
42538
|
var shouldRestartQueue = _this2._queue.length === 0 && _this2._pendingTask === null;
|
|
42415
42539
|
var queueItem = (0,object_assign/* default */.Z)({
|
|
42416
42540
|
resolve: resolve,
|
|
42417
42541
|
reject: reject
|
|
42418
42542
|
}, operation);
|
|
42419
42543
|
_this2._queue.push(queueItem);
|
|
42420
|
-
|
|
42544
|
+
if (shouldRestartQueue) {
|
|
42545
|
+
_this2._flush();
|
|
42546
|
+
}
|
|
42547
|
+
return function () {
|
|
42421
42548
|
// Remove the corresponding element from the AudioVideoSegmentBuffer's
|
|
42422
42549
|
// queue.
|
|
42423
42550
|
// If the operation was a pending task, it should still continue to not
|
|
@@ -42428,11 +42555,7 @@ var AudioVideoSegmentBuffer = /*#__PURE__*/function (_SegmentBuffer) {
|
|
|
42428
42555
|
}
|
|
42429
42556
|
queueItem.resolve = noop/* default */.Z;
|
|
42430
42557
|
queueItem.reject = noop/* default */.Z;
|
|
42431
|
-
|
|
42432
|
-
});
|
|
42433
|
-
if (shouldRestartQueue) {
|
|
42434
|
-
_this2._flush();
|
|
42435
|
-
}
|
|
42558
|
+
};
|
|
42436
42559
|
});
|
|
42437
42560
|
}
|
|
42438
42561
|
/**
|
|
@@ -42672,6 +42795,7 @@ function assertPushedDataIsBufferSource(pushedData) {
|
|
|
42672
42795
|
|
|
42673
42796
|
|
|
42674
42797
|
|
|
42798
|
+
|
|
42675
42799
|
var POSSIBLE_BUFFER_TYPES = ["audio", "video", "text", "image"];
|
|
42676
42800
|
/**
|
|
42677
42801
|
* Allows to easily create and dispose SegmentBuffers, which are interfaces to
|
|
@@ -42796,20 +42920,23 @@ var SegmentBuffersStore = /*#__PURE__*/function () {
|
|
|
42796
42920
|
if (this._areNativeBuffersUsable()) {
|
|
42797
42921
|
return Promise.resolve();
|
|
42798
42922
|
}
|
|
42799
|
-
return
|
|
42800
|
-
|
|
42923
|
+
return (0,create_cancellable_promise/* default */.Z)(cancelWaitSignal, function (res) {
|
|
42924
|
+
/* eslint-disable-next-line prefer-const */
|
|
42925
|
+
var onAddedOrDisabled;
|
|
42926
|
+
var removeCallback = function removeCallback() {
|
|
42927
|
+
var indexOf = _this._onNativeBufferAddedOrDisabled.indexOf(onAddedOrDisabled);
|
|
42928
|
+
if (indexOf >= 0) {
|
|
42929
|
+
_this._onNativeBufferAddedOrDisabled.splice(indexOf, 1);
|
|
42930
|
+
}
|
|
42931
|
+
};
|
|
42932
|
+
onAddedOrDisabled = function onAddedOrDisabled() {
|
|
42801
42933
|
if (_this._areNativeBuffersUsable()) {
|
|
42934
|
+
removeCallback();
|
|
42802
42935
|
res();
|
|
42803
42936
|
}
|
|
42804
42937
|
};
|
|
42805
42938
|
_this._onNativeBufferAddedOrDisabled.push(onAddedOrDisabled);
|
|
42806
|
-
|
|
42807
|
-
var indexOf = _this._onNativeBufferAddedOrDisabled.indexOf(onAddedOrDisabled);
|
|
42808
|
-
if (indexOf >= 0) {
|
|
42809
|
-
_this._onNativeBufferAddedOrDisabled.splice(indexOf, 1);
|
|
42810
|
-
}
|
|
42811
|
-
rej(error);
|
|
42812
|
-
});
|
|
42939
|
+
return removeCallback;
|
|
42813
42940
|
});
|
|
42814
42941
|
}
|
|
42815
42942
|
/**
|
|
@@ -43457,6 +43584,7 @@ function _clearBuffer() {
|
|
|
43457
43584
|
|
|
43458
43585
|
|
|
43459
43586
|
|
|
43587
|
+
|
|
43460
43588
|
/**
|
|
43461
43589
|
* Class scheduling segment downloads for a single Representation.
|
|
43462
43590
|
*
|
|
@@ -43596,6 +43724,7 @@ var DownloadingQueue = /*#__PURE__*/function (_EventEmitter) {
|
|
|
43596
43724
|
_proto.stop = function stop() {
|
|
43597
43725
|
var _a;
|
|
43598
43726
|
(_a = this._currentCanceller) === null || _a === void 0 ? void 0 : _a.cancel();
|
|
43727
|
+
this._currentCanceller = null;
|
|
43599
43728
|
}
|
|
43600
43729
|
/**
|
|
43601
43730
|
* Internal logic performing media segment requests.
|
|
@@ -43609,8 +43738,7 @@ var DownloadingQueue = /*#__PURE__*/function (_EventEmitter) {
|
|
|
43609
43738
|
segmentQueue = _this$_downloadQueue$.segmentQueue;
|
|
43610
43739
|
var currentNeededSegment = segmentQueue[0];
|
|
43611
43740
|
var recursivelyRequestSegments = function recursivelyRequestSegments(startingSegment) {
|
|
43612
|
-
|
|
43613
|
-
if (_this3._currentCanceller !== null && _this3._currentCanceller.isUsed) {
|
|
43741
|
+
if (_this3._currentCanceller !== null && _this3._currentCanceller.isUsed()) {
|
|
43614
43742
|
_this3._mediaSegmentRequest = null;
|
|
43615
43743
|
return;
|
|
43616
43744
|
}
|
|
@@ -43619,9 +43747,8 @@ var DownloadingQueue = /*#__PURE__*/function (_EventEmitter) {
|
|
|
43619
43747
|
_this3.trigger("emptyQueue", null);
|
|
43620
43748
|
return;
|
|
43621
43749
|
}
|
|
43622
|
-
var canceller = new task_canceller/* default */.ZP(
|
|
43623
|
-
|
|
43624
|
-
});
|
|
43750
|
+
var canceller = new task_canceller/* default */.ZP();
|
|
43751
|
+
var unlinkCanceller = _this3._currentCanceller === null ? noop/* default */.Z : canceller.linkToSignal(_this3._currentCanceller.signal);
|
|
43625
43752
|
var segment = startingSegment.segment,
|
|
43626
43753
|
priority = startingSegment.priority;
|
|
43627
43754
|
var context = (0,object_assign/* default */.Z)({
|
|
@@ -43726,6 +43853,7 @@ var DownloadingQueue = /*#__PURE__*/function (_EventEmitter) {
|
|
|
43726
43853
|
* requests are scheduled. It is used to schedule the next segment.
|
|
43727
43854
|
*/
|
|
43728
43855
|
beforeEnded: function beforeEnded() {
|
|
43856
|
+
unlinkCanceller();
|
|
43729
43857
|
_this3._mediaSegmentRequest = null;
|
|
43730
43858
|
if (isWaitingOnInitSegment) {
|
|
43731
43859
|
_this3._initSegmentInfoRef.waitUntilDefined(continueToNextSegment, {
|
|
@@ -43737,6 +43865,7 @@ var DownloadingQueue = /*#__PURE__*/function (_EventEmitter) {
|
|
|
43737
43865
|
}
|
|
43738
43866
|
}, canceller.signal);
|
|
43739
43867
|
request["catch"](function (error) {
|
|
43868
|
+
unlinkCanceller();
|
|
43740
43869
|
if (!isComplete) {
|
|
43741
43870
|
isComplete = true;
|
|
43742
43871
|
_this3.stop();
|
|
@@ -43758,8 +43887,7 @@ var DownloadingQueue = /*#__PURE__*/function (_EventEmitter) {
|
|
|
43758
43887
|
*/;
|
|
43759
43888
|
_proto._restartInitSegmentDownloadingQueue = function _restartInitSegmentDownloadingQueue(queuedInitSegment) {
|
|
43760
43889
|
var _this4 = this;
|
|
43761
|
-
|
|
43762
|
-
if (this._currentCanceller !== null && this._currentCanceller.isUsed) {
|
|
43890
|
+
if (this._currentCanceller !== null && this._currentCanceller.isUsed()) {
|
|
43763
43891
|
return;
|
|
43764
43892
|
}
|
|
43765
43893
|
if (this._initSegmentRequest !== null) {
|
|
@@ -43768,9 +43896,8 @@ var DownloadingQueue = /*#__PURE__*/function (_EventEmitter) {
|
|
|
43768
43896
|
if (queuedInitSegment === null) {
|
|
43769
43897
|
return;
|
|
43770
43898
|
}
|
|
43771
|
-
var canceller = new task_canceller/* default */.ZP(
|
|
43772
|
-
|
|
43773
|
-
});
|
|
43899
|
+
var canceller = new task_canceller/* default */.ZP();
|
|
43900
|
+
var unlinkCanceller = this._currentCanceller === null ? noop/* default */.Z : canceller.linkToSignal(this._currentCanceller.signal);
|
|
43774
43901
|
var segment = queuedInitSegment.segment,
|
|
43775
43902
|
priority = queuedInitSegment.priority;
|
|
43776
43903
|
var context = (0,object_assign/* default */.Z)({
|
|
@@ -43792,6 +43919,7 @@ var DownloadingQueue = /*#__PURE__*/function (_EventEmitter) {
|
|
|
43792
43919
|
log/* default.info */.Z.info("Stream: init segment request interrupted temporarly.", segment.id);
|
|
43793
43920
|
},
|
|
43794
43921
|
beforeEnded: function beforeEnded() {
|
|
43922
|
+
unlinkCanceller();
|
|
43795
43923
|
_this4._initSegmentRequest = null;
|
|
43796
43924
|
isComplete = true;
|
|
43797
43925
|
},
|
|
@@ -43811,6 +43939,7 @@ var DownloadingQueue = /*#__PURE__*/function (_EventEmitter) {
|
|
|
43811
43939
|
}
|
|
43812
43940
|
}, canceller.signal);
|
|
43813
43941
|
request["catch"](function (error) {
|
|
43942
|
+
unlinkCanceller();
|
|
43814
43943
|
if (!isComplete) {
|
|
43815
43944
|
isComplete = true;
|
|
43816
43945
|
_this4.stop();
|
|
@@ -44937,7 +45066,7 @@ function _appendSegmentToBuffer() {
|
|
|
44937
45066
|
case 5:
|
|
44938
45067
|
_context.prev = 5;
|
|
44939
45068
|
_context.t0 = _context["catch"](0);
|
|
44940
|
-
if (!(cancellationSignal.isCancelled && _context.t0 instanceof task_canceller/* CancellationError */.FU)) {
|
|
45069
|
+
if (!(cancellationSignal.isCancelled() && _context.t0 instanceof task_canceller/* CancellationError */.FU)) {
|
|
44941
45070
|
_context.next = 11;
|
|
44942
45071
|
break;
|
|
44943
45072
|
}
|
|
@@ -45238,17 +45367,15 @@ function RepresentationStream(_ref, callbacks, parentCancelSignal) {
|
|
|
45238
45367
|
fastSwitchThreshold = options.fastSwitchThreshold;
|
|
45239
45368
|
var bufferType = adaptation.type;
|
|
45240
45369
|
/** `TaskCanceller` stopping ALL operations performed by the `RepresentationStream` */
|
|
45241
|
-
var globalCanceller = new task_canceller/* default */.ZP(
|
|
45242
|
-
|
|
45243
|
-
});
|
|
45370
|
+
var globalCanceller = new task_canceller/* default */.ZP();
|
|
45371
|
+
globalCanceller.linkToSignal(parentCancelSignal);
|
|
45244
45372
|
/**
|
|
45245
45373
|
* `TaskCanceller` allowing to only stop segment loading and checking operations.
|
|
45246
45374
|
* This allows to stop only tasks linked to network resource usage, which is
|
|
45247
45375
|
* often a limited resource, while still letting buffer operations to finish.
|
|
45248
45376
|
*/
|
|
45249
|
-
var segmentsLoadingCanceller = new task_canceller/* default */.ZP(
|
|
45250
|
-
|
|
45251
|
-
});
|
|
45377
|
+
var segmentsLoadingCanceller = new task_canceller/* default */.ZP();
|
|
45378
|
+
segmentsLoadingCanceller.linkToSignal(globalCanceller.signal);
|
|
45252
45379
|
/** Saved initialization segment state for this representation. */
|
|
45253
45380
|
var initSegmentState = {
|
|
45254
45381
|
segment: representation.index.getInitSegment(),
|
|
@@ -45288,7 +45415,7 @@ function RepresentationStream(_ref, callbacks, parentCancelSignal) {
|
|
|
45288
45415
|
content: content
|
|
45289
45416
|
}, d);
|
|
45290
45417
|
}));
|
|
45291
|
-
if (globalCanceller.isUsed) {
|
|
45418
|
+
if (globalCanceller.isUsed()) {
|
|
45292
45419
|
return; // previous callback has stopped everything by side-effect
|
|
45293
45420
|
}
|
|
45294
45421
|
}
|
|
@@ -45296,7 +45423,7 @@ function RepresentationStream(_ref, callbacks, parentCancelSignal) {
|
|
|
45296
45423
|
/** Will load every segments in `lastSegmentQueue` */
|
|
45297
45424
|
var downloadingQueue = new DownloadingQueue(content, lastSegmentQueue, segmentFetcher, hasInitSegment);
|
|
45298
45425
|
downloadingQueue.addEventListener("error", function (err) {
|
|
45299
|
-
if (segmentsLoadingCanceller.signal.isCancelled) {
|
|
45426
|
+
if (segmentsLoadingCanceller.signal.isCancelled()) {
|
|
45300
45427
|
return; // ignore post requests-cancellation loading-related errors,
|
|
45301
45428
|
}
|
|
45302
45429
|
|
|
@@ -45308,7 +45435,7 @@ function RepresentationStream(_ref, callbacks, parentCancelSignal) {
|
|
|
45308
45435
|
downloadingQueue.addEventListener("emptyQueue", checkStatus);
|
|
45309
45436
|
downloadingQueue.addEventListener("requestRetry", function (payload) {
|
|
45310
45437
|
callbacks.warning(payload.error);
|
|
45311
|
-
if (segmentsLoadingCanceller.signal.isCancelled) {
|
|
45438
|
+
if (segmentsLoadingCanceller.signal.isCancelled()) {
|
|
45312
45439
|
return; // If the previous callback led to loading operations being stopped, skip
|
|
45313
45440
|
}
|
|
45314
45441
|
|
|
@@ -45355,7 +45482,7 @@ function RepresentationStream(_ref, callbacks, parentCancelSignal) {
|
|
|
45355
45482
|
*/
|
|
45356
45483
|
function checkStatus() {
|
|
45357
45484
|
var _a, _b;
|
|
45358
|
-
if (segmentsLoadingCanceller.isUsed) {
|
|
45485
|
+
if (segmentsLoadingCanceller.isUsed()) {
|
|
45359
45486
|
return; // Stop all buffer status checking if load operations are stopped
|
|
45360
45487
|
}
|
|
45361
45488
|
|
|
@@ -45431,7 +45558,7 @@ function RepresentationStream(_ref, callbacks, parentCancelSignal) {
|
|
|
45431
45558
|
hasFinishedLoading: status.hasFinishedLoading,
|
|
45432
45559
|
neededSegments: status.neededSegments
|
|
45433
45560
|
});
|
|
45434
|
-
if (segmentsLoadingCanceller.signal.isCancelled) {
|
|
45561
|
+
if (segmentsLoadingCanceller.signal.isCancelled()) {
|
|
45435
45562
|
return; // previous callback has stopped loading operations by side-effect
|
|
45436
45563
|
}
|
|
45437
45564
|
|
|
@@ -45440,7 +45567,7 @@ function RepresentationStream(_ref, callbacks, parentCancelSignal) {
|
|
|
45440
45567
|
if (status.isBufferFull) {
|
|
45441
45568
|
var gcedPosition = Math.max(0, initialWantedTime - UPTO_CURRENT_POSITION_CLEANUP);
|
|
45442
45569
|
if (gcedPosition > 0) {
|
|
45443
|
-
segmentBuffer.removeBuffer(0, gcedPosition,
|
|
45570
|
+
segmentBuffer.removeBuffer(0, gcedPosition, globalCanceller.signal)["catch"](onFatalBufferError);
|
|
45444
45571
|
}
|
|
45445
45572
|
}
|
|
45446
45573
|
if (status.shouldRefreshManifest) {
|
|
@@ -45453,7 +45580,7 @@ function RepresentationStream(_ref, callbacks, parentCancelSignal) {
|
|
|
45453
45580
|
* @param {Object} evt
|
|
45454
45581
|
*/
|
|
45455
45582
|
function onParsedChunk(evt) {
|
|
45456
|
-
if (globalCanceller.isUsed) {
|
|
45583
|
+
if (globalCanceller.isUsed()) {
|
|
45457
45584
|
// We should not do anything with segments if the `RepresentationStream`
|
|
45458
45585
|
// is not running anymore.
|
|
45459
45586
|
return;
|
|
@@ -45502,7 +45629,7 @@ function RepresentationStream(_ref, callbacks, parentCancelSignal) {
|
|
|
45502
45629
|
content: content
|
|
45503
45630
|
}, p);
|
|
45504
45631
|
}));
|
|
45505
|
-
if (globalCanceller.isUsed) {
|
|
45632
|
+
if (globalCanceller.isUsed()) {
|
|
45506
45633
|
return; // previous callback has stopped everything by side-effect
|
|
45507
45634
|
}
|
|
45508
45635
|
}
|
|
@@ -45510,14 +45637,14 @@ function RepresentationStream(_ref, callbacks, parentCancelSignal) {
|
|
|
45510
45637
|
|
|
45511
45638
|
if (needsManifestRefresh === true) {
|
|
45512
45639
|
callbacks.needsManifestRefresh();
|
|
45513
|
-
if (globalCanceller.isUsed) {
|
|
45640
|
+
if (globalCanceller.isUsed()) {
|
|
45514
45641
|
return; // previous callback has stopped everything by side-effect
|
|
45515
45642
|
}
|
|
45516
45643
|
}
|
|
45517
45644
|
|
|
45518
45645
|
if (inbandEvents !== undefined && inbandEvents.length > 0) {
|
|
45519
45646
|
callbacks.inbandEvent(inbandEvents);
|
|
45520
|
-
if (globalCanceller.isUsed) {
|
|
45647
|
+
if (globalCanceller.isUsed()) {
|
|
45521
45648
|
return; // previous callback has stopped everything by side-effect
|
|
45522
45649
|
}
|
|
45523
45650
|
}
|
|
@@ -45544,7 +45671,7 @@ function RepresentationStream(_ref, callbacks, parentCancelSignal) {
|
|
|
45544
45671
|
* @param {*} err
|
|
45545
45672
|
*/
|
|
45546
45673
|
function onFatalBufferError(err) {
|
|
45547
|
-
if (globalCanceller.isUsed && err instanceof task_canceller/* CancellationError */.FU) {
|
|
45674
|
+
if (globalCanceller.isUsed() && err instanceof task_canceller/* CancellationError */.FU) {
|
|
45548
45675
|
// The error is linked to cancellation AND we explicitely cancelled buffer
|
|
45549
45676
|
// operations.
|
|
45550
45677
|
// We can thus ignore it, it is very unlikely to lead to true buffer issues.
|
|
@@ -45720,9 +45847,8 @@ function AdaptationStream(_ref, callbacks, parentCancelSignal) {
|
|
|
45720
45847
|
period = content.period,
|
|
45721
45848
|
adaptation = content.adaptation;
|
|
45722
45849
|
/** Allows to cancel everything the `AdaptationStream` is doing. */
|
|
45723
|
-
var adapStreamCanceller = new task_canceller/* default */.ZP(
|
|
45724
|
-
|
|
45725
|
-
});
|
|
45850
|
+
var adapStreamCanceller = new task_canceller/* default */.ZP();
|
|
45851
|
+
adapStreamCanceller.linkToSignal(parentCancelSignal);
|
|
45726
45852
|
/**
|
|
45727
45853
|
* The buffer goal ratio base itself on the value given by `wantedBufferAhead`
|
|
45728
45854
|
* to determine a more dynamic buffer goal for a given Representation.
|
|
@@ -45790,9 +45916,8 @@ function AdaptationStream(_ref, callbacks, parentCancelSignal) {
|
|
|
45790
45916
|
* terminating and as such the next one might be immediately created
|
|
45791
45917
|
* recursively.
|
|
45792
45918
|
*/
|
|
45793
|
-
var repStreamTerminatingCanceller = new task_canceller/* default */.ZP(
|
|
45794
|
-
|
|
45795
|
-
});
|
|
45919
|
+
var repStreamTerminatingCanceller = new task_canceller/* default */.ZP();
|
|
45920
|
+
repStreamTerminatingCanceller.linkToSignal(adapStreamCanceller.signal);
|
|
45796
45921
|
var _estimateRef$getValue = estimateRef.getValue(),
|
|
45797
45922
|
representation = _estimateRef$getValue.representation,
|
|
45798
45923
|
manual = _estimateRef$getValue.manual;
|
|
@@ -45884,12 +46009,12 @@ function AdaptationStream(_ref, callbacks, parentCancelSignal) {
|
|
|
45884
46009
|
representation: representation
|
|
45885
46010
|
};
|
|
45886
46011
|
currentRepresentation.setValue(representation);
|
|
45887
|
-
if (adapStreamCanceller.isUsed) {
|
|
46012
|
+
if (adapStreamCanceller.isUsed()) {
|
|
45888
46013
|
return; // previous callback has stopped everything by side-effect
|
|
45889
46014
|
}
|
|
45890
46015
|
|
|
45891
46016
|
callbacks.representationChange(repInfo);
|
|
45892
|
-
if (adapStreamCanceller.isUsed) {
|
|
46017
|
+
if (adapStreamCanceller.isUsed()) {
|
|
45893
46018
|
return; // previous callback has stopped everything by side-effect
|
|
45894
46019
|
}
|
|
45895
46020
|
|
|
@@ -45906,13 +46031,13 @@ function AdaptationStream(_ref, callbacks, parentCancelSignal) {
|
|
|
45906
46031
|
},
|
|
45907
46032
|
addedSegment: function addedSegment(segmentInfo) {
|
|
45908
46033
|
abrCallbacks.addedSegment(segmentInfo);
|
|
45909
|
-
if (adapStreamCanceller.isUsed) {
|
|
46034
|
+
if (adapStreamCanceller.isUsed()) {
|
|
45910
46035
|
return;
|
|
45911
46036
|
}
|
|
45912
46037
|
callbacks.addedSegment(segmentInfo);
|
|
45913
46038
|
},
|
|
45914
46039
|
terminating: function terminating() {
|
|
45915
|
-
if (repStreamTerminatingCanceller.isUsed) {
|
|
46040
|
+
if (repStreamTerminatingCanceller.isUsed()) {
|
|
45916
46041
|
return; // Already handled
|
|
45917
46042
|
}
|
|
45918
46043
|
|
|
@@ -45935,9 +46060,8 @@ function AdaptationStream(_ref, callbacks, parentCancelSignal) {
|
|
|
45935
46060
|
* `TaskCanceller` triggered when the `RepresentationStream` calls its
|
|
45936
46061
|
* `terminating` callback.
|
|
45937
46062
|
*/
|
|
45938
|
-
var terminatingRepStreamCanceller = new task_canceller/* default */.ZP(
|
|
45939
|
-
|
|
45940
|
-
});
|
|
46063
|
+
var terminatingRepStreamCanceller = new task_canceller/* default */.ZP();
|
|
46064
|
+
terminatingRepStreamCanceller.linkToSignal(adapStreamCanceller.signal);
|
|
45941
46065
|
var bufferGoal = (0,reference/* createMappedReference */.lR)(wantedBufferAhead, function (prev) {
|
|
45942
46066
|
return prev * getBufferGoalRatio(representation);
|
|
45943
46067
|
}, terminatingRepStreamCanceller.signal);
|
|
@@ -46394,7 +46518,7 @@ function PeriodStream(_ref, callbacks, parentCancelSignal) {
|
|
|
46394
46518
|
period: period,
|
|
46395
46519
|
adaptationRef: adaptationRef
|
|
46396
46520
|
});
|
|
46397
|
-
if (parentCancelSignal.isCancelled) {
|
|
46521
|
+
if (parentCancelSignal.isCancelled()) {
|
|
46398
46522
|
return;
|
|
46399
46523
|
}
|
|
46400
46524
|
var currentStreamCanceller;
|
|
@@ -46413,76 +46537,75 @@ function PeriodStream(_ref, callbacks, parentCancelSignal) {
|
|
|
46413
46537
|
}
|
|
46414
46538
|
return _context.abrupt("return");
|
|
46415
46539
|
case 2:
|
|
46416
|
-
streamCanceller = new task_canceller/* default */.ZP(
|
|
46417
|
-
|
|
46418
|
-
});
|
|
46540
|
+
streamCanceller = new task_canceller/* default */.ZP();
|
|
46541
|
+
streamCanceller.linkToSignal(parentCancelSignal);
|
|
46419
46542
|
currentStreamCanceller === null || currentStreamCanceller === void 0 ? void 0 : currentStreamCanceller.cancel(); // Cancel oreviously created stream if one
|
|
46420
46543
|
currentStreamCanceller = streamCanceller;
|
|
46421
46544
|
if (!(adaptation === null)) {
|
|
46422
|
-
_context.next =
|
|
46545
|
+
_context.next = 34;
|
|
46423
46546
|
break;
|
|
46424
46547
|
}
|
|
46425
46548
|
// Current type is disabled for that Period
|
|
46426
46549
|
log/* default.info */.Z.info("Stream: Set no " + bufferType + " Adaptation. P:", period.start);
|
|
46427
46550
|
segmentBufferStatus = segmentBuffersStore.getStatus(bufferType);
|
|
46428
46551
|
if (!(segmentBufferStatus.type === "initialized")) {
|
|
46429
|
-
_context.next =
|
|
46552
|
+
_context.next = 26;
|
|
46430
46553
|
break;
|
|
46431
46554
|
}
|
|
46432
46555
|
log/* default.info */.Z.info("Stream: Clearing previous " + bufferType + " SegmentBuffer");
|
|
46433
46556
|
if (!segment_buffers.isNative(bufferType)) {
|
|
46434
|
-
_context.next =
|
|
46557
|
+
_context.next = 15;
|
|
46435
46558
|
break;
|
|
46436
46559
|
}
|
|
46437
46560
|
return _context.abrupt("return", askForMediaSourceReload(0, streamCanceller.signal));
|
|
46438
|
-
case
|
|
46561
|
+
case 15:
|
|
46439
46562
|
periodEnd = (_a = period.end) !== null && _a !== void 0 ? _a : Infinity;
|
|
46440
46563
|
if (!(period.start > periodEnd)) {
|
|
46441
|
-
_context.next =
|
|
46564
|
+
_context.next = 20;
|
|
46442
46565
|
break;
|
|
46443
46566
|
}
|
|
46444
46567
|
log/* default.warn */.Z.warn("Stream: Can't free buffer: period's start is after its end");
|
|
46445
|
-
_context.next =
|
|
46568
|
+
_context.next = 24;
|
|
46446
46569
|
break;
|
|
46447
|
-
case
|
|
46448
|
-
_context.next =
|
|
46570
|
+
case 20:
|
|
46571
|
+
_context.next = 22;
|
|
46449
46572
|
return segmentBufferStatus.value.removeBuffer(period.start, periodEnd, streamCanceller.signal);
|
|
46450
|
-
case
|
|
46451
|
-
if (!streamCanceller.isUsed) {
|
|
46452
|
-
_context.next =
|
|
46573
|
+
case 22:
|
|
46574
|
+
if (!streamCanceller.isUsed()) {
|
|
46575
|
+
_context.next = 24;
|
|
46453
46576
|
break;
|
|
46454
46577
|
}
|
|
46455
46578
|
return _context.abrupt("return");
|
|
46456
|
-
case
|
|
46457
|
-
_context.next =
|
|
46579
|
+
case 24:
|
|
46580
|
+
_context.next = 30;
|
|
46458
46581
|
break;
|
|
46459
|
-
case
|
|
46582
|
+
case 26:
|
|
46460
46583
|
if (!(segmentBufferStatus.type === "uninitialized")) {
|
|
46461
|
-
_context.next =
|
|
46584
|
+
_context.next = 30;
|
|
46462
46585
|
break;
|
|
46463
46586
|
}
|
|
46464
46587
|
segmentBuffersStore.disableSegmentBuffer(bufferType);
|
|
46465
|
-
if (!streamCanceller.isUsed) {
|
|
46466
|
-
_context.next =
|
|
46588
|
+
if (!streamCanceller.isUsed()) {
|
|
46589
|
+
_context.next = 30;
|
|
46467
46590
|
break;
|
|
46468
46591
|
}
|
|
46469
46592
|
return _context.abrupt("return");
|
|
46470
|
-
case
|
|
46593
|
+
case 30:
|
|
46471
46594
|
callbacks.adaptationChange({
|
|
46472
46595
|
type: bufferType,
|
|
46473
46596
|
adaptation: null,
|
|
46474
46597
|
period: period
|
|
46475
46598
|
});
|
|
46476
|
-
if (!streamCanceller.isUsed) {
|
|
46477
|
-
_context.next =
|
|
46599
|
+
if (!streamCanceller.isUsed()) {
|
|
46600
|
+
_context.next = 33;
|
|
46478
46601
|
break;
|
|
46479
46602
|
}
|
|
46480
46603
|
return _context.abrupt("return");
|
|
46481
|
-
case
|
|
46604
|
+
case 33:
|
|
46482
46605
|
return _context.abrupt("return", createEmptyAdaptationStream(playbackObserver, wantedBufferAhead, bufferType, {
|
|
46483
46606
|
period: period
|
|
46484
46607
|
}, callbacks, streamCanceller.signal));
|
|
46485
|
-
case
|
|
46608
|
+
case 34:
|
|
46486
46609
|
/**
|
|
46487
46610
|
* If this is not the first Adaptation choice, we might want to apply a
|
|
46488
46611
|
* delta to the current position so we can re-play back some media in the
|
|
@@ -46494,23 +46617,23 @@ function PeriodStream(_ref, callbacks, parentCancelSignal) {
|
|
|
46494
46617
|
relativePosAfterSwitch = isFirstAdaptationSwitch ? 0 : bufferType === "audio" ? DELTA_POSITION_AFTER_RELOAD.trackSwitch.audio : bufferType === "video" ? DELTA_POSITION_AFTER_RELOAD.trackSwitch.video : DELTA_POSITION_AFTER_RELOAD.trackSwitch.other;
|
|
46495
46618
|
isFirstAdaptationSwitch = false;
|
|
46496
46619
|
if (!(segment_buffers.isNative(bufferType) && segmentBuffersStore.getStatus(bufferType).type === "disabled")) {
|
|
46497
|
-
_context.next =
|
|
46620
|
+
_context.next = 39;
|
|
46498
46621
|
break;
|
|
46499
46622
|
}
|
|
46500
46623
|
return _context.abrupt("return", askForMediaSourceReload(relativePosAfterSwitch, streamCanceller.signal));
|
|
46501
|
-
case
|
|
46624
|
+
case 39:
|
|
46502
46625
|
log/* default.info */.Z.info("Stream: Updating " + bufferType + " adaptation", "A: " + adaptation.id, "P: " + period.start);
|
|
46503
46626
|
callbacks.adaptationChange({
|
|
46504
46627
|
type: bufferType,
|
|
46505
46628
|
adaptation: adaptation,
|
|
46506
46629
|
period: period
|
|
46507
46630
|
});
|
|
46508
|
-
if (!streamCanceller.isUsed) {
|
|
46509
|
-
_context.next =
|
|
46631
|
+
if (!streamCanceller.isUsed()) {
|
|
46632
|
+
_context.next = 43;
|
|
46510
46633
|
break;
|
|
46511
46634
|
}
|
|
46512
46635
|
return _context.abrupt("return");
|
|
46513
|
-
case
|
|
46636
|
+
case 43:
|
|
46514
46637
|
readyState = playbackObserver.getReadyState();
|
|
46515
46638
|
segmentBuffer = createOrReuseSegmentBuffer(segmentBuffersStore, bufferType, adaptation, options);
|
|
46516
46639
|
playbackInfos = {
|
|
@@ -46519,57 +46642,57 @@ function PeriodStream(_ref, callbacks, parentCancelSignal) {
|
|
|
46519
46642
|
};
|
|
46520
46643
|
strategy = getAdaptationSwitchStrategy(segmentBuffer, period, adaptation, playbackInfos, options);
|
|
46521
46644
|
if (!(strategy.type === "needs-reload")) {
|
|
46522
|
-
_context.next =
|
|
46645
|
+
_context.next = 49;
|
|
46523
46646
|
break;
|
|
46524
46647
|
}
|
|
46525
46648
|
return _context.abrupt("return", askForMediaSourceReload(relativePosAfterSwitch, streamCanceller.signal));
|
|
46526
|
-
case
|
|
46527
|
-
_context.next =
|
|
46649
|
+
case 49:
|
|
46650
|
+
_context.next = 51;
|
|
46528
46651
|
return segmentBuffersStore.waitForUsableBuffers(streamCanceller.signal);
|
|
46529
|
-
case
|
|
46530
|
-
if (!streamCanceller.isUsed) {
|
|
46531
|
-
_context.next =
|
|
46652
|
+
case 51:
|
|
46653
|
+
if (!streamCanceller.isUsed()) {
|
|
46654
|
+
_context.next = 53;
|
|
46532
46655
|
break;
|
|
46533
46656
|
}
|
|
46534
46657
|
return _context.abrupt("return");
|
|
46535
|
-
case
|
|
46658
|
+
case 53:
|
|
46536
46659
|
if (!(strategy.type === "flush-buffer" || strategy.type === "clean-buffer")) {
|
|
46537
|
-
_context.next =
|
|
46660
|
+
_context.next = 67;
|
|
46538
46661
|
break;
|
|
46539
46662
|
}
|
|
46540
46663
|
_iterator = period_stream_createForOfIteratorHelperLoose(strategy.value);
|
|
46541
|
-
case
|
|
46664
|
+
case 55:
|
|
46542
46665
|
if ((_step = _iterator()).done) {
|
|
46543
|
-
_context.next =
|
|
46666
|
+
_context.next = 63;
|
|
46544
46667
|
break;
|
|
46545
46668
|
}
|
|
46546
46669
|
_step$value = _step.value, start = _step$value.start, end = _step$value.end;
|
|
46547
|
-
_context.next =
|
|
46670
|
+
_context.next = 59;
|
|
46548
46671
|
return segmentBuffer.removeBuffer(start, end, streamCanceller.signal);
|
|
46549
|
-
case
|
|
46550
|
-
if (!streamCanceller.isUsed) {
|
|
46551
|
-
_context.next =
|
|
46672
|
+
case 59:
|
|
46673
|
+
if (!streamCanceller.isUsed()) {
|
|
46674
|
+
_context.next = 61;
|
|
46552
46675
|
break;
|
|
46553
46676
|
}
|
|
46554
46677
|
return _context.abrupt("return");
|
|
46555
|
-
case
|
|
46556
|
-
_context.next =
|
|
46678
|
+
case 61:
|
|
46679
|
+
_context.next = 55;
|
|
46557
46680
|
break;
|
|
46558
|
-
case
|
|
46681
|
+
case 63:
|
|
46559
46682
|
if (!(strategy.type === "flush-buffer")) {
|
|
46560
|
-
_context.next =
|
|
46683
|
+
_context.next = 67;
|
|
46561
46684
|
break;
|
|
46562
46685
|
}
|
|
46563
46686
|
callbacks.needsBufferFlush();
|
|
46564
|
-
if (!streamCanceller.isUsed) {
|
|
46565
|
-
_context.next =
|
|
46687
|
+
if (!streamCanceller.isUsed()) {
|
|
46688
|
+
_context.next = 67;
|
|
46566
46689
|
break;
|
|
46567
46690
|
}
|
|
46568
46691
|
return _context.abrupt("return");
|
|
46569
|
-
case
|
|
46692
|
+
case 67:
|
|
46570
46693
|
garbageCollectors.get(segmentBuffer)(streamCanceller.signal);
|
|
46571
46694
|
createAdaptationStream(adaptation, segmentBuffer, streamCanceller.signal);
|
|
46572
|
-
case
|
|
46695
|
+
case 69:
|
|
46573
46696
|
case "end":
|
|
46574
46697
|
return _context.stop();
|
|
46575
46698
|
}
|
|
@@ -46622,7 +46745,7 @@ function PeriodStream(_ref, callbacks, parentCancelSignal) {
|
|
|
46622
46745
|
defaultReason: "Unknown `AdaptationStream` error"
|
|
46623
46746
|
});
|
|
46624
46747
|
callbacks.warning(formattedError);
|
|
46625
|
-
if (cancelSignal.isCancelled) {
|
|
46748
|
+
if (cancelSignal.isCancelled()) {
|
|
46626
46749
|
return; // Previous callback cancelled the Stream by side-effect
|
|
46627
46750
|
}
|
|
46628
46751
|
|
|
@@ -46874,6 +46997,9 @@ function getTimeRangesForContent(segmentBuffer, contents) {
|
|
|
46874
46997
|
;// CONCATENATED MODULE: ./src/core/stream/orchestrator/stream_orchestrator.ts
|
|
46875
46998
|
|
|
46876
46999
|
|
|
47000
|
+
function stream_orchestrator_createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = stream_orchestrator_unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
47001
|
+
function stream_orchestrator_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return stream_orchestrator_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return stream_orchestrator_arrayLikeToArray(o, minLen); }
|
|
47002
|
+
function stream_orchestrator_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
46877
47003
|
/**
|
|
46878
47004
|
* Copyright 2015 CANAL+ Group
|
|
46879
47005
|
*
|
|
@@ -46972,9 +47098,10 @@ function StreamOrchestrator(content, playbackObserver, representationEstimator,
|
|
|
46972
47098
|
};
|
|
46973
47099
|
});
|
|
46974
47100
|
// Create automatically the right `PeriodStream` for every possible types
|
|
46975
|
-
segmentBuffersStore.getBufferTypes()
|
|
47101
|
+
for (var _iterator = stream_orchestrator_createForOfIteratorHelperLoose(segmentBuffersStore.getBufferTypes()), _step; !(_step = _iterator()).done;) {
|
|
47102
|
+
var bufferType = _step.value;
|
|
46976
47103
|
manageEveryStreams(bufferType, initialPeriod);
|
|
46977
|
-
}
|
|
47104
|
+
}
|
|
46978
47105
|
/**
|
|
46979
47106
|
* Manage creation and removal of Streams for every Periods for a given type.
|
|
46980
47107
|
*
|
|
@@ -46998,9 +47125,8 @@ function StreamOrchestrator(content, playbackObserver, representationEstimator,
|
|
|
46998
47125
|
*/
|
|
46999
47126
|
var enableOutOfBoundsCheck = false;
|
|
47000
47127
|
/** Cancels currently created `PeriodStream`s. */
|
|
47001
|
-
var currentCanceller = new task_canceller/* default */.ZP(
|
|
47002
|
-
|
|
47003
|
-
});
|
|
47128
|
+
var currentCanceller = new task_canceller/* default */.ZP();
|
|
47129
|
+
currentCanceller.linkToSignal(orchestratorCancelSignal);
|
|
47004
47130
|
// Restart the current Stream when the wanted time is in another period
|
|
47005
47131
|
// than the ones already considered
|
|
47006
47132
|
playbackObserver.listen(function (_ref) {
|
|
@@ -47021,9 +47147,8 @@ function StreamOrchestrator(content, playbackObserver, representationEstimator,
|
|
|
47021
47147
|
});
|
|
47022
47148
|
}
|
|
47023
47149
|
currentCanceller.cancel();
|
|
47024
|
-
currentCanceller = new task_canceller/* default */.ZP(
|
|
47025
|
-
|
|
47026
|
-
});
|
|
47150
|
+
currentCanceller = new task_canceller/* default */.ZP();
|
|
47151
|
+
currentCanceller.linkToSignal(orchestratorCancelSignal);
|
|
47027
47152
|
var nextPeriod = (_b = manifest.getPeriodForTime(time)) !== null && _b !== void 0 ? _b : manifest.getNextPeriod(time);
|
|
47028
47153
|
if (nextPeriod === undefined) {
|
|
47029
47154
|
log/* default.warn */.Z.warn("Stream: The wanted position is not found in the Manifest.");
|
|
@@ -47115,7 +47240,13 @@ function StreamOrchestrator(content, playbackObserver, representationEstimator,
|
|
|
47115
47240
|
ofCurrentType = updates.filter(function (update) {
|
|
47116
47241
|
return update.adaptation.type === bufferType;
|
|
47117
47242
|
});
|
|
47118
|
-
if (!(
|
|
47243
|
+
if (!(
|
|
47244
|
+
// No update concerns the current type of data
|
|
47245
|
+
ofCurrentType.length === 0 || segmentBufferStatus.type !== "initialized" ||
|
|
47246
|
+
// The update only notifies of now-decipherable streams
|
|
47247
|
+
ofCurrentType.every(function (x) {
|
|
47248
|
+
return x.representation.decipherable === true;
|
|
47249
|
+
}))) {
|
|
47119
47250
|
_context.next = 4;
|
|
47120
47251
|
break;
|
|
47121
47252
|
}
|
|
@@ -47154,34 +47285,33 @@ function StreamOrchestrator(content, playbackObserver, representationEstimator,
|
|
|
47154
47285
|
});
|
|
47155
47286
|
}
|
|
47156
47287
|
currentCanceller.cancel();
|
|
47157
|
-
currentCanceller = new task_canceller/* default */.ZP(
|
|
47158
|
-
|
|
47159
|
-
});
|
|
47288
|
+
currentCanceller = new task_canceller/* default */.ZP();
|
|
47289
|
+
currentCanceller.linkToSignal(orchestratorCancelSignal);
|
|
47160
47290
|
/** Remove from the `SegmentBuffer` all the concerned time ranges. */
|
|
47161
47291
|
_i = 0, _arr = [].concat(undecipherableRanges, rangesToRemove);
|
|
47162
|
-
case
|
|
47292
|
+
case 16:
|
|
47163
47293
|
if (!(_i < _arr.length)) {
|
|
47164
|
-
_context.next =
|
|
47294
|
+
_context.next = 24;
|
|
47165
47295
|
break;
|
|
47166
47296
|
}
|
|
47167
47297
|
_arr$_i = _arr[_i], start = _arr$_i.start, end = _arr$_i.end;
|
|
47168
47298
|
if (!(start < end)) {
|
|
47169
|
-
_context.next =
|
|
47299
|
+
_context.next = 21;
|
|
47170
47300
|
break;
|
|
47171
47301
|
}
|
|
47172
|
-
_context.next =
|
|
47302
|
+
_context.next = 21;
|
|
47173
47303
|
return segmentBuffer.removeBuffer(start, end, orchestratorCancelSignal);
|
|
47174
|
-
case
|
|
47304
|
+
case 21:
|
|
47175
47305
|
_i++;
|
|
47176
|
-
_context.next =
|
|
47306
|
+
_context.next = 16;
|
|
47177
47307
|
break;
|
|
47178
|
-
case
|
|
47308
|
+
case 24:
|
|
47179
47309
|
// Schedule micro task before checking the last playback observation
|
|
47180
47310
|
// to reduce the risk of race conditions where the next observation
|
|
47181
47311
|
// was going to be emitted synchronously.
|
|
47182
47312
|
next_tick_default()(function () {
|
|
47183
47313
|
var _a, _b;
|
|
47184
|
-
if (orchestratorCancelSignal.isCancelled) {
|
|
47314
|
+
if (orchestratorCancelSignal.isCancelled()) {
|
|
47185
47315
|
return;
|
|
47186
47316
|
}
|
|
47187
47317
|
var observation = playbackObserver.getReference().getValue();
|
|
@@ -47192,12 +47322,12 @@ function StreamOrchestrator(content, playbackObserver, representationEstimator,
|
|
|
47192
47322
|
autoPlay: shouldAutoPlay,
|
|
47193
47323
|
duration: observation.duration
|
|
47194
47324
|
});
|
|
47195
|
-
if (orchestratorCancelSignal.isCancelled) {
|
|
47325
|
+
if (orchestratorCancelSignal.isCancelled()) {
|
|
47196
47326
|
return;
|
|
47197
47327
|
}
|
|
47198
47328
|
} else if (needsFlushingAfterClean(observation, rangesToRemove)) {
|
|
47199
47329
|
callbacks.needsBufferFlush();
|
|
47200
|
-
if (orchestratorCancelSignal.isCancelled) {
|
|
47330
|
+
if (orchestratorCancelSignal.isCancelled()) {
|
|
47201
47331
|
return;
|
|
47202
47332
|
}
|
|
47203
47333
|
}
|
|
@@ -47209,7 +47339,7 @@ function StreamOrchestrator(content, playbackObserver, representationEstimator,
|
|
|
47209
47339
|
}
|
|
47210
47340
|
launchConsecutiveStreamsForPeriod(newInitialPeriod);
|
|
47211
47341
|
});
|
|
47212
|
-
case
|
|
47342
|
+
case 25:
|
|
47213
47343
|
case "end":
|
|
47214
47344
|
return _context.stop();
|
|
47215
47345
|
}
|
|
@@ -47258,9 +47388,8 @@ function StreamOrchestrator(content, playbackObserver, representationEstimator,
|
|
|
47258
47388
|
*/
|
|
47259
47389
|
var nextStreamInfo = null;
|
|
47260
47390
|
/** Emits when the `PeriodStream` linked to `basePeriod` should be destroyed. */
|
|
47261
|
-
var currentStreamCanceller = new task_canceller/* default */.ZP(
|
|
47262
|
-
|
|
47263
|
-
});
|
|
47391
|
+
var currentStreamCanceller = new task_canceller/* default */.ZP();
|
|
47392
|
+
currentStreamCanceller.linkToSignal(cancelSignal);
|
|
47264
47393
|
// Stop current PeriodStream when the current position goes over the end of
|
|
47265
47394
|
// that Period.
|
|
47266
47395
|
playbackObserver.listen(function (_ref2, stopListeningObservations) {
|
|
@@ -47337,10 +47466,10 @@ function StreamOrchestrator(content, playbackObserver, representationEstimator,
|
|
|
47337
47466
|
});
|
|
47338
47467
|
nextStreamInfo.canceller.cancel();
|
|
47339
47468
|
}
|
|
47469
|
+
var nextStreamCanceller = new task_canceller/* default */.ZP();
|
|
47470
|
+
nextStreamCanceller.linkToSignal(cancelSignal);
|
|
47340
47471
|
nextStreamInfo = {
|
|
47341
|
-
canceller:
|
|
47342
|
-
cancelOn: cancelSignal
|
|
47343
|
-
}),
|
|
47472
|
+
canceller: nextStreamCanceller,
|
|
47344
47473
|
period: nextPeriod
|
|
47345
47474
|
};
|
|
47346
47475
|
manageConsecutivePeriodStreams(bufferType, nextPeriod, consecutivePeriodStreamCb, nextStreamInfo.canceller.signal);
|
|
@@ -47480,7 +47609,7 @@ var ContentTimeBoundariesObserver = /*#__PURE__*/function (_EventEmitter) {
|
|
|
47480
47609
|
});
|
|
47481
47610
|
manifest.addEventListener("manifestUpdate", function () {
|
|
47482
47611
|
_this.trigger("durationUpdate", getManifestDuration());
|
|
47483
|
-
if (cancelSignal.isCancelled) {
|
|
47612
|
+
if (cancelSignal.isCancelled()) {
|
|
47484
47613
|
return;
|
|
47485
47614
|
}
|
|
47486
47615
|
_this._checkEndOfStream();
|
|
@@ -47519,7 +47648,7 @@ var ContentTimeBoundariesObserver = /*#__PURE__*/function (_EventEmitter) {
|
|
|
47519
47648
|
}
|
|
47520
47649
|
}
|
|
47521
47650
|
}
|
|
47522
|
-
if (this._canceller.isUsed) {
|
|
47651
|
+
if (this._canceller.isUsed()) {
|
|
47523
47652
|
return;
|
|
47524
47653
|
}
|
|
47525
47654
|
if (adaptation === null) {
|
|
@@ -47973,22 +48102,11 @@ function createMediaSource(mediaElement, unlinkSignal) {
|
|
|
47973
48102
|
* @returns {Promise}
|
|
47974
48103
|
*/
|
|
47975
48104
|
function openMediaSource(mediaElement, unlinkSignal) {
|
|
47976
|
-
return
|
|
47977
|
-
var hasResolved = false;
|
|
48105
|
+
return (0,create_cancellable_promise/* default */.Z)(unlinkSignal, function (resolve) {
|
|
47978
48106
|
var mediaSource = createMediaSource(mediaElement, unlinkSignal);
|
|
47979
|
-
var eventListenerCanceller = new task_canceller/* default */.ZP({
|
|
47980
|
-
cancelOn: unlinkSignal
|
|
47981
|
-
});
|
|
47982
48107
|
event_listeners/* onSourceOpen */.u_(mediaSource, function () {
|
|
47983
|
-
eventListenerCanceller.cancel();
|
|
47984
|
-
hasResolved = true;
|
|
47985
48108
|
resolve(mediaSource);
|
|
47986
|
-
},
|
|
47987
|
-
unlinkSignal.register(function (error) {
|
|
47988
|
-
if (!hasResolved) {
|
|
47989
|
-
reject(error);
|
|
47990
|
-
}
|
|
47991
|
-
});
|
|
48109
|
+
}, unlinkSignal);
|
|
47992
48110
|
});
|
|
47993
48111
|
}
|
|
47994
48112
|
;// CONCATENATED MODULE: ./src/core/init/utils/create_stream_playback_observer.ts
|
|
@@ -48134,9 +48252,8 @@ function triggerEndOfStream(mediaSource, cancelSignal) {
|
|
|
48134
48252
|
return;
|
|
48135
48253
|
}
|
|
48136
48254
|
log/* default.debug */.Z.debug("Init: Waiting SourceBuffers to be updated before calling endOfStream.");
|
|
48137
|
-
var innerCanceller = new task_canceller/* default */.ZP(
|
|
48138
|
-
|
|
48139
|
-
});
|
|
48255
|
+
var innerCanceller = new task_canceller/* default */.ZP();
|
|
48256
|
+
innerCanceller.linkToSignal(cancelSignal);
|
|
48140
48257
|
for (var _iterator = end_of_stream_createForOfIteratorHelperLoose(updatingSourceBuffers), _step; !(_step = _iterator()).done;) {
|
|
48141
48258
|
var sourceBuffer = _step.value;
|
|
48142
48259
|
onSourceBufferUpdate(sourceBuffer, function () {
|
|
@@ -48156,14 +48273,12 @@ function triggerEndOfStream(mediaSource, cancelSignal) {
|
|
|
48156
48273
|
* @param {Object} cancelSignal
|
|
48157
48274
|
*/
|
|
48158
48275
|
function maintainEndOfStream(mediaSource, cancelSignal) {
|
|
48159
|
-
var endOfStreamCanceller = new task_canceller/* default */.ZP(
|
|
48160
|
-
|
|
48161
|
-
});
|
|
48276
|
+
var endOfStreamCanceller = new task_canceller/* default */.ZP();
|
|
48277
|
+
endOfStreamCanceller.linkToSignal(cancelSignal);
|
|
48162
48278
|
onSourceOpen(mediaSource, function () {
|
|
48163
48279
|
endOfStreamCanceller.cancel();
|
|
48164
|
-
endOfStreamCanceller = new task_canceller/* default */.ZP(
|
|
48165
|
-
|
|
48166
|
-
});
|
|
48280
|
+
endOfStreamCanceller = new task_canceller/* default */.ZP();
|
|
48281
|
+
endOfStreamCanceller.linkToSignal(cancelSignal);
|
|
48167
48282
|
triggerEndOfStream(mediaSource, endOfStreamCanceller.signal);
|
|
48168
48283
|
}, cancelSignal);
|
|
48169
48284
|
triggerEndOfStream(mediaSource, endOfStreamCanceller.signal);
|
|
@@ -48312,9 +48427,8 @@ var MediaDurationUpdater = /*#__PURE__*/function () {
|
|
|
48312
48427
|
this._currentKnownDuration = currentKnownDuration;
|
|
48313
48428
|
var isMediaSourceOpened = createMediaSourceOpenReference(mediaSource, this._canceller.signal);
|
|
48314
48429
|
/** TaskCanceller triggered each time the MediaSource open status changes. */
|
|
48315
|
-
var msUpdateCanceller = new task_canceller/* default */.ZP(
|
|
48316
|
-
|
|
48317
|
-
});
|
|
48430
|
+
var msUpdateCanceller = new task_canceller/* default */.ZP();
|
|
48431
|
+
msUpdateCanceller.linkToSignal(this._canceller.signal);
|
|
48318
48432
|
isMediaSourceOpened.onUpdate(onMediaSourceOpenedStatusChanged, {
|
|
48319
48433
|
emitCurrentValue: true,
|
|
48320
48434
|
clearSignal: this._canceller.signal
|
|
@@ -48324,18 +48438,15 @@ var MediaDurationUpdater = /*#__PURE__*/function () {
|
|
|
48324
48438
|
if (!isMediaSourceOpened.getValue()) {
|
|
48325
48439
|
return;
|
|
48326
48440
|
}
|
|
48327
|
-
msUpdateCanceller = new task_canceller/* default */.ZP(
|
|
48328
|
-
|
|
48329
|
-
|
|
48330
|
-
|
|
48331
|
-
|
|
48332
|
-
cancelOn: msUpdateCanceller.signal
|
|
48333
|
-
});
|
|
48441
|
+
msUpdateCanceller = new task_canceller/* default */.ZP();
|
|
48442
|
+
msUpdateCanceller.linkToSignal(canceller.signal);
|
|
48443
|
+
/** TaskCanceller triggered each time the content's duration may have changed */
|
|
48444
|
+
var durationChangeCanceller = new task_canceller/* default */.ZP();
|
|
48445
|
+
durationChangeCanceller.linkToSignal(msUpdateCanceller.signal);
|
|
48334
48446
|
var reSetDuration = function reSetDuration() {
|
|
48335
48447
|
durationChangeCanceller.cancel();
|
|
48336
|
-
durationChangeCanceller = new task_canceller/* default */.ZP(
|
|
48337
|
-
|
|
48338
|
-
});
|
|
48448
|
+
durationChangeCanceller = new task_canceller/* default */.ZP();
|
|
48449
|
+
durationChangeCanceller.linkToSignal(msUpdateCanceller.signal);
|
|
48339
48450
|
onDurationMayHaveChanged(durationChangeCanceller.signal);
|
|
48340
48451
|
};
|
|
48341
48452
|
currentKnownDuration.onUpdate(reSetDuration, {
|
|
@@ -48348,14 +48459,12 @@ var MediaDurationUpdater = /*#__PURE__*/function () {
|
|
|
48348
48459
|
function onDurationMayHaveChanged(cancelSignal) {
|
|
48349
48460
|
var areSourceBuffersUpdating = createSourceBuffersUpdatingReference(mediaSource.sourceBuffers, cancelSignal);
|
|
48350
48461
|
/** TaskCanceller triggered each time SourceBuffers' updating status changes */
|
|
48351
|
-
var sourceBuffersUpdatingCanceller = new task_canceller/* default */.ZP(
|
|
48352
|
-
|
|
48353
|
-
});
|
|
48462
|
+
var sourceBuffersUpdatingCanceller = new task_canceller/* default */.ZP();
|
|
48463
|
+
sourceBuffersUpdatingCanceller.linkToSignal(cancelSignal);
|
|
48354
48464
|
return areSourceBuffersUpdating.onUpdate(function (areUpdating) {
|
|
48355
48465
|
sourceBuffersUpdatingCanceller.cancel();
|
|
48356
|
-
sourceBuffersUpdatingCanceller = new task_canceller/* default */.ZP(
|
|
48357
|
-
|
|
48358
|
-
});
|
|
48466
|
+
sourceBuffersUpdatingCanceller = new task_canceller/* default */.ZP();
|
|
48467
|
+
sourceBuffersUpdatingCanceller.linkToSignal(cancelSignal);
|
|
48359
48468
|
if (areUpdating) {
|
|
48360
48469
|
return;
|
|
48361
48470
|
}
|
|
@@ -48407,18 +48516,20 @@ function setMediaSourceDuration(mediaSource, manifest, knownDuration) {
|
|
|
48407
48516
|
var newDuration = knownDuration;
|
|
48408
48517
|
if (newDuration === undefined) {
|
|
48409
48518
|
if (manifest.isDynamic) {
|
|
48410
|
-
|
|
48411
|
-
// Some targets poorly support setting a very high number for durations.
|
|
48412
|
-
// Yet, in dynamic contents, we would prefer setting a value as high as possible
|
|
48413
|
-
// to still be able to seek anywhere we want to (even ahead of the Manifest if
|
|
48414
|
-
// we want to). As such, we put it at a safe default value of 2^32 excepted
|
|
48415
|
-
// when the maximum position is already relatively close to that value, where
|
|
48416
|
-
// we authorize exceptionally going over it.
|
|
48417
|
-
newDuration = Math.max(Math.pow(2, 32), maxPotentialPos + YEAR_IN_SECONDS);
|
|
48519
|
+
newDuration = (_a = manifest.getLivePosition()) !== null && _a !== void 0 ? _a : manifest.getMaximumSafePosition();
|
|
48418
48520
|
} else {
|
|
48419
48521
|
newDuration = manifest.getMaximumSafePosition();
|
|
48420
48522
|
}
|
|
48421
48523
|
}
|
|
48524
|
+
if (manifest.isDynamic) {
|
|
48525
|
+
// Some targets poorly support setting a very high number for durations.
|
|
48526
|
+
// Yet, in dynamic contents, we would prefer setting a value as high as possible
|
|
48527
|
+
// to still be able to seek anywhere we want to (even ahead of the Manifest if
|
|
48528
|
+
// we want to). As such, we put it at a safe default value of 2^32 excepted
|
|
48529
|
+
// when the maximum position is already relatively close to that value, where
|
|
48530
|
+
// we authorize exceptionally going over it.
|
|
48531
|
+
newDuration = Math.max(Math.pow(2, 32), newDuration + YEAR_IN_SECONDS);
|
|
48532
|
+
}
|
|
48422
48533
|
var maxBufferedEnd = 0;
|
|
48423
48534
|
for (var i = 0; i < mediaSource.sourceBuffers.length; i++) {
|
|
48424
48535
|
var sourceBuffer = mediaSource.sourceBuffers[i];
|
|
@@ -48697,17 +48808,15 @@ function streamEventsEmitter(manifest, mediaElement, playbackObserver, onEvent,
|
|
|
48697
48808
|
scheduledEventsRef.setValue(refresh_scheduled_events_list(prev, manifest));
|
|
48698
48809
|
}, cancelSignal);
|
|
48699
48810
|
var isPollingEvents = false;
|
|
48700
|
-
var cancelCurrentPolling = new task_canceller/* default */.ZP(
|
|
48701
|
-
|
|
48702
|
-
});
|
|
48811
|
+
var cancelCurrentPolling = new task_canceller/* default */.ZP();
|
|
48812
|
+
cancelCurrentPolling.linkToSignal(cancelSignal);
|
|
48703
48813
|
scheduledEventsRef.onUpdate(function (_ref) {
|
|
48704
48814
|
var scheduledEventsLength = _ref.length;
|
|
48705
48815
|
if (scheduledEventsLength === 0) {
|
|
48706
48816
|
if (isPollingEvents) {
|
|
48707
48817
|
cancelCurrentPolling.cancel();
|
|
48708
|
-
cancelCurrentPolling = new task_canceller/* default */.ZP(
|
|
48709
|
-
|
|
48710
|
-
});
|
|
48818
|
+
cancelCurrentPolling = new task_canceller/* default */.ZP();
|
|
48819
|
+
cancelCurrentPolling.linkToSignal(cancelSignal);
|
|
48711
48820
|
isPollingEvents = false;
|
|
48712
48821
|
}
|
|
48713
48822
|
return;
|
|
@@ -48799,7 +48908,7 @@ function streamEventsEmitter(manifest, mediaElement, playbackObserver, onEvent,
|
|
|
48799
48908
|
} else {
|
|
48800
48909
|
onEventSkip(_event.value);
|
|
48801
48910
|
}
|
|
48802
|
-
if (stopSignal.isCancelled) {
|
|
48911
|
+
if (stopSignal.isCancelled()) {
|
|
48803
48912
|
return;
|
|
48804
48913
|
}
|
|
48805
48914
|
}
|
|
@@ -48810,7 +48919,7 @@ function streamEventsEmitter(manifest, mediaElement, playbackObserver, onEvent,
|
|
|
48810
48919
|
if (typeof _event2.onExit === "function") {
|
|
48811
48920
|
_event2.onExit();
|
|
48812
48921
|
}
|
|
48813
|
-
if (stopSignal.isCancelled) {
|
|
48922
|
+
if (stopSignal.isCancelled()) {
|
|
48814
48923
|
return;
|
|
48815
48924
|
}
|
|
48816
48925
|
}
|
|
@@ -48891,6 +49000,7 @@ function media_source_content_initializer_arrayLikeToArray(arr, len) { if (len =
|
|
|
48891
49000
|
|
|
48892
49001
|
|
|
48893
49002
|
|
|
49003
|
+
|
|
48894
49004
|
|
|
48895
49005
|
|
|
48896
49006
|
/**
|
|
@@ -48931,11 +49041,7 @@ var MediaSourceContentInitializer = /*#__PURE__*/function (_ContentInitializer)
|
|
|
48931
49041
|
if (this._initialManifestProm !== null) {
|
|
48932
49042
|
return;
|
|
48933
49043
|
}
|
|
48934
|
-
this._initialManifestProm =
|
|
48935
|
-
_this2._initCanceller.signal.register(function (err) {
|
|
48936
|
-
_this2._manifestFetcher.dispose();
|
|
48937
|
-
rej(err);
|
|
48938
|
-
});
|
|
49044
|
+
this._initialManifestProm = (0,create_cancellable_promise/* default */.Z)(this._initCanceller.signal, function (res, rej) {
|
|
48939
49045
|
_this2._manifestFetcher.addEventListener("warning", function (err) {
|
|
48940
49046
|
return _this2.trigger("warning", err);
|
|
48941
49047
|
});
|
|
@@ -48946,7 +49052,10 @@ var MediaSourceContentInitializer = /*#__PURE__*/function (_ContentInitializer)
|
|
|
48946
49052
|
_this2._manifestFetcher.addEventListener("manifestReady", function (manifest) {
|
|
48947
49053
|
res(manifest);
|
|
48948
49054
|
});
|
|
48949
|
-
|
|
49055
|
+
});
|
|
49056
|
+
this._manifestFetcher.start();
|
|
49057
|
+
this._initCanceller.signal.register(function () {
|
|
49058
|
+
_this2._manifestFetcher.dispose();
|
|
48950
49059
|
});
|
|
48951
49060
|
}
|
|
48952
49061
|
/**
|
|
@@ -48982,7 +49091,7 @@ var MediaSourceContentInitializer = /*#__PURE__*/function (_ContentInitializer)
|
|
|
48982
49091
|
this._initCanceller.cancel();
|
|
48983
49092
|
};
|
|
48984
49093
|
_proto._onFatalError = function _onFatalError(err) {
|
|
48985
|
-
if (this._initCanceller.isUsed) {
|
|
49094
|
+
if (this._initCanceller.isUsed()) {
|
|
48986
49095
|
return;
|
|
48987
49096
|
}
|
|
48988
49097
|
this._initCanceller.cancel();
|
|
@@ -48990,12 +49099,9 @@ var MediaSourceContentInitializer = /*#__PURE__*/function (_ContentInitializer)
|
|
|
48990
49099
|
};
|
|
48991
49100
|
_proto._initializeMediaSourceAndDecryption = function _initializeMediaSourceAndDecryption(mediaElement, protectionRef) {
|
|
48992
49101
|
var _this4 = this;
|
|
48993
|
-
|
|
49102
|
+
var initCanceller = this._initCanceller;
|
|
49103
|
+
return (0,create_cancellable_promise/* default */.Z)(initCanceller.signal, function (resolve) {
|
|
48994
49104
|
var keySystems = _this4._settings.keySystems;
|
|
48995
|
-
var initCanceller = _this4._initCanceller;
|
|
48996
|
-
var unregisterReject = initCanceller.signal.register(function (err) {
|
|
48997
|
-
reject(err);
|
|
48998
|
-
});
|
|
48999
49105
|
/** Initialize decryption capabilities. */
|
|
49000
49106
|
var drmInitRef = (0,initialize_content_decryption/* default */.Z)(mediaElement, keySystems, protectionRef, {
|
|
49001
49107
|
onWarning: function onWarning(err) {
|
|
@@ -49010,9 +49116,8 @@ var MediaSourceContentInitializer = /*#__PURE__*/function (_ContentInitializer)
|
|
|
49010
49116
|
return;
|
|
49011
49117
|
}
|
|
49012
49118
|
stopListeningToDrmUpdates();
|
|
49013
|
-
var mediaSourceCanceller = new task_canceller/* default */.ZP(
|
|
49014
|
-
|
|
49015
|
-
});
|
|
49119
|
+
var mediaSourceCanceller = new task_canceller/* default */.ZP();
|
|
49120
|
+
mediaSourceCanceller.linkToSignal(initCanceller.signal);
|
|
49016
49121
|
openMediaSource(mediaElement, mediaSourceCanceller.signal).then(function (mediaSource) {
|
|
49017
49122
|
var lastDrmStatus = drmInitRef.getValue();
|
|
49018
49123
|
if (lastDrmStatus.initializationState.type === "awaiting-media-link") {
|
|
@@ -49020,7 +49125,6 @@ var MediaSourceContentInitializer = /*#__PURE__*/function (_ContentInitializer)
|
|
|
49020
49125
|
drmInitRef.onUpdate(function (newDrmStatus, stopListeningToDrmUpdatesAgain) {
|
|
49021
49126
|
if (newDrmStatus.initializationState.type === "initialized") {
|
|
49022
49127
|
stopListeningToDrmUpdatesAgain();
|
|
49023
|
-
unregisterReject();
|
|
49024
49128
|
resolve({
|
|
49025
49129
|
mediaSource: mediaSource,
|
|
49026
49130
|
drmSystemId: newDrmStatus.drmSystemId,
|
|
@@ -49033,7 +49137,6 @@ var MediaSourceContentInitializer = /*#__PURE__*/function (_ContentInitializer)
|
|
|
49033
49137
|
clearSignal: initCanceller.signal
|
|
49034
49138
|
});
|
|
49035
49139
|
} else if (drmStatus.initializationState.type === "initialized") {
|
|
49036
|
-
unregisterReject();
|
|
49037
49140
|
resolve({
|
|
49038
49141
|
mediaSource: mediaSource,
|
|
49039
49142
|
drmSystemId: drmStatus.drmSystemId,
|
|
@@ -49042,7 +49145,7 @@ var MediaSourceContentInitializer = /*#__PURE__*/function (_ContentInitializer)
|
|
|
49042
49145
|
return;
|
|
49043
49146
|
}
|
|
49044
49147
|
})["catch"](function (err) {
|
|
49045
|
-
if (mediaSourceCanceller.isUsed) {
|
|
49148
|
+
if (mediaSourceCanceller.isUsed()) {
|
|
49046
49149
|
return;
|
|
49047
49150
|
}
|
|
49048
49151
|
_this4._onFatalError(err);
|
|
@@ -49078,20 +49181,19 @@ var MediaSourceContentInitializer = /*#__PURE__*/function (_ContentInitializer)
|
|
|
49078
49181
|
bufferOnMediaSource(opts, onReloadMediaSource, currentCanceller.signal);
|
|
49079
49182
|
function onReloadMediaSource(reloadOrder) {
|
|
49080
49183
|
currentCanceller.cancel();
|
|
49081
|
-
if (initCanceller.isUsed) {
|
|
49184
|
+
if (initCanceller.isUsed()) {
|
|
49082
49185
|
return;
|
|
49083
49186
|
}
|
|
49084
49187
|
triggerEvent("reloadingMediaSource", null);
|
|
49085
|
-
if (initCanceller.isUsed) {
|
|
49188
|
+
if (initCanceller.isUsed()) {
|
|
49086
49189
|
return;
|
|
49087
49190
|
}
|
|
49088
|
-
var newCanceller = new task_canceller/* default */.ZP(
|
|
49089
|
-
|
|
49090
|
-
});
|
|
49191
|
+
var newCanceller = new task_canceller/* default */.ZP();
|
|
49192
|
+
newCanceller.linkToSignal(initCanceller.signal);
|
|
49091
49193
|
openMediaSource(mediaElement, newCanceller.signal).then(function (newMediaSource) {
|
|
49092
49194
|
recursivelyLoadOnMediaSource(newMediaSource, reloadOrder.position, reloadOrder.autoPlay, newCanceller);
|
|
49093
49195
|
})["catch"](function (err) {
|
|
49094
|
-
if (newCanceller.isUsed) {
|
|
49196
|
+
if (newCanceller.isUsed()) {
|
|
49095
49197
|
return;
|
|
49096
49198
|
}
|
|
49097
49199
|
onFatalError(err);
|
|
@@ -49131,7 +49233,7 @@ var MediaSourceContentInitializer = /*#__PURE__*/function (_ContentInitializer)
|
|
|
49131
49233
|
}, bufferOptions);
|
|
49132
49234
|
segmentFetcherCreator = new segment(transport, segmentRequestOptions, initCanceller.signal);
|
|
49133
49235
|
this.trigger("manifestReady", manifest);
|
|
49134
|
-
if (!initCanceller.isUsed) {
|
|
49236
|
+
if (!initCanceller.isUsed()) {
|
|
49135
49237
|
_context.next = 25;
|
|
49136
49238
|
break;
|
|
49137
49239
|
}
|
|
@@ -49200,7 +49302,7 @@ var MediaSourceContentInitializer = /*#__PURE__*/function (_ContentInitializer)
|
|
|
49200
49302
|
autoPlayResult = _performInitialSeekAn.autoPlayResult,
|
|
49201
49303
|
initialPlayPerformed = _performInitialSeekAn.initialPlayPerformed,
|
|
49202
49304
|
initialSeekPerformed = _performInitialSeekAn.initialSeekPerformed;
|
|
49203
|
-
if (cancelSignal.isCancelled) {
|
|
49305
|
+
if (cancelSignal.isCancelled()) {
|
|
49204
49306
|
return;
|
|
49205
49307
|
}
|
|
49206
49308
|
initialPlayPerformed.onUpdate(function (isPerformed, stopListening) {
|
|
@@ -49243,7 +49345,7 @@ var MediaSourceContentInitializer = /*#__PURE__*/function (_ContentInitializer)
|
|
|
49243
49345
|
clearSignal: cancelSignal
|
|
49244
49346
|
});
|
|
49245
49347
|
})["catch"](function (err) {
|
|
49246
|
-
if (cancelSignal.isCancelled) {
|
|
49348
|
+
if (cancelSignal.isCancelled()) {
|
|
49247
49349
|
return; // Current loading cancelled, no need to trigger the error
|
|
49248
49350
|
}
|
|
49249
49351
|
|
|
@@ -49277,7 +49379,7 @@ var MediaSourceContentInitializer = /*#__PURE__*/function (_ContentInitializer)
|
|
|
49277
49379
|
discontinuity: imminentDiscontinuity,
|
|
49278
49380
|
position: position
|
|
49279
49381
|
});
|
|
49280
|
-
if (cancelSignal.isCancelled) {
|
|
49382
|
+
if (cancelSignal.isCancelled()) {
|
|
49281
49383
|
return; // Previous call has stopped streams due to a side-effect
|
|
49282
49384
|
}
|
|
49283
49385
|
// If the status for the last Period indicates that segments are all loaded
|
|
@@ -49312,7 +49414,7 @@ var MediaSourceContentInitializer = /*#__PURE__*/function (_ContentInitializer)
|
|
|
49312
49414
|
},
|
|
49313
49415
|
adaptationChange: function adaptationChange(value) {
|
|
49314
49416
|
self.trigger("adaptationChange", value);
|
|
49315
|
-
if (cancelSignal.isCancelled) {
|
|
49417
|
+
if (cancelSignal.isCancelled()) {
|
|
49316
49418
|
return; // Previous call has stopped streams due to a side-effect
|
|
49317
49419
|
}
|
|
49318
49420
|
|
|
@@ -49320,7 +49422,7 @@ var MediaSourceContentInitializer = /*#__PURE__*/function (_ContentInitializer)
|
|
|
49320
49422
|
},
|
|
49321
49423
|
representationChange: function representationChange(value) {
|
|
49322
49424
|
self.trigger("representationChange", value);
|
|
49323
|
-
if (cancelSignal.isCancelled) {
|
|
49425
|
+
if (cancelSignal.isCancelled()) {
|
|
49324
49426
|
return; // Previous call has stopped streams due to a side-effect
|
|
49325
49427
|
}
|
|
49326
49428
|
|
|
@@ -49337,7 +49439,7 @@ var MediaSourceContentInitializer = /*#__PURE__*/function (_ContentInitializer)
|
|
|
49337
49439
|
},
|
|
49338
49440
|
periodStreamCleared: function periodStreamCleared(value) {
|
|
49339
49441
|
contentTimeBoundariesObserver.onPeriodCleared(value.type, value.period);
|
|
49340
|
-
if (cancelSignal.isCancelled) {
|
|
49442
|
+
if (cancelSignal.isCancelled()) {
|
|
49341
49443
|
return; // Previous call has stopped streams due to a side-effect
|
|
49342
49444
|
}
|
|
49343
49445
|
|
|
@@ -49370,7 +49472,7 @@ var MediaSourceContentInitializer = /*#__PURE__*/function (_ContentInitializer)
|
|
|
49370
49472
|
for (var _iterator = media_source_content_initializer_createForOfIteratorHelperLoose(value), _step; !(_step = _iterator()).done;) {
|
|
49371
49473
|
var protectionData = _step.value;
|
|
49372
49474
|
protectionRef.setValue(protectionData);
|
|
49373
|
-
if (cancelSignal.isCancelled) {
|
|
49475
|
+
if (cancelSignal.isCancelled()) {
|
|
49374
49476
|
return; // Previous call has stopped streams due to a side-effect
|
|
49375
49477
|
}
|
|
49376
49478
|
}
|
|
@@ -49424,9 +49526,8 @@ var MediaSourceContentInitializer = /*#__PURE__*/function (_ContentInitializer)
|
|
|
49424
49526
|
});
|
|
49425
49527
|
contentTimeBoundariesObserver.addEventListener("endOfStream", function () {
|
|
49426
49528
|
if (endOfStreamCanceller === null) {
|
|
49427
|
-
endOfStreamCanceller = new task_canceller/* default */.ZP(
|
|
49428
|
-
|
|
49429
|
-
});
|
|
49529
|
+
endOfStreamCanceller = new task_canceller/* default */.ZP();
|
|
49530
|
+
endOfStreamCanceller.linkToSignal(cancelSignal);
|
|
49430
49531
|
log/* default.debug */.Z.debug("Init: end-of-stream order received.");
|
|
49431
49532
|
maintainEndOfStream(mediaSource, endOfStreamCanceller.signal);
|
|
49432
49533
|
}
|
|
@@ -50075,7 +50176,7 @@ var PlaybackObserver = /*#__PURE__*/function () {
|
|
|
50075
50176
|
*/;
|
|
50076
50177
|
_proto.listen = function listen(cb, options) {
|
|
50077
50178
|
var _a;
|
|
50078
|
-
if (this._canceller.isUsed || ((_a = options === null || options === void 0 ? void 0 : options.clearSignal) === null || _a === void 0 ? void 0 : _a.isCancelled) === true) {
|
|
50179
|
+
if (this._canceller.isUsed() || ((_a = options === null || options === void 0 ? void 0 : options.clearSignal) === null || _a === void 0 ? void 0 : _a.isCancelled()) === true) {
|
|
50079
50180
|
return noop/* default */.Z;
|
|
50080
50181
|
}
|
|
50081
50182
|
this._observationRef.onUpdate(cb, {
|
|
@@ -50492,7 +50593,7 @@ function generateReadOnlyObserver(src, transform, cancellationSignal) {
|
|
|
50492
50593
|
},
|
|
50493
50594
|
listen: function listen(cb, options) {
|
|
50494
50595
|
var _a;
|
|
50495
|
-
if (cancellationSignal.isCancelled || ((_a = options === null || options === void 0 ? void 0 : options.clearSignal) === null || _a === void 0 ? void 0 : _a.isCancelled) === true) {
|
|
50596
|
+
if (cancellationSignal.isCancelled() || ((_a = options === null || options === void 0 ? void 0 : options.clearSignal) === null || _a === void 0 ? void 0 : _a.isCancelled()) === true) {
|
|
50496
50597
|
return;
|
|
50497
50598
|
}
|
|
50498
50599
|
mappedRef.onUpdate(cb, {
|
|
@@ -51621,13 +51722,13 @@ function getRightVideoTrack(adaptation, isTrickModeEnabled) {
|
|
|
51621
51722
|
* remove all listeners this function has registered.
|
|
51622
51723
|
*/
|
|
51623
51724
|
function emitSeekEvents(mediaElement, playbackObserver, onSeeking, onSeeked, cancelSignal) {
|
|
51624
|
-
if (cancelSignal.isCancelled || mediaElement === null) {
|
|
51725
|
+
if (cancelSignal.isCancelled() || mediaElement === null) {
|
|
51625
51726
|
return;
|
|
51626
51727
|
}
|
|
51627
51728
|
var wasSeeking = playbackObserver.getReference().getValue().seeking;
|
|
51628
51729
|
if (wasSeeking) {
|
|
51629
51730
|
onSeeking();
|
|
51630
|
-
if (cancelSignal.isCancelled) {
|
|
51731
|
+
if (cancelSignal.isCancelled()) {
|
|
51631
51732
|
return;
|
|
51632
51733
|
}
|
|
51633
51734
|
}
|
|
@@ -51649,7 +51750,7 @@ function constructPlayerStateReference(initializer, mediaElement, playbackObserv
|
|
|
51649
51750
|
initializer.addEventListener("loaded", function () {
|
|
51650
51751
|
if (playerStateRef.getValue() === "LOADING" /* PLAYER_STATES.LOADING */) {
|
|
51651
51752
|
playerStateRef.setValue("LOADED" /* PLAYER_STATES.LOADED */);
|
|
51652
|
-
if (!cancelSignal.isCancelled) {
|
|
51753
|
+
if (!cancelSignal.isCancelled()) {
|
|
51653
51754
|
var newState = getLoadedContentState(mediaElement, null);
|
|
51654
51755
|
if (newState !== "PAUSED" /* PLAYER_STATES.PAUSED */) {
|
|
51655
51756
|
playerStateRef.setValue(newState);
|
|
@@ -51826,7 +51927,7 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
|
|
|
51826
51927
|
// Workaround to support Firefox autoplay on FF 42.
|
|
51827
51928
|
// See: https://bugzilla.mozilla.org/show_bug.cgi?id=1194624
|
|
51828
51929
|
videoElement.preload = "auto";
|
|
51829
|
-
_this.version = /* PLAYER_VERSION */"3.30.0-dev.
|
|
51930
|
+
_this.version = /* PLAYER_VERSION */"3.30.0-dev.2023022200";
|
|
51830
51931
|
_this.log = log/* default */.Z;
|
|
51831
51932
|
_this.state = "STOPPED";
|
|
51832
51933
|
_this.videoElement = videoElement;
|
|
@@ -52028,6 +52129,18 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
|
|
|
52028
52129
|
newOptions.autoPlay = autoPlay;
|
|
52029
52130
|
}
|
|
52030
52131
|
this._priv_initializeContentPlayback(newOptions);
|
|
52132
|
+
};
|
|
52133
|
+
_proto.createDebugElement = function createDebugElement(element) {
|
|
52134
|
+
if (features/* default.createDebugElement */.Z.createDebugElement === null) {
|
|
52135
|
+
throw new Error("Feature `DEBUG_ELEMENT` not added to the RxPlayer");
|
|
52136
|
+
}
|
|
52137
|
+
var canceller = new task_canceller/* default */.ZP();
|
|
52138
|
+
features/* default.createDebugElement */.Z.createDebugElement(element, this, canceller.signal);
|
|
52139
|
+
return {
|
|
52140
|
+
dispose: function dispose() {
|
|
52141
|
+
canceller.cancel();
|
|
52142
|
+
}
|
|
52143
|
+
};
|
|
52031
52144
|
}
|
|
52032
52145
|
/**
|
|
52033
52146
|
* From given options, initialize content playback.
|
|
@@ -52171,7 +52284,7 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
|
|
|
52171
52284
|
throw new Error("DirectFile feature not activated in your build.");
|
|
52172
52285
|
}
|
|
52173
52286
|
mediaElementTrackChoiceManager = this._priv_initializeMediaElementTrackChoiceManager(defaultAudioTrack, defaultTextTrack, currentContentCanceller.signal);
|
|
52174
|
-
if (currentContentCanceller.isUsed) {
|
|
52287
|
+
if (currentContentCanceller.isUsed()) {
|
|
52175
52288
|
return;
|
|
52176
52289
|
}
|
|
52177
52290
|
initializer = new features/* default.directfile.initDirectFile */.Z.directfile.initDirectFile({
|
|
@@ -52346,7 +52459,7 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
|
|
|
52346
52459
|
playerStateRef.onUpdate(function (newState) {
|
|
52347
52460
|
updateReloadingMetadata(newState);
|
|
52348
52461
|
_this2._priv_setPlayerState(newState);
|
|
52349
|
-
if (currentContentCanceller.isUsed) {
|
|
52462
|
+
if (currentContentCanceller.isUsed()) {
|
|
52350
52463
|
return;
|
|
52351
52464
|
}
|
|
52352
52465
|
if (seekEventsCanceller !== null) {
|
|
@@ -52355,9 +52468,8 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
|
|
|
52355
52468
|
seekEventsCanceller = null;
|
|
52356
52469
|
}
|
|
52357
52470
|
} else if (isLoadedState(_this2.state)) {
|
|
52358
|
-
seekEventsCanceller = new task_canceller/* default */.ZP(
|
|
52359
|
-
|
|
52360
|
-
});
|
|
52471
|
+
seekEventsCanceller = new task_canceller/* default */.ZP();
|
|
52472
|
+
seekEventsCanceller.linkToSignal(currentContentCanceller.signal);
|
|
52361
52473
|
emitSeekEvents(videoElement, playbackObserver, function () {
|
|
52362
52474
|
return _this2.trigger("seeking", null);
|
|
52363
52475
|
}, function () {
|
|
@@ -53718,16 +53830,16 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
|
|
|
53718
53830
|
this._priv_triggerEventIfNotStopped("videoTrackChange", null, cancelSignal);
|
|
53719
53831
|
}
|
|
53720
53832
|
this._priv_triggerAvailableBitratesChangeEvent("availableAudioBitratesChange", this.getAvailableAudioBitrates(), cancelSignal);
|
|
53721
|
-
if (contentInfos.currentContentCanceller.isUsed) {
|
|
53833
|
+
if (contentInfos.currentContentCanceller.isUsed()) {
|
|
53722
53834
|
return;
|
|
53723
53835
|
}
|
|
53724
53836
|
this._priv_triggerAvailableBitratesChangeEvent("availableVideoBitratesChange", this.getAvailableVideoBitrates(), cancelSignal);
|
|
53725
|
-
if (contentInfos.currentContentCanceller.isUsed) {
|
|
53837
|
+
if (contentInfos.currentContentCanceller.isUsed()) {
|
|
53726
53838
|
return;
|
|
53727
53839
|
}
|
|
53728
53840
|
var audioBitrate = (_e = (_d = (_c = this._priv_getCurrentRepresentations()) === null || _c === void 0 ? void 0 : _c.audio) === null || _d === void 0 ? void 0 : _d.bitrate) !== null && _e !== void 0 ? _e : -1;
|
|
53729
53841
|
this._priv_triggerCurrentBitrateChangeEvent("audioBitrateChange", audioBitrate, cancelSignal);
|
|
53730
|
-
if (contentInfos.currentContentCanceller.isUsed) {
|
|
53842
|
+
if (contentInfos.currentContentCanceller.isUsed()) {
|
|
53731
53843
|
return;
|
|
53732
53844
|
}
|
|
53733
53845
|
var videoBitrate = (_h = (_g = (_f = this._priv_getCurrentRepresentations()) === null || _f === void 0 ? void 0 : _f.video) === null || _g === void 0 ? void 0 : _g.bitrate) !== null && _h !== void 0 ? _h : -1;
|
|
@@ -54013,7 +54125,7 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
|
|
|
54013
54125
|
*/;
|
|
54014
54126
|
_proto._priv_triggerAvailableBitratesChangeEvent = function _priv_triggerAvailableBitratesChangeEvent(event, newVal, currentContentCancelSignal) {
|
|
54015
54127
|
var prevVal = this._priv_contentEventsMemory[event];
|
|
54016
|
-
if (!currentContentCancelSignal.isCancelled && (prevVal === undefined || !(0,are_arrays_of_numbers_equal/* default */.Z)(newVal, prevVal))) {
|
|
54128
|
+
if (!currentContentCancelSignal.isCancelled() && (prevVal === undefined || !(0,are_arrays_of_numbers_equal/* default */.Z)(newVal, prevVal))) {
|
|
54017
54129
|
this._priv_contentEventsMemory[event] = newVal;
|
|
54018
54130
|
this.trigger(event, newVal);
|
|
54019
54131
|
}
|
|
@@ -54026,7 +54138,7 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
|
|
|
54026
54138
|
* @param {Object} currentContentCancelSignal
|
|
54027
54139
|
*/;
|
|
54028
54140
|
_proto._priv_triggerCurrentBitrateChangeEvent = function _priv_triggerCurrentBitrateChangeEvent(event, newVal, currentContentCancelSignal) {
|
|
54029
|
-
if (!currentContentCancelSignal.isCancelled && newVal !== this._priv_contentEventsMemory[event]) {
|
|
54141
|
+
if (!currentContentCancelSignal.isCancelled() && newVal !== this._priv_contentEventsMemory[event]) {
|
|
54030
54142
|
this._priv_contentEventsMemory[event] = newVal;
|
|
54031
54143
|
this.trigger(event, newVal);
|
|
54032
54144
|
}
|
|
@@ -54049,7 +54161,7 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
|
|
|
54049
54161
|
* @param {Object} currentContentCancelSignal
|
|
54050
54162
|
*/;
|
|
54051
54163
|
_proto._priv_triggerEventIfNotStopped = function _priv_triggerEventIfNotStopped(evt, arg, currentContentCancelSignal) {
|
|
54052
|
-
if (!currentContentCancelSignal.isCancelled) {
|
|
54164
|
+
if (!currentContentCancelSignal.isCancelled()) {
|
|
54053
54165
|
this.trigger(evt, arg);
|
|
54054
54166
|
}
|
|
54055
54167
|
}
|
|
@@ -54130,7 +54242,7 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
|
|
|
54130
54242
|
}]);
|
|
54131
54243
|
return Player;
|
|
54132
54244
|
}(event_emitter/* default */.Z);
|
|
54133
|
-
Player.version = /* PLAYER_VERSION */"3.30.0-dev.
|
|
54245
|
+
Player.version = /* PLAYER_VERSION */"3.30.0-dev.2023022200";
|
|
54134
54246
|
/* harmony default export */ var public_api = (Player);
|
|
54135
54247
|
;// CONCATENATED MODULE: ./src/core/api/index.ts
|
|
54136
54248
|
/**
|
|
@@ -54188,7 +54300,7 @@ function initializeFeaturesObject() {
|
|
|
54188
54300
|
features_object/* default.imageParser */.Z.imageParser = (__webpack_require__(3203)/* ["default"] */ .Z);
|
|
54189
54301
|
}
|
|
54190
54302
|
// Feature switching the Native TextTrack implementation
|
|
54191
|
-
var HAS_NATIVE_MODE =
|
|
54303
|
+
var HAS_NATIVE_MODE = true || 0;
|
|
54192
54304
|
if (true) {
|
|
54193
54305
|
features_object/* default.transports.smooth */.Z.transports.smooth = (__webpack_require__(2339)/* ["default"] */ .Z);
|
|
54194
54306
|
}
|
|
@@ -54198,7 +54310,8 @@ function initializeFeaturesObject() {
|
|
|
54198
54310
|
}
|
|
54199
54311
|
if (false) {}
|
|
54200
54312
|
if (false) {}
|
|
54201
|
-
if (
|
|
54313
|
+
if (false) {}
|
|
54314
|
+
if (HAS_NATIVE_MODE) {
|
|
54202
54315
|
features_object/* default.nativeTextTracksBuffer */.Z.nativeTextTracksBuffer = (__webpack_require__(9059)/* ["default"] */ .Z);
|
|
54203
54316
|
if (true) {
|
|
54204
54317
|
features_object/* default.nativeTextTracksParsers.vtt */.Z.nativeTextTracksParsers.vtt = (__webpack_require__(9405)/* ["default"] */ .Z);
|
|
@@ -54214,8 +54327,8 @@ function initializeFeaturesObject() {
|
|
|
54214
54327
|
}
|
|
54215
54328
|
}
|
|
54216
54329
|
// Feature switching the HTML TextTrack implementation
|
|
54217
|
-
var HAS_HTML_MODE =
|
|
54218
|
-
if (HAS_HTML_MODE
|
|
54330
|
+
var HAS_HTML_MODE = true || 0;
|
|
54331
|
+
if (HAS_HTML_MODE) {
|
|
54219
54332
|
features_object/* default.htmlTextTracksBuffer */.Z.htmlTextTracksBuffer = (__webpack_require__(5192)/* ["default"] */ .Z);
|
|
54220
54333
|
if (true) {
|
|
54221
54334
|
features_object/* default.htmlTextTracksParsers.sami */.Z.htmlTextTracksParsers.sami = (__webpack_require__(5734)/* ["default"] */ .Z);
|