rx-player 3.28.1-dev.2022083000 → 3.29.0-dev.2022090500
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 +11 -1
- package/VERSION +1 -1
- package/dist/_esm5.processed/compat/event_listeners.d.ts +18 -2
- package/dist/_esm5.processed/compat/event_listeners.js +64 -2
- package/dist/_esm5.processed/compat/on_height_width_change.d.ts +5 -4
- package/dist/_esm5.processed/compat/on_height_width_change.js +43 -34
- package/dist/_esm5.processed/core/api/playback_observer.d.ts +12 -2
- package/dist/_esm5.processed/core/api/playback_observer.js +27 -12
- package/dist/_esm5.processed/core/api/public_api.js +14 -14
- package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.d.ts +7 -0
- package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.js +10 -2
- package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.d.ts +8 -1
- package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.js +10 -4
- package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher_creator.d.ts +7 -0
- package/dist/_esm5.processed/core/init/initialize_directfile.js +1 -1
- package/dist/_esm5.processed/core/init/load_on_media_source.js +1 -1
- package/dist/_esm5.processed/core/init/stall_avoider.d.ts +4 -2
- package/dist/_esm5.processed/core/init/stall_avoider.js +32 -26
- package/dist/_esm5.processed/core/segment_buffers/garbage_collector.d.ts +12 -6
- package/dist/_esm5.processed/core/segment_buffers/garbage_collector.js +142 -78
- package/dist/_esm5.processed/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.d.ts +18 -16
- package/dist/_esm5.processed/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.js +53 -41
- package/dist/_esm5.processed/core/segment_buffers/implementations/image/image_segment_buffer.d.ts +6 -5
- package/dist/_esm5.processed/core/segment_buffers/implementations/image/image_segment_buffer.js +37 -39
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/html_text_segment_buffer.d.ts +23 -22
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/html_text_segment_buffer.js +84 -72
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/native_text_segment_buffer.d.ts +6 -12
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/native_text_segment_buffer.js +33 -43
- package/dist/_esm5.processed/core/segment_buffers/implementations/types.d.ts +12 -9
- package/dist/_esm5.processed/core/segment_buffers/segment_buffers_store.d.ts +7 -6
- package/dist/_esm5.processed/core/segment_buffers/segment_buffers_store.js +17 -10
- package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.js +20 -9
- package/dist/_esm5.processed/core/stream/period/period_stream.js +25 -14
- package/dist/_esm5.processed/core/stream/representation/append_segment_to_buffer.d.ts +4 -7
- package/dist/_esm5.processed/core/stream/representation/append_segment_to_buffer.js +80 -23
- package/dist/_esm5.processed/core/stream/representation/force_garbage_collection.d.ts +5 -4
- package/dist/_esm5.processed/core/stream/representation/force_garbage_collection.js +78 -26
- package/dist/_esm5.processed/core/stream/representation/get_buffer_status.js +7 -3
- package/dist/_esm5.processed/core/stream/representation/push_init_segment.js +7 -1
- package/dist/_esm5.processed/core/stream/representation/push_media_segment.js +7 -1
- package/dist/_esm5.processed/core/stream/representation/representation_stream.js +15 -8
- package/dist/_esm5.processed/default_config.js +1 -1
- package/dist/_esm5.processed/errors/custom_loader_error.d.ts +3 -2
- package/dist/_esm5.processed/errors/custom_loader_error.js +3 -2
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/get_initialized_source_buffer.js +5 -2
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/push_data.js +5 -2
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/remove_buffer_around_time.js +9 -2
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/thumbnail_loader.js +3 -1
- package/dist/_esm5.processed/experimental/tools/createMetaplaylist/get_duration_from_manifest.js +4 -3
- package/dist/_esm5.processed/public_types.d.ts +22 -3
- package/dist/_esm5.processed/transports/dash/add_segment_integrity_checks_to_loader.js +2 -2
- package/dist/_esm5.processed/transports/dash/image_pipelines.d.ts +3 -2
- package/dist/_esm5.processed/transports/dash/image_pipelines.js +3 -1
- package/dist/_esm5.processed/transports/dash/init_segment_loader.d.ts +3 -2
- package/dist/_esm5.processed/transports/dash/init_segment_loader.js +12 -6
- package/dist/_esm5.processed/transports/dash/low_latency_segment_loader.d.ts +3 -2
- package/dist/_esm5.processed/transports/dash/low_latency_segment_loader.js +3 -2
- package/dist/_esm5.processed/transports/dash/manifest_parser.js +6 -2
- package/dist/_esm5.processed/transports/dash/segment_loader.d.ts +3 -2
- package/dist/_esm5.processed/transports/dash/segment_loader.js +12 -9
- package/dist/_esm5.processed/transports/dash/text_loader.js +6 -3
- package/dist/_esm5.processed/transports/local/pipelines.d.ts +2 -2
- package/dist/_esm5.processed/transports/local/pipelines.js +6 -6
- package/dist/_esm5.processed/transports/local/segment_loader.d.ts +3 -2
- package/dist/_esm5.processed/transports/local/segment_loader.js +4 -3
- package/dist/_esm5.processed/transports/metaplaylist/manifest_loader.d.ts +2 -2
- package/dist/_esm5.processed/transports/metaplaylist/manifest_loader.js +5 -2
- package/dist/_esm5.processed/transports/metaplaylist/pipelines.js +15 -10
- package/dist/_esm5.processed/transports/smooth/pipelines.d.ts +1 -1
- package/dist/_esm5.processed/transports/smooth/pipelines.js +18 -14
- package/dist/_esm5.processed/transports/smooth/segment_loader.d.ts +2 -2
- package/dist/_esm5.processed/transports/smooth/segment_loader.js +8 -6
- package/dist/_esm5.processed/transports/types.d.ts +25 -2
- package/dist/_esm5.processed/transports/utils/call_custom_manifest_loader.d.ts +2 -2
- package/dist/_esm5.processed/transports/utils/call_custom_manifest_loader.js +3 -3
- package/dist/_esm5.processed/transports/utils/generate_manifest_loader.d.ts +2 -2
- package/dist/_esm5.processed/transports/utils/generate_manifest_loader.js +9 -6
- package/dist/_esm5.processed/utils/request/fetch.js +7 -8
- package/dist/_esm5.processed/utils/request/xhr.d.ts +1 -1
- package/dist/_esm5.processed/utils/request/xhr.js +28 -14
- package/dist/_esm5.processed/utils/task_canceller.d.ts +1 -2
- package/dist/_esm5.processed/utils/task_canceller.js +1 -2
- package/dist/mpd-parser.wasm +0 -0
- package/dist/rx-player.js +1116 -695
- package/dist/rx-player.min.js +1 -1
- package/package.json +7 -7
- package/sonar-project.properties +1 -1
- package/src/compat/event_listeners.ts +86 -1
- package/src/compat/on_height_width_change.ts +48 -49
- package/src/core/api/playback_observer.ts +34 -14
- package/src/core/api/public_api.ts +23 -18
- package/src/core/fetchers/manifest/manifest_fetcher.ts +20 -2
- package/src/core/fetchers/segment/segment_fetcher.ts +23 -3
- package/src/core/fetchers/segment/segment_fetcher_creator.ts +7 -0
- package/src/core/init/initialize_directfile.ts +1 -1
- package/src/core/init/load_on_media_source.ts +1 -0
- package/src/core/init/stall_avoider.ts +40 -26
- package/src/core/segment_buffers/garbage_collector.ts +55 -47
- package/src/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.ts +92 -70
- package/src/core/segment_buffers/implementations/image/image_segment_buffer.ts +37 -42
- package/src/core/segment_buffers/implementations/text/html/html_text_segment_buffer.ts +103 -105
- package/src/core/segment_buffers/implementations/text/native/native_text_segment_buffer.ts +35 -46
- package/src/core/segment_buffers/implementations/types.ts +22 -9
- package/src/core/segment_buffers/segment_buffers_store.ts +23 -14
- package/src/core/stream/orchestrator/stream_orchestrator.ts +31 -12
- package/src/core/stream/period/period_stream.ts +31 -18
- package/src/core/stream/representation/append_segment_to_buffer.ts +27 -42
- package/src/core/stream/representation/force_garbage_collection.ts +28 -32
- package/src/core/stream/representation/get_buffer_status.ts +7 -3
- package/src/core/stream/representation/push_init_segment.ts +12 -6
- package/src/core/stream/representation/push_media_segment.ts +12 -6
- package/src/core/stream/representation/representation_stream.ts +11 -5
- package/src/default_config.ts +17 -17
- package/src/errors/custom_loader_error.ts +3 -2
- package/src/experimental/tools/VideoThumbnailLoader/get_initialized_source_buffer.ts +7 -2
- package/src/experimental/tools/VideoThumbnailLoader/push_data.ts +6 -2
- package/src/experimental/tools/VideoThumbnailLoader/remove_buffer_around_time.ts +10 -2
- package/src/experimental/tools/VideoThumbnailLoader/thumbnail_loader.ts +3 -1
- package/src/experimental/tools/createMetaplaylist/get_duration_from_manifest.ts +4 -3
- package/src/public_types.ts +28 -4
- package/src/transports/dash/add_segment_integrity_checks_to_loader.ts +2 -2
- package/src/transports/dash/image_pipelines.ts +4 -0
- package/src/transports/dash/init_segment_loader.ts +8 -0
- package/src/transports/dash/low_latency_segment_loader.ts +4 -0
- package/src/transports/dash/manifest_parser.ts +4 -0
- package/src/transports/dash/segment_loader.ts +21 -5
- package/src/transports/dash/text_loader.ts +7 -2
- package/src/transports/local/pipelines.ts +7 -5
- package/src/transports/local/segment_loader.ts +4 -2
- package/src/transports/metaplaylist/manifest_loader.ts +9 -2
- package/src/transports/metaplaylist/pipelines.ts +16 -6
- package/src/transports/smooth/pipelines.ts +17 -9
- package/src/transports/smooth/segment_loader.ts +8 -0
- package/src/transports/types.ts +27 -0
- package/src/transports/utils/call_custom_manifest_loader.ts +8 -2
- package/src/transports/utils/generate_manifest_loader.ts +18 -5
- package/src/utils/request/fetch.ts +7 -8
- package/src/utils/request/xhr.ts +31 -15
- package/src/utils/task_canceller.ts +1 -2
package/dist/_esm5.processed/experimental/tools/createMetaplaylist/get_duration_from_manifest.js
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { map, throwError, } from "rxjs";
|
|
17
|
+
import config from "../../../config";
|
|
17
18
|
import isNonEmptyString from "../../../utils/is_non_empty_string";
|
|
18
19
|
import request from "../../../utils/request/xhr";
|
|
19
20
|
import fromCancellablePromise from "../../../utils/rx-from_cancellable_promise";
|
|
@@ -28,9 +29,7 @@ var iso8601Duration = /^P(([\d.]*)Y)?(([\d.]*)M)?(([\d.]*)D)?T?(([\d.]*)H)?(([\d
|
|
|
28
29
|
* 2. the second value is a possible error encountered while parsing this
|
|
29
30
|
* value - set to `null` if no error was encountered.
|
|
30
31
|
* @param {string} val - The value to parse
|
|
31
|
-
* @
|
|
32
|
-
* formatting.
|
|
33
|
-
* @returns {Array.<number | Error | null>}
|
|
32
|
+
* @returns {number | null}
|
|
34
33
|
*/
|
|
35
34
|
function parseDuration(val) {
|
|
36
35
|
if (!isNonEmptyString(val)) {
|
|
@@ -69,6 +68,7 @@ function getDurationFromManifest(url, transport) {
|
|
|
69
68
|
var canceller = new TaskCanceller();
|
|
70
69
|
if (transport === "dash" || transport === "smooth") {
|
|
71
70
|
return fromCancellablePromise(canceller, function () { return request({ url: url, responseType: "document",
|
|
71
|
+
timeout: config.getCurrent().DEFAULT_REQUEST_TIMEOUT,
|
|
72
72
|
cancelSignal: canceller.signal }); }).pipe(map(function (response) {
|
|
73
73
|
var _a;
|
|
74
74
|
var responseData = response.responseData;
|
|
@@ -103,6 +103,7 @@ function getDurationFromManifest(url, transport) {
|
|
|
103
103
|
}
|
|
104
104
|
// metaplaylist
|
|
105
105
|
return fromCancellablePromise(canceller, function () { return request({ url: url, responseType: "text",
|
|
106
|
+
timeout: config.getCurrent().DEFAULT_REQUEST_TIMEOUT,
|
|
106
107
|
cancelSignal: canceller.signal }); }).pipe(map(function (response) {
|
|
107
108
|
var responseData = response.responseData;
|
|
108
109
|
var metaplaylist = JSON.parse(responseData);
|
|
@@ -318,22 +318,39 @@ export interface INetworkConfigOption {
|
|
|
318
318
|
* request before failing on Error.
|
|
319
319
|
* Set to `Infinity` for an infinite number of requests.
|
|
320
320
|
*/
|
|
321
|
-
manifestRetry?: number;
|
|
321
|
+
manifestRetry?: number | undefined;
|
|
322
|
+
/**
|
|
323
|
+
* Amount of time, in milliseconds, after which a manifest request should be
|
|
324
|
+
* aborted and optionally retried, depending on the current configuration.
|
|
325
|
+
*
|
|
326
|
+
* Setting it to `-1` allows to disable any timeout.
|
|
327
|
+
* `undefined` means that a default, large, timeout will be used instead.
|
|
328
|
+
*/
|
|
329
|
+
manifestRequestTimeout?: number | undefined;
|
|
322
330
|
/**
|
|
323
331
|
* The amount of time maximum we should retry a request in general when the
|
|
324
332
|
* user is offline.
|
|
325
333
|
* Set to `Infinity` for an infinite number of requests.
|
|
326
334
|
*/
|
|
327
|
-
offlineRetry?: number;
|
|
335
|
+
offlineRetry?: number | undefined;
|
|
328
336
|
/**
|
|
329
337
|
* The amount of time maximum we should retry a segment or segment-related
|
|
330
338
|
* request before failing on Error.
|
|
331
339
|
* Set to `Infinity` for an infinite number of requests.
|
|
332
340
|
*/
|
|
333
|
-
segmentRetry?: number;
|
|
341
|
+
segmentRetry?: number | undefined;
|
|
342
|
+
/**
|
|
343
|
+
* Amount of time, in milliseconds, after which a segment request should be
|
|
344
|
+
* aborted and optionally retried, depending on the current configuration.
|
|
345
|
+
*
|
|
346
|
+
* Setting it to `-1` allows to disable any timeout.
|
|
347
|
+
* `undefined` means that a default, large, timeout will be used instead.
|
|
348
|
+
*/
|
|
349
|
+
segmentRequestTimeout?: number | undefined;
|
|
334
350
|
}
|
|
335
351
|
export declare type ISegmentLoader = (infos: {
|
|
336
352
|
url: string;
|
|
353
|
+
timeout: number | undefined;
|
|
337
354
|
manifest: IManifest;
|
|
338
355
|
period: IPeriod;
|
|
339
356
|
adaptation: IAdaptation;
|
|
@@ -367,6 +384,8 @@ export declare type IManifestLoader = (url: string | undefined, callbacks: {
|
|
|
367
384
|
}) => void;
|
|
368
385
|
reject: (err?: Error) => void;
|
|
369
386
|
fallback: () => void;
|
|
387
|
+
}, options: {
|
|
388
|
+
timeout: number | undefined;
|
|
370
389
|
}) => (() => void) | void;
|
|
371
390
|
/** Options related to a single key system. */
|
|
372
391
|
export interface IKeySystemOption {
|
|
@@ -35,13 +35,13 @@ import inferSegmentContainer from "../utils/infer_segment_container";
|
|
|
35
35
|
* @returns {Function}
|
|
36
36
|
*/
|
|
37
37
|
export default function addSegmentIntegrityChecks(segmentLoader) {
|
|
38
|
-
return function (url, content, initialCancelSignal, callbacks) {
|
|
38
|
+
return function (url, content, loaderOptions, initialCancelSignal, callbacks) {
|
|
39
39
|
return new Promise(function (resolve, reject) {
|
|
40
40
|
var requestCanceller = new TaskCanceller({ cancelOn: initialCancelSignal });
|
|
41
41
|
// Reject the `CancellationError` when `requestCanceller`'s signal emits
|
|
42
42
|
// `stopRejectingOnCancel` here is a function allowing to stop this mechanism
|
|
43
43
|
var stopRejectingOnCancel = requestCanceller.signal.register(reject);
|
|
44
|
-
segmentLoader(url, content, requestCanceller.signal, __assign(__assign({}, callbacks), { onNewChunk: function (data) {
|
|
44
|
+
segmentLoader(url, content, loaderOptions, requestCanceller.signal, __assign(__assign({}, callbacks), { onNewChunk: function (data) {
|
|
45
45
|
try {
|
|
46
46
|
trowOnIntegrityError(data);
|
|
47
47
|
callbacks.onNewChunk(data);
|
|
@@ -14,16 +14,17 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { CancellationSignal } from "../../utils/task_canceller";
|
|
17
|
-
import { IImageTrackSegmentData, ILoadedImageSegmentFormat, ISegmentContext, ISegmentLoaderCallbacks, ISegmentLoaderResultSegmentCreated, ISegmentLoaderResultSegmentLoaded, ISegmentParserParsedInitChunk, ISegmentParserParsedMediaChunk } from "../types";
|
|
17
|
+
import { IImageTrackSegmentData, ILoadedImageSegmentFormat, ISegmentContext, ISegmentLoaderCallbacks, ISegmentLoaderOptions, ISegmentLoaderResultSegmentCreated, ISegmentLoaderResultSegmentLoaded, ISegmentParserParsedInitChunk, ISegmentParserParsedMediaChunk } from "../types";
|
|
18
18
|
/**
|
|
19
19
|
* Loads an image segment.
|
|
20
20
|
* @param {string|null} url
|
|
21
21
|
* @param {Object} content
|
|
22
|
+
* @param {Object} options
|
|
22
23
|
* @param {Object} cancelSignal
|
|
23
24
|
* @param {Object} callbacks
|
|
24
25
|
* @returns {Promise}
|
|
25
26
|
*/
|
|
26
|
-
export declare function imageLoader(url: string | null, content: ISegmentContext, cancelSignal: CancellationSignal, callbacks: ISegmentLoaderCallbacks<ILoadedImageSegmentFormat>): Promise<ISegmentLoaderResultSegmentLoaded<ILoadedImageSegmentFormat> | ISegmentLoaderResultSegmentCreated<ILoadedImageSegmentFormat>>;
|
|
27
|
+
export declare function imageLoader(url: string | null, content: ISegmentContext, options: ISegmentLoaderOptions, cancelSignal: CancellationSignal, callbacks: ISegmentLoaderCallbacks<ILoadedImageSegmentFormat>): Promise<ISegmentLoaderResultSegmentLoaded<ILoadedImageSegmentFormat> | ISegmentLoaderResultSegmentCreated<ILoadedImageSegmentFormat>>;
|
|
27
28
|
/**
|
|
28
29
|
* Parses an image segment.
|
|
29
30
|
* @param {Object} loadedSegment
|
|
@@ -56,11 +56,12 @@ import takeFirstSet from "../../utils/take_first_set";
|
|
|
56
56
|
* Loads an image segment.
|
|
57
57
|
* @param {string|null} url
|
|
58
58
|
* @param {Object} content
|
|
59
|
+
* @param {Object} options
|
|
59
60
|
* @param {Object} cancelSignal
|
|
60
61
|
* @param {Object} callbacks
|
|
61
62
|
* @returns {Promise}
|
|
62
63
|
*/
|
|
63
|
-
export function imageLoader(url, content, cancelSignal, callbacks) {
|
|
64
|
+
export function imageLoader(url, content, options, cancelSignal, callbacks) {
|
|
64
65
|
return __awaiter(this, void 0, void 0, function () {
|
|
65
66
|
var segment, data;
|
|
66
67
|
return __generator(this, function (_a) {
|
|
@@ -72,6 +73,7 @@ export function imageLoader(url, content, cancelSignal, callbacks) {
|
|
|
72
73
|
resultData: null }];
|
|
73
74
|
}
|
|
74
75
|
return [4 /*yield*/, request({ url: url, responseType: "arraybuffer",
|
|
76
|
+
timeout: options.timeout,
|
|
75
77
|
onProgress: callbacks.onProgress, cancelSignal: cancelSignal })];
|
|
76
78
|
case 1:
|
|
77
79
|
data = _a.sent();
|
|
@@ -15,13 +15,14 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { ISegment } from "../../manifest";
|
|
17
17
|
import { CancellationSignal } from "../../utils/task_canceller";
|
|
18
|
-
import { ISegmentLoaderCallbacks, ISegmentLoaderResultChunkedComplete, ISegmentLoaderResultSegmentCreated, ISegmentLoaderResultSegmentLoaded } from "../types";
|
|
18
|
+
import { ISegmentLoaderCallbacks, ISegmentLoaderOptions, ISegmentLoaderResultChunkedComplete, ISegmentLoaderResultSegmentCreated, ISegmentLoaderResultSegmentLoaded } from "../types";
|
|
19
19
|
/**
|
|
20
20
|
* Perform a request for an initialization segment, agnostic to the container.
|
|
21
21
|
* @param {string} url
|
|
22
22
|
* @param {Object} segment
|
|
23
|
+
* @param {Object} options
|
|
23
24
|
* @param {CancellationSignal} cancelSignal
|
|
24
25
|
* @param {Object} callbacks
|
|
25
26
|
* @returns {Promise}
|
|
26
27
|
*/
|
|
27
|
-
export default function initSegmentLoader(url: string, segment: ISegment, cancelSignal: CancellationSignal, callbacks: ISegmentLoaderCallbacks<ArrayBuffer | Uint8Array>): Promise<ISegmentLoaderResultSegmentLoaded<ArrayBuffer | Uint8Array> | ISegmentLoaderResultSegmentCreated<ArrayBuffer | Uint8Array> | ISegmentLoaderResultChunkedComplete>;
|
|
28
|
+
export default function initSegmentLoader(url: string, segment: ISegment, options: ISegmentLoaderOptions, cancelSignal: CancellationSignal, callbacks: ISegmentLoaderCallbacks<ArrayBuffer | Uint8Array>): Promise<ISegmentLoaderResultSegmentLoaded<ArrayBuffer | Uint8Array> | ISegmentLoaderResultSegmentCreated<ArrayBuffer | Uint8Array> | ISegmentLoaderResultChunkedComplete>;
|
|
@@ -20,19 +20,22 @@ import byteRange from "../utils/byte_range";
|
|
|
20
20
|
* Perform a request for an initialization segment, agnostic to the container.
|
|
21
21
|
* @param {string} url
|
|
22
22
|
* @param {Object} segment
|
|
23
|
+
* @param {Object} options
|
|
23
24
|
* @param {CancellationSignal} cancelSignal
|
|
24
25
|
* @param {Object} callbacks
|
|
25
26
|
* @returns {Promise}
|
|
26
27
|
*/
|
|
27
|
-
export default function initSegmentLoader(url, segment, cancelSignal, callbacks) {
|
|
28
|
+
export default function initSegmentLoader(url, segment, options, cancelSignal, callbacks) {
|
|
28
29
|
if (segment.range === undefined) {
|
|
29
|
-
return request({ url: url, responseType: "arraybuffer",
|
|
30
|
+
return request({ url: url, responseType: "arraybuffer",
|
|
31
|
+
timeout: options.timeout, cancelSignal: cancelSignal, onProgress: callbacks.onProgress })
|
|
30
32
|
.then(function (data) { return ({ resultType: "segment-loaded",
|
|
31
33
|
resultData: data }); });
|
|
32
34
|
}
|
|
33
35
|
if (segment.indexRange === undefined) {
|
|
34
36
|
return request({ url: url, headers: { Range: byteRange(segment.range) },
|
|
35
|
-
responseType: "arraybuffer",
|
|
37
|
+
responseType: "arraybuffer",
|
|
38
|
+
timeout: options.timeout, cancelSignal: cancelSignal, onProgress: callbacks.onProgress })
|
|
36
39
|
.then(function (data) { return ({ resultType: "segment-loaded",
|
|
37
40
|
resultData: data }); });
|
|
38
41
|
}
|
|
@@ -40,14 +43,17 @@ export default function initSegmentLoader(url, segment, cancelSignal, callbacks)
|
|
|
40
43
|
if (segment.range[1] + 1 === segment.indexRange[0]) {
|
|
41
44
|
return request({ url: url, headers: { Range: byteRange([segment.range[0],
|
|
42
45
|
segment.indexRange[1]]) },
|
|
43
|
-
responseType: "arraybuffer",
|
|
46
|
+
responseType: "arraybuffer",
|
|
47
|
+
timeout: options.timeout, cancelSignal: cancelSignal, onProgress: callbacks.onProgress })
|
|
44
48
|
.then(function (data) { return ({ resultType: "segment-loaded",
|
|
45
49
|
resultData: data }); });
|
|
46
50
|
}
|
|
47
51
|
var rangeRequest$ = request({ url: url, headers: { Range: byteRange(segment.range) },
|
|
48
|
-
responseType: "arraybuffer",
|
|
52
|
+
responseType: "arraybuffer",
|
|
53
|
+
timeout: options.timeout, cancelSignal: cancelSignal, onProgress: callbacks.onProgress });
|
|
49
54
|
var indexRequest$ = request({ url: url, headers: { Range: byteRange(segment.indexRange) },
|
|
50
|
-
responseType: "arraybuffer",
|
|
55
|
+
responseType: "arraybuffer",
|
|
56
|
+
timeout: options.timeout, cancelSignal: cancelSignal, onProgress: callbacks.onProgress });
|
|
51
57
|
return Promise.all([rangeRequest$, indexRequest$])
|
|
52
58
|
.then(function (_a) {
|
|
53
59
|
var initData = _a[0], indexData = _a[1];
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { CancellationSignal } from "../../utils/task_canceller";
|
|
17
|
-
import { ISegmentContext, ISegmentLoaderCallbacks, ISegmentLoaderResultChunkedComplete } from "../types";
|
|
17
|
+
import { ISegmentContext, ISegmentLoaderCallbacks, ISegmentLoaderOptions, ISegmentLoaderResultChunkedComplete } from "../types";
|
|
18
18
|
/**
|
|
19
19
|
* Load segments through a "chunk" mode (decodable chunk by decodable chunk).
|
|
20
20
|
*
|
|
@@ -22,8 +22,9 @@ import { ISegmentContext, ISegmentLoaderCallbacks, ISegmentLoaderResultChunkedCo
|
|
|
22
22
|
*
|
|
23
23
|
* @param {string} url - URL of the segment to download.
|
|
24
24
|
* @param {Object} content - Context of the segment needed.
|
|
25
|
+
* @param {Object} options
|
|
25
26
|
* @param {Object} callbacks
|
|
26
27
|
* @param {CancellationSignal} cancelSignal
|
|
27
28
|
* @returns {Promise}
|
|
28
29
|
*/
|
|
29
|
-
export default function lowLatencySegmentLoader(url: string, content: ISegmentContext, callbacks: ISegmentLoaderCallbacks<Uint8Array>, cancelSignal: CancellationSignal): Promise<ISegmentLoaderResultChunkedComplete>;
|
|
30
|
+
export default function lowLatencySegmentLoader(url: string, content: ISegmentContext, options: ISegmentLoaderOptions, callbacks: ISegmentLoaderCallbacks<Uint8Array>, cancelSignal: CancellationSignal): Promise<ISegmentLoaderResultChunkedComplete>;
|
|
@@ -24,11 +24,12 @@ import extractCompleteChunks from "./extract_complete_chunks";
|
|
|
24
24
|
*
|
|
25
25
|
* @param {string} url - URL of the segment to download.
|
|
26
26
|
* @param {Object} content - Context of the segment needed.
|
|
27
|
+
* @param {Object} options
|
|
27
28
|
* @param {Object} callbacks
|
|
28
29
|
* @param {CancellationSignal} cancelSignal
|
|
29
30
|
* @returns {Promise}
|
|
30
31
|
*/
|
|
31
|
-
export default function lowLatencySegmentLoader(url, content, callbacks, cancelSignal) {
|
|
32
|
+
export default function lowLatencySegmentLoader(url, content, options, callbacks, cancelSignal) {
|
|
32
33
|
var segment = content.segment;
|
|
33
34
|
var headers = segment.range !== undefined ? { Range: byteRange(segment.range) } :
|
|
34
35
|
undefined;
|
|
@@ -57,7 +58,7 @@ export default function lowLatencySegmentLoader(url, content, callbacks, cancelS
|
|
|
57
58
|
return;
|
|
58
59
|
}
|
|
59
60
|
}
|
|
60
|
-
return fetchRequest({ url: url, headers: headers, onData: onData, cancelSignal: cancelSignal })
|
|
61
|
+
return fetchRequest({ url: url, headers: headers, onData: onData, timeout: options.timeout, cancelSignal: cancelSignal })
|
|
61
62
|
.then(function (res) { return ({ resultType: "chunk-complete",
|
|
62
63
|
resultData: res }); });
|
|
63
64
|
}
|
|
@@ -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 config from "../../config";
|
|
16
17
|
import { formatError } from "../../errors";
|
|
17
18
|
import features from "../../features";
|
|
18
19
|
import log from "../../log";
|
|
@@ -105,10 +106,13 @@ export default function generateManifestParser(options) {
|
|
|
105
106
|
var value = parserResponse.value;
|
|
106
107
|
var externalResources = value.urls.map(function (resourceUrl) {
|
|
107
108
|
return scheduleRequest(function () {
|
|
109
|
+
var defaultTimeout = config.getCurrent().DEFAULT_REQUEST_TIMEOUT;
|
|
108
110
|
return value.format === "string" ? request({ url: resourceUrl,
|
|
109
|
-
responseType: "text",
|
|
111
|
+
responseType: "text",
|
|
112
|
+
timeout: defaultTimeout, cancelSignal: cancelSignal }) :
|
|
110
113
|
request({ url: resourceUrl,
|
|
111
|
-
responseType: "arraybuffer",
|
|
114
|
+
responseType: "arraybuffer",
|
|
115
|
+
timeout: defaultTimeout, cancelSignal: cancelSignal });
|
|
112
116
|
}).then(function (res) {
|
|
113
117
|
if (value.format === "string") {
|
|
114
118
|
if (typeof res.responseData !== "string") {
|
|
@@ -15,17 +15,18 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { ISegmentLoader as ICustomSegmentLoader } from "../../public_types";
|
|
17
17
|
import { CancellationSignal } from "../../utils/task_canceller";
|
|
18
|
-
import { ILoadedAudioVideoSegmentFormat, ISegmentContext, ISegmentLoader, ISegmentLoaderCallbacks, ISegmentLoaderResultChunkedComplete, ISegmentLoaderResultSegmentCreated, ISegmentLoaderResultSegmentLoaded } from "../types";
|
|
18
|
+
import { ILoadedAudioVideoSegmentFormat, ISegmentContext, ISegmentLoader, ISegmentLoaderCallbacks, ISegmentLoaderOptions, ISegmentLoaderResultChunkedComplete, ISegmentLoaderResultSegmentCreated, ISegmentLoaderResultSegmentLoaded } from "../types";
|
|
19
19
|
/**
|
|
20
20
|
* Segment loader triggered if there was no custom-defined one in the API.
|
|
21
21
|
* @param {string} url
|
|
22
22
|
* @param {Object} content
|
|
23
23
|
* @param {boolean} lowLatencyMode
|
|
24
|
+
* @param {Object} options
|
|
24
25
|
* @param {Object} callbacks
|
|
25
26
|
* @param {Object} cancelSignal
|
|
26
27
|
* @returns {Promise}
|
|
27
28
|
*/
|
|
28
|
-
export declare function regularSegmentLoader(url: string, content: ISegmentContext, lowLatencyMode: boolean, callbacks: ISegmentLoaderCallbacks<ILoadedAudioVideoSegmentFormat>, cancelSignal: CancellationSignal): Promise<ISegmentLoaderResultSegmentLoaded<ILoadedAudioVideoSegmentFormat> | ISegmentLoaderResultSegmentCreated<ILoadedAudioVideoSegmentFormat> | ISegmentLoaderResultChunkedComplete>;
|
|
29
|
+
export declare function regularSegmentLoader(url: string, content: ISegmentContext, lowLatencyMode: boolean, options: ISegmentLoaderOptions, callbacks: ISegmentLoaderCallbacks<ILoadedAudioVideoSegmentFormat>, cancelSignal: CancellationSignal): Promise<ISegmentLoaderResultSegmentLoaded<ILoadedAudioVideoSegmentFormat> | ISegmentLoaderResultSegmentCreated<ILoadedAudioVideoSegmentFormat> | ISegmentLoaderResultChunkedComplete>;
|
|
29
30
|
/**
|
|
30
31
|
* @param {Object} config
|
|
31
32
|
* @returns {Function}
|
|
@@ -26,18 +26,19 @@ import lowLatencySegmentLoader from "./low_latency_segment_loader";
|
|
|
26
26
|
* @param {string} url
|
|
27
27
|
* @param {Object} content
|
|
28
28
|
* @param {boolean} lowLatencyMode
|
|
29
|
+
* @param {Object} options
|
|
29
30
|
* @param {Object} callbacks
|
|
30
31
|
* @param {Object} cancelSignal
|
|
31
32
|
* @returns {Promise}
|
|
32
33
|
*/
|
|
33
|
-
export function regularSegmentLoader(url, content, lowLatencyMode, callbacks, cancelSignal) {
|
|
34
|
+
export function regularSegmentLoader(url, content, lowLatencyMode, options, callbacks, cancelSignal) {
|
|
34
35
|
if (content.segment.isInit) {
|
|
35
|
-
return initSegmentLoader(url, content.segment, cancelSignal, callbacks);
|
|
36
|
+
return initSegmentLoader(url, content.segment, options, cancelSignal, callbacks);
|
|
36
37
|
}
|
|
37
38
|
var containerType = inferSegmentContainer(content.adaptation.type, content.representation);
|
|
38
39
|
if (lowLatencyMode && (containerType === "mp4" || containerType === undefined)) {
|
|
39
40
|
if (fetchIsSupported()) {
|
|
40
|
-
return lowLatencySegmentLoader(url, content, callbacks, cancelSignal);
|
|
41
|
+
return lowLatencySegmentLoader(url, content, options, callbacks, cancelSignal);
|
|
41
42
|
}
|
|
42
43
|
else {
|
|
43
44
|
warnOnce("DASH: Your browser does not have the fetch API. You will have " +
|
|
@@ -48,7 +49,8 @@ export function regularSegmentLoader(url, content, lowLatencyMode, callbacks, ca
|
|
|
48
49
|
return request({ url: url, responseType: "arraybuffer",
|
|
49
50
|
headers: segment.range !== undefined ?
|
|
50
51
|
{ Range: byteRange(segment.range) } :
|
|
51
|
-
undefined,
|
|
52
|
+
undefined,
|
|
53
|
+
timeout: options.timeout, cancelSignal: cancelSignal, onProgress: callbacks.onProgress })
|
|
52
54
|
.then(function (data) { return ({ resultType: "segment-loaded",
|
|
53
55
|
resultData: data }); });
|
|
54
56
|
}
|
|
@@ -64,26 +66,27 @@ export default function generateSegmentLoader(_a) {
|
|
|
64
66
|
* @param {Object} content
|
|
65
67
|
* @returns {Observable}
|
|
66
68
|
*/
|
|
67
|
-
function segmentLoader(url, content, cancelSignal, callbacks) {
|
|
69
|
+
function segmentLoader(url, content, options, cancelSignal, callbacks) {
|
|
68
70
|
if (url == null) {
|
|
69
71
|
return Promise.resolve({ resultType: "segment-created",
|
|
70
72
|
resultData: null });
|
|
71
73
|
}
|
|
72
74
|
if (lowLatencyMode || customSegmentLoader === undefined) {
|
|
73
|
-
return regularSegmentLoader(url, content, lowLatencyMode, callbacks, cancelSignal);
|
|
75
|
+
return regularSegmentLoader(url, content, lowLatencyMode, options, callbacks, cancelSignal);
|
|
74
76
|
}
|
|
75
77
|
var args = { adaptation: content.adaptation,
|
|
76
78
|
manifest: content.manifest,
|
|
77
79
|
period: content.period,
|
|
78
80
|
representation: content.representation,
|
|
79
81
|
segment: content.segment,
|
|
80
|
-
transport: "dash",
|
|
82
|
+
transport: "dash",
|
|
83
|
+
timeout: options.timeout, url: url };
|
|
81
84
|
return new Promise(function (res, rej) {
|
|
82
85
|
/** `true` when the custom segmentLoader should not be active anymore. */
|
|
83
86
|
var hasFinished = false;
|
|
84
87
|
/**
|
|
85
88
|
* Callback triggered when the custom segment loader has a response.
|
|
86
|
-
* @param {Object}
|
|
89
|
+
* @param {Object} _args
|
|
87
90
|
*/
|
|
88
91
|
var resolve = function (_args) {
|
|
89
92
|
if (hasFinished || cancelSignal.isCancelled) {
|
|
@@ -132,7 +135,7 @@ export default function generateSegmentLoader(_a) {
|
|
|
132
135
|
}
|
|
133
136
|
hasFinished = true;
|
|
134
137
|
cancelSignal.deregister(abortCustomLoader);
|
|
135
|
-
regularSegmentLoader(url, content, lowLatencyMode, callbacks, cancelSignal)
|
|
138
|
+
regularSegmentLoader(url, content, lowLatencyMode, options, callbacks, cancelSignal)
|
|
136
139
|
.then(res, rej);
|
|
137
140
|
};
|
|
138
141
|
var customCallbacks = { reject: reject, resolve: resolve, progress: progress, fallback: fallback };
|
|
@@ -32,11 +32,12 @@ export default function generateTextTrackLoader(_a) {
|
|
|
32
32
|
/**
|
|
33
33
|
* @param {string|null} url
|
|
34
34
|
* @param {Object} content
|
|
35
|
+
* @param {Object} options
|
|
35
36
|
* @param {Object} cancelSignal
|
|
36
37
|
* @param {Object} callbacks
|
|
37
38
|
* @returns {Promise}
|
|
38
39
|
*/
|
|
39
|
-
function textTrackLoader(url, content, cancelSignal, callbacks) {
|
|
40
|
+
function textTrackLoader(url, content, options, cancelSignal, callbacks) {
|
|
40
41
|
var adaptation = content.adaptation, representation = content.representation, segment = content.segment;
|
|
41
42
|
var range = segment.range;
|
|
42
43
|
if (url === null) {
|
|
@@ -44,13 +45,13 @@ export default function generateTextTrackLoader(_a) {
|
|
|
44
45
|
resultData: null });
|
|
45
46
|
}
|
|
46
47
|
if (segment.isInit) {
|
|
47
|
-
return initSegmentLoader(url, segment, cancelSignal, callbacks);
|
|
48
|
+
return initSegmentLoader(url, segment, options, cancelSignal, callbacks);
|
|
48
49
|
}
|
|
49
50
|
var containerType = inferSegmentContainer(adaptation.type, representation);
|
|
50
51
|
var seemsToBeMP4 = containerType === "mp4" || containerType === undefined;
|
|
51
52
|
if (lowLatencyMode && seemsToBeMP4) {
|
|
52
53
|
if (fetchIsSupported()) {
|
|
53
|
-
return lowLatencySegmentLoader(url, content, callbacks, cancelSignal);
|
|
54
|
+
return lowLatencySegmentLoader(url, content, options, callbacks, cancelSignal);
|
|
54
55
|
}
|
|
55
56
|
else {
|
|
56
57
|
warnOnce("DASH: Your browser does not have the fetch API. You will have " +
|
|
@@ -62,6 +63,7 @@ export default function generateTextTrackLoader(_a) {
|
|
|
62
63
|
headers: Array.isArray(range) ?
|
|
63
64
|
{ Range: byteRange(range) } :
|
|
64
65
|
null,
|
|
66
|
+
timeout: options.timeout,
|
|
65
67
|
onProgress: callbacks.onProgress, cancelSignal: cancelSignal })
|
|
66
68
|
.then(function (data) { return ({ resultType: "segment-loaded",
|
|
67
69
|
resultData: data }); });
|
|
@@ -70,6 +72,7 @@ export default function generateTextTrackLoader(_a) {
|
|
|
70
72
|
headers: Array.isArray(range) ?
|
|
71
73
|
{ Range: byteRange(range) } :
|
|
72
74
|
null,
|
|
75
|
+
timeout: options.timeout,
|
|
73
76
|
onProgress: callbacks.onProgress, cancelSignal: cancelSignal })
|
|
74
77
|
.then(function (data) { return ({ resultType: "segment-loaded",
|
|
75
78
|
resultData: data }); });
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
import { ITransportOptions, ITransportPipelines } from "../types";
|
|
17
17
|
/**
|
|
18
18
|
* Returns pipelines used for local Manifest streaming.
|
|
19
|
-
* @param {Object}
|
|
19
|
+
* @param {Object} transportOptions
|
|
20
20
|
* @returns {Object}
|
|
21
21
|
*/
|
|
22
|
-
export default function getLocalManifestPipelines(
|
|
22
|
+
export default function getLocalManifestPipelines(transportOptions: ITransportOptions): ITransportPipelines;
|
|
@@ -26,13 +26,13 @@ import segmentParser from "./segment_parser";
|
|
|
26
26
|
import textTrackParser from "./text_parser";
|
|
27
27
|
/**
|
|
28
28
|
* Returns pipelines used for local Manifest streaming.
|
|
29
|
-
* @param {Object}
|
|
29
|
+
* @param {Object} transportOptions
|
|
30
30
|
* @returns {Object}
|
|
31
31
|
*/
|
|
32
|
-
export default function getLocalManifestPipelines(
|
|
33
|
-
var customManifestLoader =
|
|
32
|
+
export default function getLocalManifestPipelines(transportOptions) {
|
|
33
|
+
var customManifestLoader = transportOptions.manifestLoader;
|
|
34
34
|
var manifestPipeline = {
|
|
35
|
-
loadManifest: function (url, cancelSignal) {
|
|
35
|
+
loadManifest: function (url, loaderOptions, cancelSignal) {
|
|
36
36
|
if (isNullOrUndefined(customManifestLoader)) {
|
|
37
37
|
throw new Error("A local Manifest is not loadable through regular HTTP(S) " +
|
|
38
38
|
" calls. You have to set a `manifestLoader` when calling " +
|
|
@@ -41,7 +41,7 @@ export default function getLocalManifestPipelines(options) {
|
|
|
41
41
|
return callCustomManifestLoader(customManifestLoader, function () {
|
|
42
42
|
throw new Error("Cannot fallback from the `manifestLoader` of a " +
|
|
43
43
|
"`local` transport");
|
|
44
|
-
})(url, cancelSignal);
|
|
44
|
+
})(url, loaderOptions, cancelSignal);
|
|
45
45
|
},
|
|
46
46
|
parseManifest: function (manifestData) {
|
|
47
47
|
var loadedManifest = manifestData.responseData;
|
|
@@ -49,7 +49,7 @@ export default function getLocalManifestPipelines(options) {
|
|
|
49
49
|
throw new Error("Wrong format for the manifest data");
|
|
50
50
|
}
|
|
51
51
|
var parsed = parseLocalManifest(loadedManifest);
|
|
52
|
-
var manifest = new Manifest(parsed,
|
|
52
|
+
var manifest = new Manifest(parsed, transportOptions);
|
|
53
53
|
return { manifest: manifest, url: undefined };
|
|
54
54
|
},
|
|
55
55
|
};
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { CancellationSignal } from "../../utils/task_canceller";
|
|
17
|
-
import { ISegmentContext, ISegmentLoaderCallbacks, ISegmentLoaderResultSegmentLoaded } from "../types";
|
|
17
|
+
import { ISegmentContext, ISegmentLoaderCallbacks, ISegmentLoaderOptions, ISegmentLoaderResultSegmentLoaded } from "../types";
|
|
18
18
|
/**
|
|
19
19
|
* Generic segment loader for the local Manifest.
|
|
20
20
|
* @param {string | null} _url
|
|
@@ -23,4 +23,5 @@ import { ISegmentContext, ISegmentLoaderCallbacks, ISegmentLoaderResultSegmentLo
|
|
|
23
23
|
* @param {Object} _callbacks
|
|
24
24
|
* @returns {Promise}
|
|
25
25
|
*/
|
|
26
|
-
export default function segmentLoader(_url: string | null, content: ISegmentContext,
|
|
26
|
+
export default function segmentLoader(_url: string | null, content: ISegmentContext, _loaderOptions: ISegmentLoaderOptions, // TODO use timeout?
|
|
27
|
+
cancelSignal: CancellationSignal, _callbacks: ISegmentLoaderCallbacks<ArrayBuffer | null>): Promise<ISegmentLoaderResultSegmentLoaded<ArrayBuffer | null>>;
|
|
@@ -26,7 +26,7 @@ function loadInitSegment(customSegmentLoader, cancelSignal) {
|
|
|
26
26
|
var hasFinished = false;
|
|
27
27
|
/**
|
|
28
28
|
* Callback triggered when the custom segment loader has a response.
|
|
29
|
-
* @param {Object}
|
|
29
|
+
* @param {Object} _args
|
|
30
30
|
*/
|
|
31
31
|
var resolve = function (_args) {
|
|
32
32
|
if (hasFinished || cancelSignal.isCancelled) {
|
|
@@ -81,7 +81,7 @@ function loadSegment(segment, customSegmentLoader, cancelSignal) {
|
|
|
81
81
|
var hasFinished = false;
|
|
82
82
|
/**
|
|
83
83
|
* Callback triggered when the custom segment loader has a response.
|
|
84
|
-
* @param {Object}
|
|
84
|
+
* @param {Object} _args
|
|
85
85
|
*/
|
|
86
86
|
var resolve = function (_args) {
|
|
87
87
|
if (hasFinished || cancelSignal.isCancelled) {
|
|
@@ -138,7 +138,8 @@ function loadSegment(segment, customSegmentLoader, cancelSignal) {
|
|
|
138
138
|
* @param {Object} _callbacks
|
|
139
139
|
* @returns {Promise}
|
|
140
140
|
*/
|
|
141
|
-
export default function segmentLoader(_url, content,
|
|
141
|
+
export default function segmentLoader(_url, content, _loaderOptions, // TODO use timeout?
|
|
142
|
+
cancelSignal, _callbacks) {
|
|
142
143
|
var segment = content.segment;
|
|
143
144
|
var privateInfos = segment.privateInfos;
|
|
144
145
|
if (segment.isInit) {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { IManifestLoader, ILoadedManifestFormat } from "../../public_types";
|
|
17
17
|
import { CancellationSignal } from "../../utils/task_canceller";
|
|
18
|
-
import { IRequestedData } from "../types";
|
|
18
|
+
import { IManifestLoaderOptions, IRequestedData } from "../types";
|
|
19
19
|
/**
|
|
20
20
|
* Generate a manifest loader for the application
|
|
21
21
|
* @param {Function} [customManifestLoader]
|
|
@@ -23,4 +23,4 @@ import { IRequestedData } from "../types";
|
|
|
23
23
|
*/
|
|
24
24
|
export default function generateManifestLoader({ customManifestLoader }: {
|
|
25
25
|
customManifestLoader?: IManifestLoader | undefined;
|
|
26
|
-
}): (url: string | undefined, cancelSignal: CancellationSignal) => Promise<IRequestedData<ILoadedManifestFormat>>;
|
|
26
|
+
}): (url: string | undefined, loaderOptions: IManifestLoaderOptions, cancelSignal: CancellationSignal) => Promise<IRequestedData<ILoadedManifestFormat>>;
|
|
@@ -18,12 +18,15 @@ import callCustomManifestLoader from "../utils/call_custom_manifest_loader";
|
|
|
18
18
|
/**
|
|
19
19
|
* Manifest loader triggered if there was no custom-defined one in the API.
|
|
20
20
|
* @param {string} url
|
|
21
|
+
* @param {Object} loaderOptions
|
|
22
|
+
* @param {Object} cancelSignal
|
|
21
23
|
*/
|
|
22
|
-
function regularManifestLoader(url, cancelSignal) {
|
|
24
|
+
function regularManifestLoader(url, loaderOptions, cancelSignal) {
|
|
23
25
|
if (url === undefined) {
|
|
24
26
|
throw new Error("Cannot perform HTTP(s) request. URL not known");
|
|
25
27
|
}
|
|
26
|
-
return request({ url: url, responseType: "text",
|
|
28
|
+
return request({ url: url, responseType: "text",
|
|
29
|
+
timeout: loaderOptions.timeout, cancelSignal: cancelSignal });
|
|
27
30
|
}
|
|
28
31
|
/**
|
|
29
32
|
* Generate a manifest loader for the application
|
|
@@ -24,6 +24,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
24
24
|
};
|
|
25
25
|
return __assign.apply(this, arguments);
|
|
26
26
|
};
|
|
27
|
+
import config from "../../config";
|
|
27
28
|
import features from "../../features";
|
|
28
29
|
import Manifest from "../../manifest";
|
|
29
30
|
import parseMetaPlaylist from "../../parsers/manifest/metaplaylist";
|
|
@@ -106,7 +107,12 @@ export default function (options) {
|
|
|
106
107
|
return transport.manifest.parseManifest(data, __assign(__assign({}, parserOptions), { originalUrl: resource.url }), onWarnings, cancelSignal, scheduleRequest);
|
|
107
108
|
});
|
|
108
109
|
function loadSubManifest() {
|
|
109
|
-
|
|
110
|
+
/*
|
|
111
|
+
* Whether a ManifestLoader's timeout should be relied on here
|
|
112
|
+
* is ambiguous.
|
|
113
|
+
*/
|
|
114
|
+
var manOpts = { timeout: config.getCurrent().DEFAULT_REQUEST_TIMEOUT };
|
|
115
|
+
return transport.manifest.loadManifest(resource.url, manOpts, cancelSignal);
|
|
110
116
|
}
|
|
111
117
|
});
|
|
112
118
|
return Promise.all(loaderProms).then(function (parsedReqs) {
|
|
@@ -118,7 +124,6 @@ export default function (options) {
|
|
|
118
124
|
};
|
|
119
125
|
/**
|
|
120
126
|
* @param {Object} segment
|
|
121
|
-
* @param {Object} transports
|
|
122
127
|
* @returns {Object}
|
|
123
128
|
*/
|
|
124
129
|
function getTransportPipelinesFromSegment(segment) {
|
|
@@ -162,11 +167,11 @@ export default function (options) {
|
|
|
162
167
|
appendWindow: [offsetedWindowStart, offsetedWindowEnd] };
|
|
163
168
|
}
|
|
164
169
|
var audioPipeline = {
|
|
165
|
-
loadSegment: function (url, content, cancelToken, callbacks) {
|
|
170
|
+
loadSegment: function (url, content, loaderOptions, cancelToken, callbacks) {
|
|
166
171
|
var segment = content.segment;
|
|
167
172
|
var audio = getTransportPipelinesFromSegment(segment).audio;
|
|
168
173
|
var ogContent = getOriginalContent(segment);
|
|
169
|
-
return audio.loadSegment(url, ogContent, cancelToken, callbacks);
|
|
174
|
+
return audio.loadSegment(url, ogContent, loaderOptions, cancelToken, callbacks);
|
|
170
175
|
},
|
|
171
176
|
parseSegment: function (loadedSegment, content, initTimescale) {
|
|
172
177
|
var segment = content.segment;
|
|
@@ -182,11 +187,11 @@ export default function (options) {
|
|
|
182
187
|
},
|
|
183
188
|
};
|
|
184
189
|
var videoPipeline = {
|
|
185
|
-
loadSegment: function (url, content, cancelToken, callbacks) {
|
|
190
|
+
loadSegment: function (url, content, loaderOptions, cancelToken, callbacks) {
|
|
186
191
|
var segment = content.segment;
|
|
187
192
|
var video = getTransportPipelinesFromSegment(segment).video;
|
|
188
193
|
var ogContent = getOriginalContent(segment);
|
|
189
|
-
return video.loadSegment(url, ogContent, cancelToken, callbacks);
|
|
194
|
+
return video.loadSegment(url, ogContent, loaderOptions, cancelToken, callbacks);
|
|
190
195
|
},
|
|
191
196
|
parseSegment: function (loadedSegment, content, initTimescale) {
|
|
192
197
|
var segment = content.segment;
|
|
@@ -202,11 +207,11 @@ export default function (options) {
|
|
|
202
207
|
},
|
|
203
208
|
};
|
|
204
209
|
var textTrackPipeline = {
|
|
205
|
-
loadSegment: function (url, content, cancelToken, callbacks) {
|
|
210
|
+
loadSegment: function (url, content, loaderOptions, cancelToken, callbacks) {
|
|
206
211
|
var segment = content.segment;
|
|
207
212
|
var text = getTransportPipelinesFromSegment(segment).text;
|
|
208
213
|
var ogContent = getOriginalContent(segment);
|
|
209
|
-
return text.loadSegment(url, ogContent, cancelToken, callbacks);
|
|
214
|
+
return text.loadSegment(url, ogContent, loaderOptions, cancelToken, callbacks);
|
|
210
215
|
},
|
|
211
216
|
parseSegment: function (loadedSegment, content, initTimescale) {
|
|
212
217
|
var segment = content.segment;
|
|
@@ -222,11 +227,11 @@ export default function (options) {
|
|
|
222
227
|
},
|
|
223
228
|
};
|
|
224
229
|
var imageTrackPipeline = {
|
|
225
|
-
loadSegment: function (url, content, cancelToken, callbacks) {
|
|
230
|
+
loadSegment: function (url, content, loaderOptions, cancelToken, callbacks) {
|
|
226
231
|
var segment = content.segment;
|
|
227
232
|
var image = getTransportPipelinesFromSegment(segment).image;
|
|
228
233
|
var ogContent = getOriginalContent(segment);
|
|
229
|
-
return image.loadSegment(url, ogContent, cancelToken, callbacks);
|
|
234
|
+
return image.loadSegment(url, ogContent, loaderOptions, cancelToken, callbacks);
|
|
230
235
|
},
|
|
231
236
|
parseSegment: function (loadedSegment, content, initTimescale) {
|
|
232
237
|
var segment = content.segment;
|