rx-player 4.1.0-dev.2024061700 → 4.1.0
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 +5 -1
- package/VERSION +1 -1
- package/dist/commonjs/__GENERATED_CODE/embedded_worker.d.ts.map +1 -1
- package/dist/commonjs/__GENERATED_CODE/embedded_worker.js +1 -1
- package/dist/commonjs/core/main/common/content_time_boundaries_observer.js +41 -19
- package/dist/commonjs/core/segment_sinks/garbage_collector.js +44 -24
- package/dist/commonjs/core/segment_sinks/inventory/utils.js +25 -3
- package/dist/commonjs/errors/custom_loader_error.d.ts +0 -1
- package/dist/commonjs/errors/custom_loader_error.d.ts.map +1 -1
- package/dist/commonjs/errors/custom_loader_error.js +1 -2
- package/dist/commonjs/errors/encrypted_media_error.d.ts +0 -1
- package/dist/commonjs/errors/encrypted_media_error.d.ts.map +1 -1
- package/dist/commonjs/errors/encrypted_media_error.js +1 -2
- package/dist/commonjs/errors/media_error.d.ts +0 -1
- package/dist/commonjs/errors/media_error.d.ts.map +1 -1
- package/dist/commonjs/errors/media_error.js +1 -2
- package/dist/commonjs/errors/network_error.d.ts +0 -1
- package/dist/commonjs/errors/network_error.d.ts.map +1 -1
- package/dist/commonjs/errors/network_error.js +1 -2
- package/dist/commonjs/errors/other_error.d.ts +0 -1
- package/dist/commonjs/errors/other_error.d.ts.map +1 -1
- package/dist/commonjs/errors/other_error.js +1 -2
- package/dist/commonjs/errors/source_buffer_error.d.ts +0 -1
- package/dist/commonjs/errors/source_buffer_error.d.ts.map +1 -1
- package/dist/commonjs/errors/source_buffer_error.js +1 -2
- package/dist/commonjs/errors/worker_initialization_error.d.ts +0 -1
- package/dist/commonjs/errors/worker_initialization_error.d.ts.map +1 -1
- package/dist/commonjs/errors/worker_initialization_error.js +1 -2
- package/dist/commonjs/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader_error.d.ts +0 -1
- package/dist/commonjs/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader_error.d.ts.map +1 -1
- package/dist/commonjs/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader_error.js +2 -2
- package/dist/commonjs/main_thread/api/debug/buffer_graph.js +48 -15
- package/dist/commonjs/main_thread/api/debug/modules/segment_buffer_content.d.ts.map +1 -1
- package/dist/commonjs/main_thread/api/debug/modules/segment_buffer_content.js +38 -17
- package/dist/commonjs/main_thread/api/public_api.js +2 -2
- package/dist/commonjs/main_thread/decrypt/session_events_listener.js +2 -2
- package/dist/commonjs/main_thread/decrypt/utils/check_key_statuses.js +1 -1
- package/dist/commonjs/main_thread/init/multi_thread_content_initializer.js +19 -9
- package/dist/commonjs/main_thread/init/utils/rebuffering_controller.js +48 -26
- package/dist/commonjs/main_thread/init/utils/stream_events_emitter/refresh_scheduled_events_list.d.ts.map +1 -1
- package/dist/commonjs/main_thread/init/utils/stream_events_emitter/refresh_scheduled_events_list.js +85 -54
- package/dist/commonjs/main_thread/text_displayer/html/html_text_displayer.d.ts.map +1 -1
- package/dist/commonjs/main_thread/text_displayer/html/html_text_displayer.js +65 -12
- package/dist/commonjs/main_thread/text_displayer/html/text_track_cues_store.js +39 -7
- package/dist/commonjs/main_thread/text_displayer/native/native_text_displayer.js +27 -5
- package/dist/commonjs/parsers/containers/isobmff/utils.d.ts.map +1 -1
- package/dist/commonjs/parsers/containers/isobmff/utils.js +3 -1
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/utils.d.ts +0 -1
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/utils.d.ts.map +1 -1
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/utils.js +1 -2
- package/dist/commonjs/parsers/manifest/dash/native-parser/node_parsers/utils.d.ts +0 -1
- package/dist/commonjs/parsers/manifest/dash/native-parser/node_parsers/utils.d.ts.map +1 -1
- package/dist/commonjs/parsers/manifest/dash/native-parser/node_parsers/utils.js +1 -2
- package/dist/commonjs/playback_observer/utils/observation_position.d.ts +11 -0
- package/dist/commonjs/playback_observer/utils/observation_position.d.ts.map +1 -1
- package/dist/commonjs/playback_observer/utils/observation_position.js +11 -0
- package/dist/commonjs/transports/dash/low_latency_segment_loader.d.ts.map +1 -1
- package/dist/commonjs/transports/dash/low_latency_segment_loader.js +1 -0
- package/dist/commonjs/utils/assert.d.ts +0 -1
- package/dist/commonjs/utils/assert.d.ts.map +1 -1
- package/dist/commonjs/utils/assert.js +1 -2
- package/dist/commonjs/utils/request/fetch.d.ts.map +1 -1
- package/dist/commonjs/utils/request/fetch.js +14 -0
- package/dist/commonjs/utils/request/request_error.d.ts +0 -1
- package/dist/commonjs/utils/request/request_error.d.ts.map +1 -1
- package/dist/commonjs/utils/request/request_error.js +14 -12
- package/dist/commonjs/utils/request/xhr.d.ts.map +1 -1
- package/dist/commonjs/utils/request/xhr.js +17 -0
- package/dist/commonjs/utils/task_canceller.d.ts +0 -1
- package/dist/commonjs/utils/task_canceller.d.ts.map +1 -1
- package/dist/commonjs/utils/task_canceller.js +3 -2
- package/dist/es2017/__GENERATED_CODE/embedded_worker.d.ts.map +1 -1
- package/dist/es2017/__GENERATED_CODE/embedded_worker.js +1 -1
- package/dist/es2017/core/main/common/content_time_boundaries_observer.js +6 -6
- package/dist/es2017/core/segment_sinks/garbage_collector.js +2 -4
- package/dist/es2017/core/segment_sinks/inventory/utils.js +3 -3
- package/dist/es2017/errors/custom_loader_error.d.ts +0 -1
- package/dist/es2017/errors/custom_loader_error.d.ts.map +1 -1
- package/dist/es2017/errors/custom_loader_error.js +1 -2
- package/dist/es2017/errors/encrypted_media_error.d.ts +0 -1
- package/dist/es2017/errors/encrypted_media_error.d.ts.map +1 -1
- package/dist/es2017/errors/encrypted_media_error.js +1 -2
- package/dist/es2017/errors/media_error.d.ts +0 -1
- package/dist/es2017/errors/media_error.d.ts.map +1 -1
- package/dist/es2017/errors/media_error.js +1 -2
- package/dist/es2017/errors/network_error.d.ts +0 -1
- package/dist/es2017/errors/network_error.d.ts.map +1 -1
- package/dist/es2017/errors/network_error.js +1 -2
- package/dist/es2017/errors/other_error.d.ts +0 -1
- package/dist/es2017/errors/other_error.d.ts.map +1 -1
- package/dist/es2017/errors/other_error.js +1 -2
- package/dist/es2017/errors/source_buffer_error.d.ts +0 -1
- package/dist/es2017/errors/source_buffer_error.d.ts.map +1 -1
- package/dist/es2017/errors/source_buffer_error.js +1 -2
- package/dist/es2017/errors/worker_initialization_error.d.ts +0 -1
- package/dist/es2017/errors/worker_initialization_error.d.ts.map +1 -1
- package/dist/es2017/errors/worker_initialization_error.js +1 -2
- package/dist/es2017/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader_error.d.ts +0 -1
- package/dist/es2017/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader_error.d.ts.map +1 -1
- package/dist/es2017/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader_error.js +2 -2
- package/dist/es2017/main_thread/api/debug/buffer_graph.js +6 -6
- package/dist/es2017/main_thread/api/debug/modules/segment_buffer_content.d.ts.map +1 -1
- package/dist/es2017/main_thread/api/debug/modules/segment_buffer_content.js +1 -2
- package/dist/es2017/main_thread/api/public_api.js +2 -2
- package/dist/es2017/main_thread/decrypt/session_events_listener.js +2 -2
- package/dist/es2017/main_thread/decrypt/utils/check_key_statuses.js +1 -1
- package/dist/es2017/main_thread/init/multi_thread_content_initializer.js +1 -2
- package/dist/es2017/main_thread/init/utils/rebuffering_controller.js +3 -3
- package/dist/es2017/main_thread/init/utils/stream_events_emitter/refresh_scheduled_events_list.d.ts.map +1 -1
- package/dist/es2017/main_thread/init/utils/stream_events_emitter/refresh_scheduled_events_list.js +2 -4
- package/dist/es2017/main_thread/text_displayer/html/html_text_displayer.d.ts.map +1 -1
- package/dist/es2017/main_thread/text_displayer/html/html_text_displayer.js +7 -8
- package/dist/es2017/main_thread/text_displayer/html/text_track_cues_store.js +7 -7
- package/dist/es2017/main_thread/text_displayer/native/native_text_displayer.js +2 -2
- package/dist/es2017/parsers/containers/isobmff/utils.d.ts.map +1 -1
- package/dist/es2017/parsers/containers/isobmff/utils.js +3 -1
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/utils.d.ts +0 -1
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/utils.d.ts.map +1 -1
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/utils.js +1 -2
- package/dist/es2017/parsers/manifest/dash/native-parser/node_parsers/utils.d.ts +0 -1
- package/dist/es2017/parsers/manifest/dash/native-parser/node_parsers/utils.d.ts.map +1 -1
- package/dist/es2017/parsers/manifest/dash/native-parser/node_parsers/utils.js +1 -2
- package/dist/es2017/playback_observer/utils/observation_position.d.ts +11 -0
- package/dist/es2017/playback_observer/utils/observation_position.d.ts.map +1 -1
- package/dist/es2017/playback_observer/utils/observation_position.js +11 -0
- package/dist/es2017/transports/dash/low_latency_segment_loader.d.ts.map +1 -1
- package/dist/es2017/transports/dash/low_latency_segment_loader.js +1 -0
- package/dist/es2017/utils/assert.d.ts +0 -1
- package/dist/es2017/utils/assert.d.ts.map +1 -1
- package/dist/es2017/utils/assert.js +1 -2
- package/dist/es2017/utils/request/fetch.d.ts.map +1 -1
- package/dist/es2017/utils/request/fetch.js +14 -0
- package/dist/es2017/utils/request/request_error.d.ts +0 -1
- package/dist/es2017/utils/request/request_error.d.ts.map +1 -1
- package/dist/es2017/utils/request/request_error.js +13 -12
- package/dist/es2017/utils/request/xhr.d.ts.map +1 -1
- package/dist/es2017/utils/request/xhr.js +17 -0
- package/dist/es2017/utils/task_canceller.d.ts +0 -1
- package/dist/es2017/utils/task_canceller.d.ts.map +1 -1
- package/dist/es2017/utils/task_canceller.js +2 -2
- package/dist/rx-player.js +16 -16
- package/dist/worker.js +6 -6
- package/package.json +2 -12
- package/src/__GENERATED_CODE/embedded_worker.ts +1 -1
- package/src/core/main/common/content_time_boundaries_observer.ts +6 -6
- package/src/core/segment_sinks/garbage_collector.ts +2 -4
- package/src/core/segment_sinks/inventory/utils.ts +3 -3
- package/src/errors/custom_loader_error.ts +1 -4
- package/src/errors/encrypted_media_error.ts +1 -3
- package/src/errors/media_error.ts +1 -3
- package/src/errors/network_error.ts +1 -3
- package/src/errors/other_error.ts +1 -3
- package/src/errors/source_buffer_error.ts +1 -3
- package/src/errors/worker_initialization_error.ts +1 -3
- package/src/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader_error.ts +3 -3
- package/src/main_thread/api/debug/buffer_graph.ts +5 -6
- package/src/main_thread/api/debug/modules/segment_buffer_content.ts +1 -2
- package/src/main_thread/api/public_api.ts +2 -2
- package/src/main_thread/decrypt/session_events_listener.ts +2 -2
- package/src/main_thread/decrypt/utils/check_key_statuses.ts +1 -1
- package/src/main_thread/init/multi_thread_content_initializer.ts +1 -2
- package/src/main_thread/init/utils/rebuffering_controller.ts +3 -3
- package/src/main_thread/init/utils/stream_events_emitter/refresh_scheduled_events_list.ts +2 -4
- package/src/main_thread/text_displayer/html/html_text_displayer.ts +7 -8
- package/src/main_thread/text_displayer/html/text_track_cues_store.ts +7 -7
- package/src/main_thread/text_displayer/native/native_text_displayer.ts +2 -2
- package/src/parsers/containers/isobmff/utils.ts +3 -1
- package/src/parsers/manifest/dash/fast-js-parser/node_parsers/utils.ts +1 -3
- package/src/parsers/manifest/dash/native-parser/node_parsers/utils.ts +1 -4
- package/src/playback_observer/utils/observation_position.ts +11 -0
- package/src/transports/dash/low_latency_segment_loader.ts +1 -0
- package/src/utils/assert.ts +1 -3
- package/src/utils/request/fetch.ts +14 -0
- package/src/utils/request/request_error.ts +16 -15
- package/src/utils/request/xhr.ts +17 -0
- package/src/utils/task_canceller.ts +2 -3
|
@@ -291,8 +291,8 @@ export default class ContentTimeBoundariesObserver extends EventEmitter<IContent
|
|
|
291
291
|
}
|
|
292
292
|
for (const period of streamInfo.activePeriods.toArray()) {
|
|
293
293
|
let wasFoundInAllTypes = true;
|
|
294
|
-
for (
|
|
295
|
-
const streamInfo2 = this._activeStreams.get(
|
|
294
|
+
for (const bufferType of this._allBufferTypes) {
|
|
295
|
+
const streamInfo2 = this._activeStreams.get(bufferType);
|
|
296
296
|
if (streamInfo2 === undefined) {
|
|
297
297
|
return;
|
|
298
298
|
}
|
|
@@ -575,10 +575,10 @@ function getLastAvailablePositionFromAdaptation(
|
|
|
575
575
|
* This variable allows to optimize the logic here when this is the case.
|
|
576
576
|
*/
|
|
577
577
|
let lastIndex: IRepresentationIndex | undefined;
|
|
578
|
-
for (
|
|
579
|
-
if (
|
|
580
|
-
lastIndex =
|
|
581
|
-
const lastPosition =
|
|
578
|
+
for (const representation of representations) {
|
|
579
|
+
if (representation.index !== lastIndex) {
|
|
580
|
+
lastIndex = representation.index;
|
|
581
|
+
const lastPosition = representation.index.getLastAvailablePosition();
|
|
582
582
|
if (lastPosition === undefined) {
|
|
583
583
|
// we cannot tell
|
|
584
584
|
return undefined;
|
|
@@ -128,8 +128,7 @@ async function clearBuffer(
|
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
// begin from the oldest
|
|
131
|
-
for (
|
|
132
|
-
const outerRange = outerRanges[i];
|
|
131
|
+
for (const outerRange of outerRanges) {
|
|
133
132
|
if (position - maxBufferBehind >= outerRange.end) {
|
|
134
133
|
cleanedupRanges.push(outerRange);
|
|
135
134
|
} else if (
|
|
@@ -159,8 +158,7 @@ async function clearBuffer(
|
|
|
159
158
|
}
|
|
160
159
|
|
|
161
160
|
// begin from the oldest
|
|
162
|
-
for (
|
|
163
|
-
const outerRange = outerRanges[i];
|
|
161
|
+
for (const outerRange of outerRanges) {
|
|
164
162
|
if (position + maxBufferAhead <= outerRange.start) {
|
|
165
163
|
cleanedupRanges.push(outerRange);
|
|
166
164
|
} else if (
|
|
@@ -50,9 +50,9 @@ export function getFirstSegmentAfterPeriod(
|
|
|
50
50
|
inventory: IBufferedChunk[],
|
|
51
51
|
period: IPeriod,
|
|
52
52
|
): IBufferedChunk | null {
|
|
53
|
-
for (
|
|
54
|
-
if (
|
|
55
|
-
return
|
|
53
|
+
for (const segment of inventory) {
|
|
54
|
+
if (segment.infos.period.start > period.start) {
|
|
55
|
+
return segment;
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
return null;
|
|
@@ -25,7 +25,6 @@
|
|
|
25
25
|
*/
|
|
26
26
|
export default class CustomLoaderError extends Error {
|
|
27
27
|
public readonly name: "CustomLoaderError";
|
|
28
|
-
public readonly message: string;
|
|
29
28
|
public readonly canRetry: boolean;
|
|
30
29
|
public readonly xhr: XMLHttpRequest | undefined;
|
|
31
30
|
|
|
@@ -35,13 +34,11 @@ export default class CustomLoaderError extends Error {
|
|
|
35
34
|
* @param {XMLHttpRequest} xhr
|
|
36
35
|
*/
|
|
37
36
|
constructor(message: string, canRetry: boolean, xhr: XMLHttpRequest | undefined) {
|
|
38
|
-
super();
|
|
37
|
+
super(message);
|
|
39
38
|
// @see https://stackoverflow.com/questions/41102060/typescript-extending-error-class
|
|
40
39
|
Object.setPrototypeOf(this, CustomLoaderError.prototype);
|
|
41
40
|
|
|
42
41
|
this.name = "CustomLoaderError";
|
|
43
|
-
|
|
44
|
-
this.message = message;
|
|
45
42
|
this.canRetry = canRetry;
|
|
46
43
|
this.xhr = xhr;
|
|
47
44
|
}
|
|
@@ -30,7 +30,6 @@ export default class EncryptedMediaError extends Error {
|
|
|
30
30
|
public readonly type: "ENCRYPTED_MEDIA_ERROR";
|
|
31
31
|
public readonly code: IEncryptedMediaErrorCode;
|
|
32
32
|
public readonly keyStatuses?: IEncryptedMediaErrorKeyStatusObject[];
|
|
33
|
-
public message: string;
|
|
34
33
|
public fatal: boolean;
|
|
35
34
|
private _originalMessage: string;
|
|
36
35
|
|
|
@@ -54,7 +53,7 @@ export default class EncryptedMediaError extends Error {
|
|
|
54
53
|
| { keyStatuses?: IEncryptedMediaErrorKeyStatusObject[] | undefined }
|
|
55
54
|
| undefined,
|
|
56
55
|
) {
|
|
57
|
-
super();
|
|
56
|
+
super(errorMessage(code, reason));
|
|
58
57
|
// @see https://stackoverflow.com/questions/41102060/typescript-extending-error-class
|
|
59
58
|
Object.setPrototypeOf(this, EncryptedMediaError.prototype);
|
|
60
59
|
|
|
@@ -63,7 +62,6 @@ export default class EncryptedMediaError extends Error {
|
|
|
63
62
|
|
|
64
63
|
this.code = code;
|
|
65
64
|
this._originalMessage = reason;
|
|
66
|
-
this.message = errorMessage(this.code, reason);
|
|
67
65
|
this.fatal = false;
|
|
68
66
|
|
|
69
67
|
if (typeof supplementaryInfos?.keyStatuses === "string") {
|
|
@@ -34,7 +34,6 @@ type ICodeWithAdaptationType =
|
|
|
34
34
|
export default class MediaError extends Error {
|
|
35
35
|
public readonly name: "MediaError";
|
|
36
36
|
public readonly type: "MEDIA_ERROR";
|
|
37
|
-
public readonly message: string;
|
|
38
37
|
public readonly code: IMediaErrorCode;
|
|
39
38
|
public readonly tracksInfo: ITaggedTrack[] | undefined;
|
|
40
39
|
public fatal: boolean;
|
|
@@ -70,7 +69,7 @@ export default class MediaError extends Error {
|
|
|
70
69
|
}
|
|
71
70
|
| undefined,
|
|
72
71
|
) {
|
|
73
|
-
super();
|
|
72
|
+
super(errorMessage(code, reason));
|
|
74
73
|
// @see https://stackoverflow.com/questions/41102060/typescript-extending-error-class
|
|
75
74
|
Object.setPrototypeOf(this, MediaError.prototype);
|
|
76
75
|
|
|
@@ -79,7 +78,6 @@ export default class MediaError extends Error {
|
|
|
79
78
|
this._originalMessage = reason;
|
|
80
79
|
|
|
81
80
|
this.code = code;
|
|
82
|
-
this.message = errorMessage(this.code, reason);
|
|
83
81
|
this.fatal = false;
|
|
84
82
|
if (context?.tracks !== undefined && context?.tracks.length > 0) {
|
|
85
83
|
this.tracksInfo = context.tracks;
|
|
@@ -28,7 +28,6 @@ import errorMessage from "./error_message";
|
|
|
28
28
|
export default class NetworkError extends Error {
|
|
29
29
|
public readonly name: "NetworkError";
|
|
30
30
|
public readonly type: "NETWORK_ERROR";
|
|
31
|
-
public readonly message: string;
|
|
32
31
|
public readonly code: INetworkErrorCode;
|
|
33
32
|
public readonly url: string;
|
|
34
33
|
public readonly status: number;
|
|
@@ -41,7 +40,7 @@ export default class NetworkError extends Error {
|
|
|
41
40
|
* @param {Error} baseError
|
|
42
41
|
*/
|
|
43
42
|
constructor(code: INetworkErrorCode, baseError: RequestError) {
|
|
44
|
-
super();
|
|
43
|
+
super(errorMessage(code, baseError.message));
|
|
45
44
|
// @see https://stackoverflow.com/questions/41102060/typescript-extending-error-class
|
|
46
45
|
Object.setPrototypeOf(this, NetworkError.prototype);
|
|
47
46
|
|
|
@@ -54,7 +53,6 @@ export default class NetworkError extends Error {
|
|
|
54
53
|
this._baseError = baseError;
|
|
55
54
|
|
|
56
55
|
this.code = code;
|
|
57
|
-
this.message = errorMessage(this.code, baseError.message);
|
|
58
56
|
this.fatal = false;
|
|
59
57
|
}
|
|
60
58
|
|
|
@@ -25,7 +25,6 @@ import errorMessage from "./error_message";
|
|
|
25
25
|
export default class OtherError extends Error {
|
|
26
26
|
public readonly name: "OtherError";
|
|
27
27
|
public readonly type: "OTHER_ERROR";
|
|
28
|
-
public readonly message: string;
|
|
29
28
|
public readonly code: IOtherErrorCode;
|
|
30
29
|
public fatal: boolean;
|
|
31
30
|
private _originalMessage: string;
|
|
@@ -35,7 +34,7 @@ export default class OtherError extends Error {
|
|
|
35
34
|
* @param {string} reason
|
|
36
35
|
*/
|
|
37
36
|
constructor(code: IOtherErrorCode, reason: string) {
|
|
38
|
-
super();
|
|
37
|
+
super(errorMessage(code, reason));
|
|
39
38
|
// @see https://stackoverflow.com/questions/41102060/typescript-extending-error-class
|
|
40
39
|
Object.setPrototypeOf(this, OtherError.prototype);
|
|
41
40
|
|
|
@@ -43,7 +42,6 @@ export default class OtherError extends Error {
|
|
|
43
42
|
this.type = ErrorTypes.OTHER_ERROR;
|
|
44
43
|
|
|
45
44
|
this.code = code;
|
|
46
|
-
this.message = errorMessage(this.code, reason);
|
|
47
45
|
this.fatal = false;
|
|
48
46
|
this._originalMessage = reason;
|
|
49
47
|
}
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
export default class SourceBufferError extends Error {
|
|
7
7
|
public readonly name: "SourceBufferError";
|
|
8
8
|
public readonly errorName: string;
|
|
9
|
-
public readonly message: string;
|
|
10
9
|
public readonly isBufferFull: boolean;
|
|
11
10
|
|
|
12
11
|
/**
|
|
@@ -16,13 +15,12 @@ export default class SourceBufferError extends Error {
|
|
|
16
15
|
* that the `SourceBuffer` was full.
|
|
17
16
|
*/
|
|
18
17
|
constructor(errorName: string, message: string, isBufferFull: boolean) {
|
|
19
|
-
super();
|
|
18
|
+
super(message);
|
|
20
19
|
// @see https://stackoverflow.com/questions/41102060/typescript-extending-error-class
|
|
21
20
|
Object.setPrototypeOf(this, SourceBufferError.prototype);
|
|
22
21
|
|
|
23
22
|
this.name = "SourceBufferError";
|
|
24
23
|
this.errorName = errorName;
|
|
25
|
-
this.message = message;
|
|
26
24
|
this.isBufferFull = isBufferFull;
|
|
27
25
|
}
|
|
28
26
|
|
|
@@ -14,7 +14,6 @@ type IWorkerInitializationErrorCode =
|
|
|
14
14
|
export default class WorkerInitializationError extends Error {
|
|
15
15
|
public readonly name: "WorkerInitializationError";
|
|
16
16
|
public readonly type: "WORKER_INITIALIZATION_ERROR";
|
|
17
|
-
public readonly message: string;
|
|
18
17
|
public readonly code: IWorkerInitializationErrorCode;
|
|
19
18
|
|
|
20
19
|
/**
|
|
@@ -22,13 +21,12 @@ export default class WorkerInitializationError extends Error {
|
|
|
22
21
|
* @param {string} message
|
|
23
22
|
*/
|
|
24
23
|
constructor(code: IWorkerInitializationErrorCode, message: string) {
|
|
25
|
-
super();
|
|
24
|
+
super(errorMessage(code, message));
|
|
26
25
|
// @see https://stackoverflow.com/questions/41102060/typescript-extending-error-class
|
|
27
26
|
Object.setPrototypeOf(this, WorkerInitializationError.prototype);
|
|
28
27
|
|
|
29
28
|
this.name = "WorkerInitializationError";
|
|
30
29
|
this.type = "WORKER_INITIALIZATION_ERROR";
|
|
31
30
|
this.code = code;
|
|
32
|
-
this.message = errorMessage(this.code, message);
|
|
33
31
|
}
|
|
34
32
|
}
|
|
@@ -14,10 +14,11 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
+
import errorMessage from "../../../errors/error_message";
|
|
18
|
+
|
|
17
19
|
// Returned error when rejecting
|
|
18
20
|
export default class VideoThumbnailLoaderError extends Error {
|
|
19
21
|
public readonly name: "VideoThumbnailLoaderError";
|
|
20
|
-
public readonly message: string;
|
|
21
22
|
public readonly code: string;
|
|
22
23
|
|
|
23
24
|
/**
|
|
@@ -25,10 +26,9 @@ export default class VideoThumbnailLoaderError extends Error {
|
|
|
25
26
|
* @param {string} message
|
|
26
27
|
*/
|
|
27
28
|
constructor(code: string, message: string) {
|
|
28
|
-
super();
|
|
29
|
+
super(errorMessage(code, message));
|
|
29
30
|
Object.setPrototypeOf(this, VideoThumbnailLoaderError.prototype);
|
|
30
31
|
this.name = "VideoThumbnailLoaderError";
|
|
31
32
|
this.code = code;
|
|
32
|
-
this.message = message;
|
|
33
33
|
}
|
|
34
34
|
}
|
|
@@ -129,8 +129,8 @@ export default class SegmentSinkGraph {
|
|
|
129
129
|
maximumPosition,
|
|
130
130
|
);
|
|
131
131
|
|
|
132
|
-
for (
|
|
133
|
-
this._paintRange(
|
|
132
|
+
for (const currentRange of currentRangesScaled) {
|
|
133
|
+
this._paintRange(currentRange, width, height);
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
if (currentTime !== undefined) {
|
|
@@ -222,10 +222,9 @@ function scaleSegments(
|
|
|
222
222
|
): IScaledChunk[] {
|
|
223
223
|
const scaledSegments = [];
|
|
224
224
|
const wholeDuration = maximumPosition - minimumPosition;
|
|
225
|
-
for (
|
|
226
|
-
const
|
|
227
|
-
const
|
|
228
|
-
const end = info.bufferedEnd === undefined ? info.end : info.bufferedEnd;
|
|
225
|
+
for (const info of bufferedData) {
|
|
226
|
+
const start = info.bufferedStart ?? info.start;
|
|
227
|
+
const end = info.bufferedEnd ?? info.end;
|
|
229
228
|
if (end > minimumPosition && start < maximumPosition) {
|
|
230
229
|
const startPoint = Math.max(start - minimumPosition, 0);
|
|
231
230
|
const endPoint = Math.min(end - minimumPosition, maximumPosition);
|
|
@@ -100,8 +100,7 @@ export default function createSegmentSinkGraph(
|
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
currentRangeRepInfoElt.innerHTML = "";
|
|
103
|
-
for (
|
|
104
|
-
const rangeInfo = inventory[i];
|
|
103
|
+
for (const rangeInfo of inventory) {
|
|
105
104
|
const { bufferedStart, bufferedEnd, infos } = rangeInfo;
|
|
106
105
|
if (
|
|
107
106
|
bufferedStart !== undefined &&
|
|
@@ -394,7 +394,7 @@ class Player extends EventEmitter<IPublicAPIEvent> {
|
|
|
394
394
|
// See: https://bugzilla.mozilla.org/show_bug.cgi?id=1194624
|
|
395
395
|
videoElement.preload = "auto";
|
|
396
396
|
|
|
397
|
-
this.version = /* PLAYER_VERSION */ "4.1.0
|
|
397
|
+
this.version = /* PLAYER_VERSION */ "4.1.0";
|
|
398
398
|
this.log = log;
|
|
399
399
|
this.state = "STOPPED";
|
|
400
400
|
this.videoElement = videoElement;
|
|
@@ -3193,7 +3193,7 @@ class Player extends EventEmitter<IPublicAPIEvent> {
|
|
|
3193
3193
|
}
|
|
3194
3194
|
}
|
|
3195
3195
|
}
|
|
3196
|
-
Player.version = /* PLAYER_VERSION */ "4.1.0
|
|
3196
|
+
Player.version = /* PLAYER_VERSION */ "4.1.0";
|
|
3197
3197
|
|
|
3198
3198
|
/** Every events sent by the RxPlayer's public API. */
|
|
3199
3199
|
interface IPublicAPIEvent {
|
|
@@ -338,7 +338,7 @@ export interface IKeyUpdateValue {
|
|
|
338
338
|
export class BlacklistedSessionError extends Error {
|
|
339
339
|
public sessionError: IPlayerError;
|
|
340
340
|
constructor(sessionError: IPlayerError) {
|
|
341
|
-
super();
|
|
341
|
+
super(sessionError.message);
|
|
342
342
|
// @see https://stackoverflow.com/questions/41102060/typescript-extending-error-class
|
|
343
343
|
Object.setPrototypeOf(this, BlacklistedSessionError.prototype);
|
|
344
344
|
this.sessionError = sessionError;
|
|
@@ -352,7 +352,7 @@ export class BlacklistedSessionError extends Error {
|
|
|
352
352
|
*/
|
|
353
353
|
export class GetLicenseTimeoutError extends Error {
|
|
354
354
|
constructor(message: string) {
|
|
355
|
-
super();
|
|
355
|
+
super(message);
|
|
356
356
|
// @see https://stackoverflow.com/questions/41102060/typescript-extending-error-class
|
|
357
357
|
Object.setPrototypeOf(this, BlacklistedSessionError.prototype);
|
|
358
358
|
this.message = message;
|
|
@@ -43,7 +43,7 @@ export class DecommissionedSessionError extends Error {
|
|
|
43
43
|
* current MediaKeySession. Should be used for reporting purposes.
|
|
44
44
|
*/
|
|
45
45
|
constructor(reason: IPlayerError) {
|
|
46
|
-
super();
|
|
46
|
+
super(reason.message);
|
|
47
47
|
// @see https://stackoverflow.com/questions/41102060/typescript-extending-error-class
|
|
48
48
|
Object.setPrototypeOf(this, DecommissionedSessionError.prototype);
|
|
49
49
|
this.reason = reason;
|
|
@@ -1987,8 +1987,7 @@ function updateManifestCodecSupport(manifest: IManifestMetadata): ICodecSupportL
|
|
|
1987
1987
|
if (codecs.length === 0) {
|
|
1988
1988
|
codecs = [""];
|
|
1989
1989
|
}
|
|
1990
|
-
for (
|
|
1991
|
-
const codec = codecs[codecIdx];
|
|
1990
|
+
for (const codec of codecs) {
|
|
1992
1991
|
isSupported = checkCodecSupport(mimeType, codec);
|
|
1993
1992
|
if (isSupported) {
|
|
1994
1993
|
r.codecs = [codec];
|
|
@@ -357,8 +357,8 @@ function findSeekableDiscontinuity(
|
|
|
357
357
|
return null;
|
|
358
358
|
}
|
|
359
359
|
let maxDiscontinuityEnd: number | null = null;
|
|
360
|
-
for (
|
|
361
|
-
const { period } =
|
|
360
|
+
for (const discontinuityInfo of discontinuitiesStore) {
|
|
361
|
+
const { period } = discontinuityInfo;
|
|
362
362
|
if (period.start > stalledPosition) {
|
|
363
363
|
return maxDiscontinuityEnd;
|
|
364
364
|
}
|
|
@@ -366,7 +366,7 @@ function findSeekableDiscontinuity(
|
|
|
366
366
|
let discontinuityEnd: number | undefined;
|
|
367
367
|
|
|
368
368
|
if (period.end === undefined || period.end > stalledPosition) {
|
|
369
|
-
const { discontinuity, position } =
|
|
369
|
+
const { discontinuity, position } = discontinuityInfo;
|
|
370
370
|
const { start, end } = discontinuity;
|
|
371
371
|
const discontinuityLowerLimit = start ?? position;
|
|
372
372
|
if (stalledPosition >= discontinuityLowerLimit - EPSILON) {
|
|
@@ -30,12 +30,10 @@ function refreshScheduledEventsList(
|
|
|
30
30
|
): Array<IStreamEventPayload | INonFiniteStreamEventPayload> {
|
|
31
31
|
const scheduledEvents: Array<IStreamEventPayload | INonFiniteStreamEventPayload> = [];
|
|
32
32
|
const { periods } = manifest;
|
|
33
|
-
for (
|
|
34
|
-
const period = periods[i];
|
|
33
|
+
for (const period of periods) {
|
|
35
34
|
const { streamEvents } = period;
|
|
36
35
|
streamEvents.forEach(({ start, end, id, data }) => {
|
|
37
|
-
for (
|
|
38
|
-
const currentScheduledEvent = oldScheduledEvents[j];
|
|
36
|
+
for (const currentScheduledEvent of oldScheduledEvents) {
|
|
39
37
|
if (areSameStreamEvents(currentScheduledEvent, { id, start, end })) {
|
|
40
38
|
scheduledEvents.push(currentScheduledEvent);
|
|
41
39
|
return;
|
|
@@ -251,8 +251,8 @@ export default class HTMLTextDisplayer implements ITextDisplayer {
|
|
|
251
251
|
private _disableCurrentCues(): void {
|
|
252
252
|
this._sizeUpdateCanceller.cancel();
|
|
253
253
|
if (this._currentCues.length > 0) {
|
|
254
|
-
for (
|
|
255
|
-
safelyRemoveChild(this._textTrackElement,
|
|
254
|
+
for (const cue of this._currentCues) {
|
|
255
|
+
safelyRemoveChild(this._textTrackElement, cue.element);
|
|
256
256
|
}
|
|
257
257
|
this._currentCues = [];
|
|
258
258
|
}
|
|
@@ -275,13 +275,12 @@ export default class HTMLTextDisplayer implements ITextDisplayer {
|
|
|
275
275
|
// TODO More intelligent handling
|
|
276
276
|
|
|
277
277
|
this._sizeUpdateCanceller.cancel();
|
|
278
|
-
for (
|
|
279
|
-
safelyRemoveChild(this._textTrackElement,
|
|
278
|
+
for (const cue of this._currentCues) {
|
|
279
|
+
safelyRemoveChild(this._textTrackElement, cue.element);
|
|
280
280
|
}
|
|
281
281
|
|
|
282
282
|
this._currentCues = [];
|
|
283
|
-
for (
|
|
284
|
-
const element = elements[i];
|
|
283
|
+
for (const element of elements) {
|
|
285
284
|
const resolution = getElementResolution(element);
|
|
286
285
|
this._currentCues.push({ element, resolution });
|
|
287
286
|
this._textTrackElement.appendChild(element);
|
|
@@ -308,8 +307,8 @@ export default class HTMLTextDisplayer implements ITextDisplayer {
|
|
|
308
307
|
);
|
|
309
308
|
heightWidthRef.onUpdate(
|
|
310
309
|
({ height, width }) => {
|
|
311
|
-
for (
|
|
312
|
-
const { resolution, element } =
|
|
310
|
+
for (const cue of proportionalCues) {
|
|
311
|
+
const { resolution, element } = cue;
|
|
313
312
|
updateProportionalElements(height, width, resolution, element);
|
|
314
313
|
}
|
|
315
314
|
},
|
|
@@ -70,9 +70,9 @@ export default class TextTrackCuesStore {
|
|
|
70
70
|
const segment = cuesBuffer[cueIdx];
|
|
71
71
|
if (time < segment.end && time >= segment.start) {
|
|
72
72
|
const cues = segment.cues;
|
|
73
|
-
for (
|
|
74
|
-
if (time >=
|
|
75
|
-
ret.push(
|
|
73
|
+
for (const cue of cues) {
|
|
74
|
+
if (time >= cue.start && time < cue.end) {
|
|
75
|
+
ret.push(cue.element);
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
// first or last IHTMLCue in a group can have a slighlty different start
|
|
@@ -80,12 +80,12 @@ export default class TextTrackCuesStore {
|
|
|
80
80
|
// approximation.
|
|
81
81
|
// Add a tolerance of 1ms to fix this issue
|
|
82
82
|
if (ret.length === 0 && cues.length > 0) {
|
|
83
|
-
for (
|
|
83
|
+
for (const cue of cues) {
|
|
84
84
|
if (
|
|
85
|
-
areNearlyEqual(time,
|
|
86
|
-
areNearlyEqual(time,
|
|
85
|
+
areNearlyEqual(time, cue.start, DELTA_CUES_GROUP) ||
|
|
86
|
+
areNearlyEqual(time, cue.end, DELTA_CUES_GROUP)
|
|
87
87
|
) {
|
|
88
|
-
ret.push(
|
|
88
|
+
ret.push(cue.element);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
}
|
|
@@ -125,8 +125,8 @@ export default class NativeTextDisplayer implements ITextDisplayer {
|
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
for (
|
|
129
|
-
this._track.addCue(
|
|
128
|
+
for (const cue of cues) {
|
|
129
|
+
this._track.addCue(cue);
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
this._buffered.insert(start, end);
|
|
@@ -558,7 +558,9 @@ function getKeyIdFromInitSegment(segment: Uint8Array): Uint8Array | null {
|
|
|
558
558
|
if (tenc === null || tenc.byteLength < 24) {
|
|
559
559
|
return null;
|
|
560
560
|
}
|
|
561
|
-
|
|
561
|
+
const keyId = tenc.subarray(8, 24);
|
|
562
|
+
// Zero-filled keyId should only be valid for unencrypted content
|
|
563
|
+
return keyId.every((b) => b === 0) ? null : keyId;
|
|
562
564
|
}
|
|
563
565
|
|
|
564
566
|
export {
|
|
@@ -361,18 +361,16 @@ function ValueParser<T>(dest: T, warnings: Error[]) {
|
|
|
361
361
|
*/
|
|
362
362
|
class MPDError extends Error {
|
|
363
363
|
public readonly name: "MPDError";
|
|
364
|
-
public readonly message: string;
|
|
365
364
|
|
|
366
365
|
/**
|
|
367
366
|
* @param {string} message
|
|
368
367
|
*/
|
|
369
368
|
constructor(message: string) {
|
|
370
|
-
super();
|
|
369
|
+
super(message);
|
|
371
370
|
// @see https://stackoverflow.com/questions/41102060/typescript-extending-error-class
|
|
372
371
|
Object.setPrototypeOf(this, MPDError.prototype);
|
|
373
372
|
|
|
374
373
|
this.name = "MPDError";
|
|
375
|
-
this.message = message;
|
|
376
374
|
}
|
|
377
375
|
}
|
|
378
376
|
|
|
@@ -357,18 +357,15 @@ function ValueParser<T>(dest: T, warnings: Error[]) {
|
|
|
357
357
|
*/
|
|
358
358
|
class MPDError extends Error {
|
|
359
359
|
public readonly name: "MPDError";
|
|
360
|
-
public readonly message: string;
|
|
361
|
-
|
|
362
360
|
/**
|
|
363
361
|
* @param {string} message
|
|
364
362
|
*/
|
|
365
363
|
constructor(message: string) {
|
|
366
|
-
super();
|
|
364
|
+
super(message);
|
|
367
365
|
// @see https://stackoverflow.com/questions/41102060/typescript-extending-error-class
|
|
368
366
|
Object.setPrototypeOf(this, MPDError.prototype);
|
|
369
367
|
|
|
370
368
|
this.name = "MPDError";
|
|
371
|
-
this.message = message;
|
|
372
369
|
}
|
|
373
370
|
}
|
|
374
371
|
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Class facilitating the exploitation of what could be called the "playback
|
|
3
|
+
* position" (the position at which we should currently be playing).
|
|
4
|
+
*
|
|
5
|
+
* In appearance a simple concept, it has in reality some gotchas that we wanted
|
|
6
|
+
* to make more explicit.
|
|
7
|
+
* As such, this class defines multiple methods to obtain an estimate of it,
|
|
8
|
+
* each having its own pros and cons.
|
|
9
|
+
*
|
|
10
|
+
* @class ObservationPosition
|
|
11
|
+
*/
|
|
1
12
|
export default class ObservationPosition {
|
|
2
13
|
/**
|
|
3
14
|
* Known position at the time the Observation was emitted, in seconds.
|
package/src/utils/assert.ts
CHANGED
|
@@ -26,18 +26,16 @@ import isNullOrUndefined from "./is_null_or_undefined";
|
|
|
26
26
|
*/
|
|
27
27
|
export class AssertionError extends Error {
|
|
28
28
|
public readonly name: "AssertionError";
|
|
29
|
-
public readonly message: string;
|
|
30
29
|
|
|
31
30
|
/**
|
|
32
31
|
* @param {string} message
|
|
33
32
|
*/
|
|
34
33
|
constructor(message: string) {
|
|
35
|
-
super();
|
|
34
|
+
super(message);
|
|
36
35
|
// @see https://stackoverflow.com/questions/41102060/typescript-extending-error-class
|
|
37
36
|
Object.setPrototypeOf(this, AssertionError.prototype);
|
|
38
37
|
|
|
39
38
|
this.name = "AssertionError";
|
|
40
|
-
this.message = message;
|
|
41
39
|
}
|
|
42
40
|
}
|
|
43
41
|
|
|
@@ -177,6 +177,20 @@ export default function fetchRequest(
|
|
|
177
177
|
fetchOpts.headers = headers;
|
|
178
178
|
}
|
|
179
179
|
fetchOpts.signal = !isNullOrUndefined(abortController) ? abortController.signal : null;
|
|
180
|
+
|
|
181
|
+
if (log.hasLevel("DEBUG")) {
|
|
182
|
+
let logLine = "FETCH: Sending GET " + options.url;
|
|
183
|
+
if (options.timeout !== undefined) {
|
|
184
|
+
logLine += " to=" + String(options.timeout / 1000);
|
|
185
|
+
}
|
|
186
|
+
if (options.connectionTimeout !== undefined) {
|
|
187
|
+
logLine += " cto=" + String(options.connectionTimeout / 1000);
|
|
188
|
+
}
|
|
189
|
+
if (options.headers?.Range !== undefined) {
|
|
190
|
+
logLine += " Range=" + options.headers?.Range;
|
|
191
|
+
}
|
|
192
|
+
log.debug(logLine);
|
|
193
|
+
}
|
|
180
194
|
return fetch(options.url, fetchOpts)
|
|
181
195
|
.then((response: Response): Promise<IFetchedStreamComplete> => {
|
|
182
196
|
if (connectionTimeoutId !== undefined) {
|
|
@@ -26,7 +26,6 @@
|
|
|
26
26
|
export default class RequestError extends Error {
|
|
27
27
|
public readonly name: "RequestError";
|
|
28
28
|
public readonly type: IRequestErrorType;
|
|
29
|
-
public readonly message: string;
|
|
30
29
|
public readonly url: string;
|
|
31
30
|
public readonly status: number;
|
|
32
31
|
|
|
@@ -36,30 +35,32 @@ export default class RequestError extends Error {
|
|
|
36
35
|
* @param {string} type
|
|
37
36
|
*/
|
|
38
37
|
constructor(url: string, status: number, type: IRequestErrorType) {
|
|
39
|
-
|
|
40
|
-
// @see https://stackoverflow.com/questions/41102060/typescript-extending-error-class
|
|
41
|
-
Object.setPrototypeOf(this, RequestError.prototype);
|
|
42
|
-
|
|
43
|
-
this.name = "RequestError";
|
|
44
|
-
this.url = url;
|
|
45
|
-
this.status = status;
|
|
46
|
-
this.type = type;
|
|
47
|
-
|
|
38
|
+
let message: string;
|
|
48
39
|
switch (type) {
|
|
49
40
|
case "TIMEOUT":
|
|
50
|
-
|
|
41
|
+
message = "The request timed out";
|
|
51
42
|
break;
|
|
52
43
|
case "ERROR_EVENT":
|
|
53
|
-
|
|
44
|
+
message = "An error prevented the request to be performed successfully";
|
|
54
45
|
break;
|
|
55
46
|
case "PARSE_ERROR":
|
|
56
|
-
|
|
47
|
+
message = "An error happened while formatting the response data";
|
|
57
48
|
break;
|
|
58
49
|
case "ERROR_HTTP_CODE":
|
|
59
|
-
|
|
60
|
-
"An HTTP status code indicating failure was received: " + String(
|
|
50
|
+
message =
|
|
51
|
+
"An HTTP status code indicating failure was received: " + String(status);
|
|
61
52
|
break;
|
|
62
53
|
}
|
|
54
|
+
|
|
55
|
+
super(message);
|
|
56
|
+
|
|
57
|
+
// @see https://stackoverflow.com/questions/41102060/typescript-extending-error-class
|
|
58
|
+
Object.setPrototypeOf(this, RequestError.prototype);
|
|
59
|
+
|
|
60
|
+
this.name = "RequestError";
|
|
61
|
+
this.url = url;
|
|
62
|
+
this.status = status;
|
|
63
|
+
this.type = type;
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
public serialize(): ISerializedRequestError {
|