rx-player 3.30.0-dev.2023020100 → 3.30.0-dev.2023030200
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/.eslintrc.js +8 -0
- package/CHANGELOG.md +5 -1
- package/VERSION +1 -1
- package/dist/_esm5.processed/compat/browser_detection.d.ts +23 -12
- package/dist/_esm5.processed/compat/browser_detection.js +80 -38
- package/dist/_esm5.processed/compat/can_reuse_media_keys.js +2 -2
- 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/config.d.ts +2 -0
- 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 +104 -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 +25 -14
- package/dist/_esm5.processed/core/api/utils.js +3 -3
- package/dist/_esm5.processed/core/decrypt/__tests__/__global__/utils.d.ts +32 -13
- package/dist/_esm5.processed/core/decrypt/__tests__/__global__/utils.js +28 -7
- 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/find_key_system.js +33 -24
- package/dist/_esm5.processed/core/decrypt/session_events_listener.js +54 -50
- 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 +17 -7
- 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/rebuffering_controller.js +1 -1
- 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 +25 -16
- 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/default_config.d.ts +16 -0
- package/dist/_esm5.processed/default_config.js +19 -0
- 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 +8 -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 +15 -11
- 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 +880 -677
- package/dist/rx-player.min.js +1 -1
- package/jest.config.js +1 -0
- package/package.json +19 -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/browser_detection.ts +99 -52
- package/src/compat/can_reuse_media_keys.ts +5 -2
- 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 +130 -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 +28 -14
- package/src/core/api/utils.ts +3 -3
- package/src/core/decrypt/__tests__/__global__/utils.ts +61 -40
- package/src/core/decrypt/attach_media_keys.ts +1 -1
- package/src/core/decrypt/content_decryptor.ts +1 -1
- package/src/core/decrypt/find_key_system.ts +36 -35
- package/src/core/decrypt/session_events_listener.ts +57 -56
- 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 +18 -7
- 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/rebuffering_controller.ts +1 -1
- 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 +28 -19
- 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/default_config.ts +30 -9
- 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 +8 -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 +31 -22
- 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
|
@@ -72,15 +72,15 @@ export default function RepresentationStream(_a, callbacks, parentCancelSignal)
|
|
|
72
72
|
var bufferGoal = options.bufferGoal, maxBufferSize = options.maxBufferSize, drmSystemId = options.drmSystemId, fastSwitchThreshold = options.fastSwitchThreshold;
|
|
73
73
|
var bufferType = adaptation.type;
|
|
74
74
|
/** `TaskCanceller` stopping ALL operations performed by the `RepresentationStream` */
|
|
75
|
-
var globalCanceller = new TaskCanceller(
|
|
75
|
+
var globalCanceller = new TaskCanceller();
|
|
76
|
+
globalCanceller.linkToSignal(parentCancelSignal);
|
|
76
77
|
/**
|
|
77
78
|
* `TaskCanceller` allowing to only stop segment loading and checking operations.
|
|
78
79
|
* This allows to stop only tasks linked to network resource usage, which is
|
|
79
80
|
* often a limited resource, while still letting buffer operations to finish.
|
|
80
81
|
*/
|
|
81
|
-
var segmentsLoadingCanceller = new TaskCanceller(
|
|
82
|
-
|
|
83
|
-
});
|
|
82
|
+
var segmentsLoadingCanceller = new TaskCanceller();
|
|
83
|
+
segmentsLoadingCanceller.linkToSignal(globalCanceller.signal);
|
|
84
84
|
/** Saved initialization segment state for this representation. */
|
|
85
85
|
var initSegmentState = {
|
|
86
86
|
segment: representation.index.getInitSegment(),
|
|
@@ -114,7 +114,7 @@ export default function RepresentationStream(_a, callbacks, parentCancelSignal)
|
|
|
114
114
|
if (encryptionData.length > 0 && encryptionData.every(function (e) { return e.keyIds !== undefined; })) {
|
|
115
115
|
hasSentEncryptionData = true;
|
|
116
116
|
callbacks.encryptionDataEncountered(encryptionData.map(function (d) { return objectAssign({ content: content }, d); }));
|
|
117
|
-
if (globalCanceller.isUsed) {
|
|
117
|
+
if (globalCanceller.isUsed()) {
|
|
118
118
|
return; // previous callback has stopped everything by side-effect
|
|
119
119
|
}
|
|
120
120
|
}
|
|
@@ -122,7 +122,7 @@ export default function RepresentationStream(_a, callbacks, parentCancelSignal)
|
|
|
122
122
|
/** Will load every segments in `lastSegmentQueue` */
|
|
123
123
|
var downloadingQueue = new DownloadingQueue(content, lastSegmentQueue, segmentFetcher, hasInitSegment);
|
|
124
124
|
downloadingQueue.addEventListener("error", function (err) {
|
|
125
|
-
if (segmentsLoadingCanceller.signal.isCancelled) {
|
|
125
|
+
if (segmentsLoadingCanceller.signal.isCancelled()) {
|
|
126
126
|
return; // ignore post requests-cancellation loading-related errors,
|
|
127
127
|
}
|
|
128
128
|
globalCanceller.cancel(); // Stop every operations
|
|
@@ -133,7 +133,7 @@ export default function RepresentationStream(_a, callbacks, parentCancelSignal)
|
|
|
133
133
|
downloadingQueue.addEventListener("emptyQueue", checkStatus);
|
|
134
134
|
downloadingQueue.addEventListener("requestRetry", function (payload) {
|
|
135
135
|
callbacks.warning(payload.error);
|
|
136
|
-
if (segmentsLoadingCanceller.signal.isCancelled) {
|
|
136
|
+
if (segmentsLoadingCanceller.signal.isCancelled()) {
|
|
137
137
|
return; // If the previous callback led to loading operations being stopped, skip
|
|
138
138
|
}
|
|
139
139
|
var retriedSegment = payload.segment;
|
|
@@ -179,7 +179,7 @@ export default function RepresentationStream(_a, callbacks, parentCancelSignal)
|
|
|
179
179
|
*/
|
|
180
180
|
function checkStatus() {
|
|
181
181
|
var _a, _b;
|
|
182
|
-
if (segmentsLoadingCanceller.isUsed) {
|
|
182
|
+
if (segmentsLoadingCanceller.isUsed()) {
|
|
183
183
|
return; // Stop all buffer status checking if load operations are stopped
|
|
184
184
|
}
|
|
185
185
|
var observation = playbackObserver.getReference().getValue();
|
|
@@ -251,14 +251,14 @@ export default function RepresentationStream(_a, callbacks, parentCancelSignal)
|
|
|
251
251
|
isEmptyStream: false,
|
|
252
252
|
hasFinishedLoading: status.hasFinishedLoading,
|
|
253
253
|
neededSegments: status.neededSegments });
|
|
254
|
-
if (segmentsLoadingCanceller.signal.isCancelled) {
|
|
254
|
+
if (segmentsLoadingCanceller.signal.isCancelled()) {
|
|
255
255
|
return; // previous callback has stopped loading operations by side-effect
|
|
256
256
|
}
|
|
257
257
|
var UPTO_CURRENT_POSITION_CLEANUP = config.getCurrent().UPTO_CURRENT_POSITION_CLEANUP;
|
|
258
258
|
if (status.isBufferFull) {
|
|
259
259
|
var gcedPosition = Math.max(0, initialWantedTime - UPTO_CURRENT_POSITION_CLEANUP);
|
|
260
260
|
if (gcedPosition > 0) {
|
|
261
|
-
segmentBuffer.removeBuffer(0, gcedPosition,
|
|
261
|
+
segmentBuffer.removeBuffer(0, gcedPosition, globalCanceller.signal)
|
|
262
262
|
.catch(onFatalBufferError);
|
|
263
263
|
}
|
|
264
264
|
}
|
|
@@ -272,7 +272,7 @@ export default function RepresentationStream(_a, callbacks, parentCancelSignal)
|
|
|
272
272
|
* @param {Object} evt
|
|
273
273
|
*/
|
|
274
274
|
function onParsedChunk(evt) {
|
|
275
|
-
if (globalCanceller.isUsed) {
|
|
275
|
+
if (globalCanceller.isUsed()) {
|
|
276
276
|
// We should not do anything with segments if the `RepresentationStream`
|
|
277
277
|
// is not running anymore.
|
|
278
278
|
return;
|
|
@@ -309,20 +309,20 @@ export default function RepresentationStream(_a, callbacks, parentCancelSignal)
|
|
|
309
309
|
var allEncryptionData = representation.getAllEncryptionData();
|
|
310
310
|
if (allEncryptionData.length > 0) {
|
|
311
311
|
callbacks.encryptionDataEncountered(allEncryptionData.map(function (p) { return objectAssign({ content: content }, p); }));
|
|
312
|
-
if (globalCanceller.isUsed) {
|
|
312
|
+
if (globalCanceller.isUsed()) {
|
|
313
313
|
return; // previous callback has stopped everything by side-effect
|
|
314
314
|
}
|
|
315
315
|
}
|
|
316
316
|
}
|
|
317
317
|
if (needsManifestRefresh === true) {
|
|
318
318
|
callbacks.needsManifestRefresh();
|
|
319
|
-
if (globalCanceller.isUsed) {
|
|
319
|
+
if (globalCanceller.isUsed()) {
|
|
320
320
|
return; // previous callback has stopped everything by side-effect
|
|
321
321
|
}
|
|
322
322
|
}
|
|
323
323
|
if (inbandEvents !== undefined && inbandEvents.length > 0) {
|
|
324
324
|
callbacks.inbandEvent(inbandEvents);
|
|
325
|
-
if (globalCanceller.isUsed) {
|
|
325
|
+
if (globalCanceller.isUsed()) {
|
|
326
326
|
return; // previous callback has stopped everything by side-effect
|
|
327
327
|
}
|
|
328
328
|
}
|
|
@@ -344,7 +344,7 @@ export default function RepresentationStream(_a, callbacks, parentCancelSignal)
|
|
|
344
344
|
* @param {*} err
|
|
345
345
|
*/
|
|
346
346
|
function onFatalBufferError(err) {
|
|
347
|
-
if (globalCanceller.isUsed && err instanceof CancellationError) {
|
|
347
|
+
if (globalCanceller.isUsed() && err instanceof CancellationError) {
|
|
348
348
|
// The error is linked to cancellation AND we explicitely cancelled buffer
|
|
349
349
|
// operations.
|
|
350
350
|
// We can thus ignore it, it is very unlikely to lead to true buffer issues.
|
|
@@ -79,7 +79,7 @@ export default function appendSegmentToBuffer(playbackObserver, segmentBuffer, d
|
|
|
79
79
|
return [3 /*break*/, 8];
|
|
80
80
|
case 2:
|
|
81
81
|
appendError_1 = _b.sent();
|
|
82
|
-
if (cancellationSignal.isCancelled && appendError_1 instanceof CancellationError) {
|
|
82
|
+
if (cancellationSignal.isCancelled() && appendError_1 instanceof CancellationError) {
|
|
83
83
|
throw appendError_1;
|
|
84
84
|
}
|
|
85
85
|
else if (!(appendError_1 instanceof Error) ||
|
|
@@ -31,6 +31,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
31
31
|
import log from "../../../../log";
|
|
32
32
|
import assert from "../../../../utils/assert";
|
|
33
33
|
import EventEmitter from "../../../../utils/event_emitter";
|
|
34
|
+
import noop from "../../../../utils/noop";
|
|
34
35
|
import objectAssign from "../../../../utils/object_assign";
|
|
35
36
|
import createSharedReference from "../../../../utils/reference";
|
|
36
37
|
import TaskCanceller from "../../../../utils/task_canceller";
|
|
@@ -171,6 +172,7 @@ var DownloadingQueue = /** @class */ (function (_super) {
|
|
|
171
172
|
DownloadingQueue.prototype.stop = function () {
|
|
172
173
|
var _a;
|
|
173
174
|
(_a = this._currentCanceller) === null || _a === void 0 ? void 0 : _a.cancel();
|
|
175
|
+
this._currentCanceller = null;
|
|
174
176
|
};
|
|
175
177
|
/**
|
|
176
178
|
* Internal logic performing media segment requests.
|
|
@@ -183,8 +185,7 @@ var DownloadingQueue = /** @class */ (function (_super) {
|
|
|
183
185
|
var segmentQueue = this._downloadQueue.getValue().segmentQueue;
|
|
184
186
|
var currentNeededSegment = segmentQueue[0];
|
|
185
187
|
var recursivelyRequestSegments = function (startingSegment) {
|
|
186
|
-
|
|
187
|
-
if (_this._currentCanceller !== null && _this._currentCanceller.isUsed) {
|
|
188
|
+
if (_this._currentCanceller !== null && _this._currentCanceller.isUsed()) {
|
|
188
189
|
_this._mediaSegmentRequest = null;
|
|
189
190
|
return;
|
|
190
191
|
}
|
|
@@ -193,7 +194,10 @@ var DownloadingQueue = /** @class */ (function (_super) {
|
|
|
193
194
|
_this.trigger("emptyQueue", null);
|
|
194
195
|
return;
|
|
195
196
|
}
|
|
196
|
-
var canceller = new TaskCanceller(
|
|
197
|
+
var canceller = new TaskCanceller();
|
|
198
|
+
var unlinkCanceller = _this._currentCanceller === null ?
|
|
199
|
+
noop :
|
|
200
|
+
canceller.linkToSignal(_this._currentCanceller.signal);
|
|
197
201
|
var segment = startingSegment.segment, priority = startingSegment.priority;
|
|
198
202
|
var context = objectAssign({ segment: segment }, _this._content);
|
|
199
203
|
/**
|
|
@@ -289,6 +293,7 @@ var DownloadingQueue = /** @class */ (function (_super) {
|
|
|
289
293
|
* requests are scheduled. It is used to schedule the next segment.
|
|
290
294
|
*/
|
|
291
295
|
beforeEnded: function () {
|
|
296
|
+
unlinkCanceller();
|
|
292
297
|
_this._mediaSegmentRequest = null;
|
|
293
298
|
if (isWaitingOnInitSegment) {
|
|
294
299
|
_this._initSegmentInfoRef.waitUntilDefined(continueToNextSegment, { clearSignal: canceller.signal });
|
|
@@ -299,6 +304,7 @@ var DownloadingQueue = /** @class */ (function (_super) {
|
|
|
299
304
|
},
|
|
300
305
|
}, canceller.signal);
|
|
301
306
|
request.catch(function (error) {
|
|
307
|
+
unlinkCanceller();
|
|
302
308
|
if (!isComplete) {
|
|
303
309
|
isComplete = true;
|
|
304
310
|
_this.stop();
|
|
@@ -315,8 +321,7 @@ var DownloadingQueue = /** @class */ (function (_super) {
|
|
|
315
321
|
*/
|
|
316
322
|
DownloadingQueue.prototype._restartInitSegmentDownloadingQueue = function (queuedInitSegment) {
|
|
317
323
|
var _this = this;
|
|
318
|
-
|
|
319
|
-
if (this._currentCanceller !== null && this._currentCanceller.isUsed) {
|
|
324
|
+
if (this._currentCanceller !== null && this._currentCanceller.isUsed()) {
|
|
320
325
|
return;
|
|
321
326
|
}
|
|
322
327
|
if (this._initSegmentRequest !== null) {
|
|
@@ -325,7 +330,10 @@ var DownloadingQueue = /** @class */ (function (_super) {
|
|
|
325
330
|
if (queuedInitSegment === null) {
|
|
326
331
|
return;
|
|
327
332
|
}
|
|
328
|
-
var canceller = new TaskCanceller(
|
|
333
|
+
var canceller = new TaskCanceller();
|
|
334
|
+
var unlinkCanceller = this._currentCanceller === null ?
|
|
335
|
+
noop :
|
|
336
|
+
canceller.linkToSignal(this._currentCanceller.signal);
|
|
329
337
|
var segment = queuedInitSegment.segment, priority = queuedInitSegment.priority;
|
|
330
338
|
var context = objectAssign({ segment: segment }, this._content);
|
|
331
339
|
/**
|
|
@@ -341,6 +349,7 @@ var DownloadingQueue = /** @class */ (function (_super) {
|
|
|
341
349
|
log.info("Stream: init segment request interrupted temporarly.", segment.id);
|
|
342
350
|
},
|
|
343
351
|
beforeEnded: function () {
|
|
352
|
+
unlinkCanceller();
|
|
344
353
|
_this._initSegmentRequest = null;
|
|
345
354
|
isComplete = true;
|
|
346
355
|
},
|
|
@@ -358,6 +367,7 @@ var DownloadingQueue = /** @class */ (function (_super) {
|
|
|
358
367
|
},
|
|
359
368
|
}, canceller.signal);
|
|
360
369
|
request.catch(function (error) {
|
|
370
|
+
unlinkCanceller();
|
|
361
371
|
if (!isComplete) {
|
|
362
372
|
isComplete = true;
|
|
363
373
|
_this.stop();
|
|
@@ -823,6 +823,22 @@ declare const DEFAULT_CONFIG: {
|
|
|
823
823
|
* @type {number}
|
|
824
824
|
*/
|
|
825
825
|
MIN_CANCELABLE_PRIORITY: number;
|
|
826
|
+
/**
|
|
827
|
+
* Codecs used in the videoCapabilities of the MediaKeySystemConfiguration
|
|
828
|
+
* (DRM).
|
|
829
|
+
*
|
|
830
|
+
* Defined in order of importance (first will be tested first etc.)
|
|
831
|
+
* @type {Array.<string>}
|
|
832
|
+
*/
|
|
833
|
+
EME_DEFAULT_VIDEO_CODECS: string[];
|
|
834
|
+
/**
|
|
835
|
+
* Codecs used in the audioCapabilities of the MediaKeySystemConfiguration
|
|
836
|
+
* (DRM).
|
|
837
|
+
*
|
|
838
|
+
* Defined in order of importance (first will be tested first etc.)
|
|
839
|
+
* @type {Array.<string>}
|
|
840
|
+
*/
|
|
841
|
+
EME_DEFAULT_AUDIO_CODECS: string[];
|
|
826
842
|
/**
|
|
827
843
|
* Robustnesses used in the {audio,video}Capabilities of the
|
|
828
844
|
* MediaKeySystemConfiguration (DRM).
|
|
@@ -853,6 +853,25 @@ var DEFAULT_CONFIG = {
|
|
|
853
853
|
* @type {number}
|
|
854
854
|
*/
|
|
855
855
|
MIN_CANCELABLE_PRIORITY: 3,
|
|
856
|
+
/**
|
|
857
|
+
* Codecs used in the videoCapabilities of the MediaKeySystemConfiguration
|
|
858
|
+
* (DRM).
|
|
859
|
+
*
|
|
860
|
+
* Defined in order of importance (first will be tested first etc.)
|
|
861
|
+
* @type {Array.<string>}
|
|
862
|
+
*/
|
|
863
|
+
EME_DEFAULT_VIDEO_CODECS: ["video/mp4;codecs=\"avc1.4d401e\"",
|
|
864
|
+
"video/mp4;codecs=\"avc1.42e01e\"",
|
|
865
|
+
"video/webm;codecs=\"vp8\""],
|
|
866
|
+
/**
|
|
867
|
+
* Codecs used in the audioCapabilities of the MediaKeySystemConfiguration
|
|
868
|
+
* (DRM).
|
|
869
|
+
*
|
|
870
|
+
* Defined in order of importance (first will be tested first etc.)
|
|
871
|
+
* @type {Array.<string>}
|
|
872
|
+
*/
|
|
873
|
+
EME_DEFAULT_AUDIO_CODECS: ["audio/mp4;codecs=\"mp4a.40.2\"",
|
|
874
|
+
"audio/webm;codecs=opus"],
|
|
856
875
|
/**
|
|
857
876
|
* Robustnesses used in the {audio,video}Capabilities of the
|
|
858
877
|
* MediaKeySystemConfiguration (DRM).
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IFeaturesObject } from "../../features/types";
|
|
2
|
+
/**
|
|
3
|
+
* Add ability to parse SAMI text tracks in an HTML textrack mode.
|
|
4
|
+
* @param {Object} features
|
|
5
|
+
*/
|
|
6
|
+
declare function addDebugElementFeature(features: IFeaturesObject): void;
|
|
7
|
+
export { addDebugElementFeature as DEBUG_ELEMENT };
|
|
8
|
+
export default addDebugElementFeature;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import createDebugElement from "../../core/api/debug";
|
|
2
|
+
/**
|
|
3
|
+
* Add ability to parse SAMI text tracks in an HTML textrack mode.
|
|
4
|
+
* @param {Object} features
|
|
5
|
+
*/
|
|
6
|
+
function addDebugElementFeature(features) {
|
|
7
|
+
features.createDebugElement = createDebugElement;
|
|
8
|
+
}
|
|
9
|
+
export { addDebugElementFeature as DEBUG_ELEMENT };
|
|
10
|
+
export default addDebugElementFeature;
|
package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/prepare_source_buffer.js
CHANGED
|
@@ -17,6 +17,7 @@ import { MediaSource_ } from "../../../compat";
|
|
|
17
17
|
import { resetMediaSource } from "../../../core/init/utils/create_media_source";
|
|
18
18
|
import { AudioVideoSegmentBuffer } from "../../../core/segment_buffers/implementations";
|
|
19
19
|
import log from "../../../log";
|
|
20
|
+
import createCancellablePromise from "../../../utils/create_cancellable_promise";
|
|
20
21
|
import isNonEmptyString from "../../../utils/is_non_empty_string";
|
|
21
22
|
/**
|
|
22
23
|
* Open the media source and create the `AudioVideoSegmentBuffer`.
|
|
@@ -26,7 +27,7 @@ import isNonEmptyString from "../../../utils/is_non_empty_string";
|
|
|
26
27
|
* @returns {Promise.<Object>}
|
|
27
28
|
*/
|
|
28
29
|
export default function prepareSourceBuffer(videoElement, codec, cleanUpSignal) {
|
|
29
|
-
return
|
|
30
|
+
return createCancellablePromise(cleanUpSignal, function (resolve, reject) {
|
|
30
31
|
if (MediaSource_ == null) {
|
|
31
32
|
throw new Error("No MediaSource Object was found in the current browser.");
|
|
32
33
|
}
|
|
@@ -39,13 +40,15 @@ export default function prepareSourceBuffer(videoElement, codec, cleanUpSignal)
|
|
|
39
40
|
var objectURL = URL.createObjectURL(mediaSource);
|
|
40
41
|
log.info("Init: Attaching MediaSource URL to the media element", objectURL);
|
|
41
42
|
videoElement.src = objectURL;
|
|
43
|
+
cleanUpSignal.register(function () {
|
|
44
|
+
resetMediaSource(videoElement, mediaSource, objectURL);
|
|
45
|
+
});
|
|
42
46
|
mediaSource.addEventListener("sourceopen", onSourceOpen);
|
|
43
47
|
mediaSource.addEventListener("webkitsourceopen", onSourceOpen);
|
|
44
|
-
|
|
48
|
+
return function () {
|
|
45
49
|
mediaSource.removeEventListener("sourceopen", onSourceOpen);
|
|
46
50
|
mediaSource.removeEventListener("webkitsourceopen", onSourceOpen);
|
|
47
|
-
|
|
48
|
-
});
|
|
51
|
+
};
|
|
49
52
|
function onSourceOpen() {
|
|
50
53
|
try {
|
|
51
54
|
mediaSource.removeEventListener("sourceopen", onSourceOpen);
|
package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.js
CHANGED
|
@@ -229,11 +229,15 @@ var VideoThumbnailLoader = /** @class */ (function () {
|
|
|
229
229
|
promises.push(pending_1.promise);
|
|
230
230
|
}
|
|
231
231
|
else {
|
|
232
|
-
var requestCanceller = new TaskCanceller(
|
|
233
|
-
|
|
234
|
-
|
|
232
|
+
var requestCanceller = new TaskCanceller();
|
|
233
|
+
var unlinkSignal_1 = requestCanceller
|
|
234
|
+
.linkToSignal(lastRepInfo.cleaner.signal);
|
|
235
235
|
var segmentInfo = objectAssign({ segment: segment }, content);
|
|
236
|
-
var prom = loadAndPushSegment(segmentInfo, segmentBuffer, lastRepInfo.segmentFetcher, requestCanceller.signal)
|
|
236
|
+
var prom = loadAndPushSegment(segmentInfo, segmentBuffer, lastRepInfo.segmentFetcher, requestCanceller.signal)
|
|
237
|
+
.then(unlinkSignal_1, function (err) {
|
|
238
|
+
unlinkSignal_1();
|
|
239
|
+
throw err;
|
|
240
|
+
});
|
|
237
241
|
var newReq_1 = {
|
|
238
242
|
segmentId: segment.id,
|
|
239
243
|
canceller: requestCanceller,
|
|
@@ -32,10 +32,10 @@ export default function initializeFeaturesObject() {
|
|
|
32
32
|
features.imageParser = require("../parsers/images/bif.ts").default;
|
|
33
33
|
}
|
|
34
34
|
// Feature switching the Native TextTrack implementation
|
|
35
|
-
var HAS_NATIVE_MODE = 0 /* __FEATURES__.NATIVE_VTT */ ||
|
|
36
|
-
0 /* __FEATURES__.NATIVE_SAMI */ ||
|
|
37
|
-
0 /* __FEATURES__.NATIVE_TTML */ ||
|
|
38
|
-
0 /* __FEATURES__.NATIVE_SRT */;
|
|
35
|
+
var HAS_NATIVE_MODE = 0 /* __FEATURES__.NATIVE_VTT */ === 1 /* __FEATURES__.IS_ENABLED */ ||
|
|
36
|
+
0 /* __FEATURES__.NATIVE_SAMI */ === 1 /* __FEATURES__.IS_ENABLED */ ||
|
|
37
|
+
0 /* __FEATURES__.NATIVE_TTML */ === 1 /* __FEATURES__.IS_ENABLED */ ||
|
|
38
|
+
0 /* __FEATURES__.NATIVE_SRT */ === 1 /* __FEATURES__.IS_ENABLED */;
|
|
39
39
|
if (0 /* __FEATURES__.SMOOTH */ === 1 /* __FEATURES__.IS_ENABLED */) {
|
|
40
40
|
features.transports.smooth = require("../transports/smooth/index.ts").default;
|
|
41
41
|
}
|
|
@@ -51,7 +51,10 @@ export default function initializeFeaturesObject() {
|
|
|
51
51
|
features.transports.metaplaylist =
|
|
52
52
|
require("../transports/metaplaylist/index.ts").default;
|
|
53
53
|
}
|
|
54
|
-
if (
|
|
54
|
+
if (0 /* __FEATURES__.DEBUG_ELEMENT */ === 1 /* __FEATURES__.IS_ENABLED */) {
|
|
55
|
+
features.createDebugElement = require("../core/api/debug/index.ts").default;
|
|
56
|
+
}
|
|
57
|
+
if (HAS_NATIVE_MODE) {
|
|
55
58
|
features.nativeTextTracksBuffer =
|
|
56
59
|
require("../core/segment_buffers/implementations/text/native/index.ts").default;
|
|
57
60
|
if (0 /* __FEATURES__.NATIVE_VTT */ === 1 /* __FEATURES__.IS_ENABLED */) {
|
|
@@ -72,11 +75,11 @@ export default function initializeFeaturesObject() {
|
|
|
72
75
|
}
|
|
73
76
|
}
|
|
74
77
|
// Feature switching the HTML TextTrack implementation
|
|
75
|
-
var HAS_HTML_MODE = 0 /* __FEATURES__.HTML_VTT */ ||
|
|
76
|
-
0 /* __FEATURES__.HTML_SAMI */ ||
|
|
77
|
-
0 /* __FEATURES__.HTML_TTML */ ||
|
|
78
|
-
0 /* __FEATURES__.HTML_SRT */;
|
|
79
|
-
if (HAS_HTML_MODE
|
|
78
|
+
var HAS_HTML_MODE = 0 /* __FEATURES__.HTML_VTT */ === 1 /* __FEATURES__.IS_ENABLED */ ||
|
|
79
|
+
0 /* __FEATURES__.HTML_SAMI */ === 1 /* __FEATURES__.IS_ENABLED */ ||
|
|
80
|
+
0 /* __FEATURES__.HTML_TTML */ === 1 /* __FEATURES__.IS_ENABLED */ ||
|
|
81
|
+
0 /* __FEATURES__.HTML_SRT */ === 1 /* __FEATURES__.IS_ENABLED */;
|
|
82
|
+
if (HAS_HTML_MODE) {
|
|
80
83
|
features.htmlTextTracksBuffer =
|
|
81
84
|
require("../core/segment_buffers/implementations/text/html/index.ts").default;
|
|
82
85
|
if (0 /* __FEATURES__.HTML_SAMI */ === 1 /* __FEATURES__.IS_ENABLED */) {
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import RxPlayer from "../core/api";
|
|
16
17
|
import MediaElementTrackChoiceManager from "../core/api/tracks_management/media_element_track_choice_manager";
|
|
17
18
|
import type ContentDecryptor from "../core/decrypt";
|
|
18
19
|
import DirectFileContentInitializer from "../core/init/directfile_content_initializer";
|
|
@@ -21,6 +22,7 @@ import { IDashParserResponse, IMPDParserArguments } from "../parsers/manifest/da
|
|
|
21
22
|
import DashWasmParser from "../parsers/manifest/dash/wasm-parser";
|
|
22
23
|
import { IHTMLTextTracksParserFn, INativeTextTracksParserFn } from "../parsers/texttracks";
|
|
23
24
|
import { ITransportFunction } from "../transports";
|
|
25
|
+
import { CancellationSignal } from "../utils/task_canceller";
|
|
24
26
|
export type IDirectFileInit = typeof DirectFileContentInitializer;
|
|
25
27
|
export type IContentDecryptorClass = typeof ContentDecryptor;
|
|
26
28
|
export type IHTMLTextTracksBuffer = new (mediaElement: HTMLMediaElement, textTrackElement: HTMLElement) => SegmentBuffer;
|
|
@@ -53,6 +55,7 @@ export interface IFeaturesObject {
|
|
|
53
55
|
mediaElementTrackChoiceManager: IMediaElementTrackChoiceManager;
|
|
54
56
|
} | null;
|
|
55
57
|
ContentDecryptor: IContentDecryptorClass | null;
|
|
58
|
+
createDebugElement: ((parentElt: HTMLElement, instance: RxPlayer, cancelSignal: CancellationSignal) => void) | null;
|
|
56
59
|
htmlTextTracksBuffer: IHTMLTextTracksBuffer | null;
|
|
57
60
|
htmlTextTracksParsers: Partial<Record<string, IHTMLTextTracksParserFn>>;
|
|
58
61
|
imageBuffer: IImageBuffer | null;
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import log from "../log";
|
|
16
17
|
import arrayFind from "../utils/array_find";
|
|
17
18
|
import isNullOrUndefined from "../utils/is_null_or_undefined";
|
|
18
19
|
import normalizeLanguage from "../utils/languages";
|
|
@@ -91,6 +92,9 @@ var Adaptation = /** @class */ (function () {
|
|
|
91
92
|
isSupported = true;
|
|
92
93
|
}
|
|
93
94
|
}
|
|
95
|
+
else {
|
|
96
|
+
log.debug("Filtering Representation due to representationFilter", this.type, "Adaptation: ".concat(this.id), "Representation: ".concat(representation.id), "(".concat(representation.bitrate, ")"));
|
|
97
|
+
}
|
|
94
98
|
}
|
|
95
99
|
representations.sort(function (a, b) { return a.bitrate - b.bitrate; });
|
|
96
100
|
this.representations = representations;
|
|
@@ -29,6 +29,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
29
29
|
};
|
|
30
30
|
})();
|
|
31
31
|
import { MediaError } from "../errors";
|
|
32
|
+
import log from "../log";
|
|
32
33
|
import arrayFind from "../utils/array_find";
|
|
33
34
|
import EventEmitter from "../utils/event_emitter";
|
|
34
35
|
import idGenerator from "../utils/id_generator";
|
|
@@ -477,6 +478,7 @@ function updateDeciperability(manifest, isDecipherable) {
|
|
|
477
478
|
var result = isDecipherable(representation);
|
|
478
479
|
if (result !== representation.decipherable) {
|
|
479
480
|
updates.push({ manifest: manifest, period: period, adaptation: adaptation, representation: representation });
|
|
481
|
+
log.debug("Decipherability changed for \"".concat(representation.id, "\""), "(".concat(representation.bitrate, ")"), String(representation.decipherable));
|
|
480
482
|
representation.decipherable = result;
|
|
481
483
|
}
|
|
482
484
|
}
|
|
@@ -48,10 +48,17 @@ var Representation = /** @class */ (function () {
|
|
|
48
48
|
}
|
|
49
49
|
this.cdnMetadata = args.cdnMetadata;
|
|
50
50
|
this.index = args.index;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
isCodecSupported(
|
|
54
|
-
|
|
51
|
+
if (opts.type === "audio" || opts.type === "video") {
|
|
52
|
+
var mimeTypeStr = this.getMimeTypeString();
|
|
53
|
+
var isSupported = isCodecSupported(mimeTypeStr);
|
|
54
|
+
if (!isSupported) {
|
|
55
|
+
log.info("Unsupported Representation", mimeTypeStr, this.id, this.bitrate);
|
|
56
|
+
}
|
|
57
|
+
this.isSupported = isSupported;
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
this.isSupported = true; // TODO for other types
|
|
61
|
+
}
|
|
55
62
|
}
|
|
56
63
|
/**
|
|
57
64
|
* Returns "mime-type string" which includes both the mime-type and the codec,
|