rx-player 4.5.0-dev.2026043000 → 4.5.0-dev.2026060401
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 +6 -1
- package/VERSION +1 -1
- package/dist/commonjs/__GENERATED_CODE/embedded_dash_wasm.d.ts.map +1 -1
- package/dist/commonjs/__GENERATED_CODE/embedded_dash_wasm.js +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/compat/eme/eme-api-implementation.js +1 -1
- package/dist/commonjs/compat/patch_webkit_source_buffer.d.ts.map +1 -1
- package/dist/commonjs/core/adaptive/utils/pending_requests_store.d.ts.map +1 -1
- package/dist/commonjs/core/adaptive/utils/pending_requests_store.js +2 -0
- package/dist/commonjs/core/entry/content_preparer.js +3 -1
- package/dist/commonjs/core/entry/content_time_boundaries_observer.d.ts +0 -13
- package/dist/commonjs/core/entry/content_time_boundaries_observer.d.ts.map +1 -1
- package/dist/commonjs/core/entry/content_time_boundaries_observer.js +9 -2
- package/dist/commonjs/core/segment_sinks/implementations/audio_video/audio_video_segment_sink.js +3 -1
- package/dist/commonjs/core/segment_sinks/implementations/text/text_segment_sink.d.ts.map +1 -1
- package/dist/commonjs/core/segment_sinks/implementations/text/text_segment_sink.js +4 -1
- package/dist/commonjs/core/segment_sinks/implementations/utils/manual_time_ranges.d.ts.map +1 -1
- package/dist/commonjs/core/segment_sinks/implementations/utils/manual_time_ranges.js +2 -0
- package/dist/commonjs/core/stream/adaptation/types.d.ts.map +1 -1
- package/dist/commonjs/core/stream/orchestrator/stream_orchestrator.d.ts.map +1 -1
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/utils.d.ts.map +1 -1
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/utils.js +2 -0
- package/dist/commonjs/importable_worker.d.ts.map +1 -1
- package/dist/commonjs/importable_worker.js +1 -0
- package/dist/commonjs/main_thread/api/public_api.d.ts +3 -1
- package/dist/commonjs/main_thread/api/public_api.d.ts.map +1 -1
- package/dist/commonjs/main_thread/api/public_api.js +13 -6
- package/dist/commonjs/main_thread/decrypt/utils/loaded_sessions_store.d.ts.map +1 -1
- package/dist/commonjs/main_thread/init/directfile_content_initializer.d.ts.map +1 -1
- package/dist/commonjs/main_thread/init/directfile_content_initializer.js +20 -11
- package/dist/commonjs/main_thread/init/media_source_content_initializer.d.ts +0 -1
- package/dist/commonjs/main_thread/init/media_source_content_initializer.d.ts.map +1 -1
- package/dist/commonjs/main_thread/init/media_source_content_initializer.js +6 -10
- package/dist/commonjs/main_thread/text_displayer/html/html_text_displayer.js +1 -0
- package/dist/commonjs/main_thread/tracks_store/media_element_tracks_store.d.ts +2 -0
- package/dist/commonjs/main_thread/tracks_store/media_element_tracks_store.d.ts.map +1 -1
- package/dist/commonjs/main_thread/tracks_store/media_element_tracks_store.js +58 -24
- package/dist/commonjs/main_thread/tracks_store/tracks_store.d.ts +12 -1
- package/dist/commonjs/main_thread/tracks_store/tracks_store.d.ts.map +1 -1
- package/dist/commonjs/main_thread/tracks_store/tracks_store.js +15 -3
- package/dist/commonjs/main_thread/utils/media_capabilities.d.ts +5 -0
- package/dist/commonjs/main_thread/utils/media_capabilities.d.ts.map +1 -0
- package/dist/commonjs/main_thread/utils/media_capabilities.js +12 -0
- package/dist/commonjs/playback_observer/core_playback_observer.d.ts.map +1 -1
- package/dist/commonjs/transports/dash/manifest_parser.js +6 -2
- package/dist/commonjs/transports/smooth/segment_loader.d.ts.map +1 -1
- package/dist/commonjs/transports/smooth/segment_loader.js +3 -1
- package/dist/commonjs/utils/assert.d.ts.map +1 -1
- package/dist/commonjs/utils/assert.js +3 -1
- package/dist/commonjs/utils/create_uuid.js +2 -2
- package/dist/commonjs/utils/event_emitter.d.ts.map +1 -1
- package/dist/commonjs/utils/event_emitter.js +1 -0
- package/dist/commonjs/utils/reference.d.ts.map +1 -1
- package/dist/commonjs/utils/reference.js +1 -0
- package/dist/es2017/__GENERATED_CODE/embedded_dash_wasm.d.ts.map +1 -1
- package/dist/es2017/__GENERATED_CODE/embedded_dash_wasm.js +1 -1
- 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/compat/eme/eme-api-implementation.js +1 -1
- package/dist/es2017/compat/patch_webkit_source_buffer.d.ts.map +1 -1
- package/dist/es2017/core/adaptive/utils/pending_requests_store.d.ts.map +1 -1
- package/dist/es2017/core/adaptive/utils/pending_requests_store.js +2 -0
- package/dist/es2017/core/entry/content_preparer.js +3 -1
- package/dist/es2017/core/entry/content_time_boundaries_observer.d.ts +0 -13
- package/dist/es2017/core/entry/content_time_boundaries_observer.d.ts.map +1 -1
- package/dist/es2017/core/entry/content_time_boundaries_observer.js +9 -2
- package/dist/es2017/core/segment_sinks/implementations/audio_video/audio_video_segment_sink.js +3 -1
- package/dist/es2017/core/segment_sinks/implementations/text/text_segment_sink.d.ts.map +1 -1
- package/dist/es2017/core/segment_sinks/implementations/text/text_segment_sink.js +4 -1
- package/dist/es2017/core/segment_sinks/implementations/utils/manual_time_ranges.d.ts.map +1 -1
- package/dist/es2017/core/segment_sinks/implementations/utils/manual_time_ranges.js +2 -0
- package/dist/es2017/core/stream/adaptation/types.d.ts.map +1 -1
- package/dist/es2017/core/stream/orchestrator/stream_orchestrator.d.ts.map +1 -1
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/utils.d.ts.map +1 -1
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/utils.js +2 -0
- package/dist/es2017/importable_worker.d.ts.map +1 -1
- package/dist/es2017/importable_worker.js +1 -0
- package/dist/es2017/main_thread/api/public_api.d.ts +3 -1
- package/dist/es2017/main_thread/api/public_api.d.ts.map +1 -1
- package/dist/es2017/main_thread/api/public_api.js +13 -6
- package/dist/es2017/main_thread/decrypt/utils/loaded_sessions_store.d.ts.map +1 -1
- package/dist/es2017/main_thread/init/directfile_content_initializer.d.ts.map +1 -1
- package/dist/es2017/main_thread/init/directfile_content_initializer.js +20 -11
- package/dist/es2017/main_thread/init/media_source_content_initializer.d.ts +0 -1
- package/dist/es2017/main_thread/init/media_source_content_initializer.d.ts.map +1 -1
- package/dist/es2017/main_thread/init/media_source_content_initializer.js +6 -10
- package/dist/es2017/main_thread/text_displayer/html/html_text_displayer.js +1 -0
- package/dist/es2017/main_thread/tracks_store/media_element_tracks_store.d.ts +2 -0
- package/dist/es2017/main_thread/tracks_store/media_element_tracks_store.d.ts.map +1 -1
- package/dist/es2017/main_thread/tracks_store/media_element_tracks_store.js +58 -24
- package/dist/es2017/main_thread/tracks_store/tracks_store.d.ts +12 -1
- package/dist/es2017/main_thread/tracks_store/tracks_store.d.ts.map +1 -1
- package/dist/es2017/main_thread/tracks_store/tracks_store.js +15 -3
- package/dist/es2017/main_thread/utils/media_capabilities.d.ts +5 -0
- package/dist/es2017/main_thread/utils/media_capabilities.d.ts.map +1 -0
- package/dist/es2017/main_thread/utils/media_capabilities.js +8 -0
- package/dist/es2017/playback_observer/core_playback_observer.d.ts.map +1 -1
- package/dist/es2017/transports/dash/manifest_parser.js +6 -2
- package/dist/es2017/transports/smooth/segment_loader.d.ts.map +1 -1
- package/dist/es2017/transports/smooth/segment_loader.js +3 -1
- package/dist/es2017/utils/assert.d.ts.map +1 -1
- package/dist/es2017/utils/assert.js +3 -1
- package/dist/es2017/utils/create_uuid.js +2 -2
- package/dist/es2017/utils/event_emitter.d.ts.map +1 -1
- package/dist/es2017/utils/event_emitter.js +1 -0
- package/dist/es2017/utils/reference.d.ts.map +1 -1
- package/dist/es2017/utils/reference.js +1 -0
- package/dist/mpd-parser.wasm +0 -0
- package/dist/worker.js +6 -6
- package/eslint.config.mjs +7 -2
- package/package.json +14 -14
- package/src/__GENERATED_CODE/embedded_dash_wasm.ts +1 -1
- package/src/__GENERATED_CODE/embedded_worker.ts +1 -1
- package/src/compat/__tests__/is_codec_supported.test.ts +8 -2
- package/src/compat/eme/eme-api-implementation.ts +1 -1
- package/src/compat/patch_webkit_source_buffer.ts +6 -7
- package/src/core/adaptive/utils/pending_requests_store.ts +2 -0
- package/src/core/entry/__tests__/content_time_boundaries_observer.test.ts +14 -0
- package/src/core/entry/content_preparer.ts +1 -0
- package/src/core/entry/content_time_boundaries_observer.ts +12 -2
- package/src/core/segment_sinks/implementations/audio_video/audio_video_segment_sink.ts +1 -0
- package/src/core/segment_sinks/implementations/text/text_segment_sink.ts +2 -0
- package/src/core/segment_sinks/implementations/utils/manual_time_ranges.ts +2 -0
- package/src/core/stream/adaptation/types.ts +5 -4
- package/src/core/stream/orchestrator/stream_orchestrator.ts +4 -2
- package/src/experimental/tools/mediaCapabilitiesProber/probers/__tests__/HDCPPolicy.test.ts +8 -2
- package/src/experimental/tools/mediaCapabilitiesProber/probers/__tests__/defaultCodecsFinder.test.ts +6 -2
- package/src/experimental/tools/mediaCapabilitiesProber/probers/__tests__/mediaContentType.test.ts +6 -2
- package/src/experimental/tools/mediaCapabilitiesProber/utils.ts +2 -0
- package/src/importable_worker.ts +1 -0
- package/src/main_thread/api/public_api.ts +14 -4
- package/src/main_thread/decrypt/utils/loaded_sessions_store.ts +1 -1
- package/src/main_thread/init/directfile_content_initializer.ts +25 -15
- package/src/main_thread/init/media_source_content_initializer.ts +6 -13
- package/src/main_thread/init/utils/__tests__/stream_events_emitter.test.ts +1 -1
- package/src/main_thread/text_displayer/html/html_text_displayer.ts +1 -0
- package/src/main_thread/tracks_store/__tests__/media_element_tracks_store.test.ts +63 -43
- package/src/main_thread/tracks_store/__tests__/tracks_store.test.ts +91 -0
- package/src/main_thread/tracks_store/media_element_tracks_store.ts +66 -27
- package/src/main_thread/tracks_store/tracks_store.ts +25 -3
- package/src/main_thread/utils/media_capabilities.ts +14 -0
- package/src/manifest/classes/__tests__/update_periods.test.ts +1 -0
- package/src/parsers/manifest/dash/common/__tests__/get_periods_time_infos.test.ts +1 -0
- package/src/playback_observer/core_playback_observer.ts +1 -3
- package/src/transports/dash/manifest_parser.ts +2 -0
- package/src/transports/smooth/segment_loader.ts +1 -0
- package/src/utils/assert.ts +1 -0
- package/src/utils/create_uuid.ts +2 -2
- package/src/utils/event_emitter.ts +1 -0
- package/src/utils/reference.ts +1 -0
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { describe, beforeEach, it, expect, vi, afterEach } from "vitest";
|
|
2
2
|
import isCodecSupported from "../is_codec_supported";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
type IMockedMediaSource =
|
|
5
|
+
| {
|
|
6
|
+
isTypeSupported?: ((codec: string) => boolean) | undefined;
|
|
7
|
+
}
|
|
8
|
+
| undefined;
|
|
9
|
+
|
|
10
|
+
const mocks: { default: { MediaSource_: IMockedMediaSource } } = vi.hoisted(() => {
|
|
5
11
|
return {
|
|
6
12
|
default: {
|
|
7
|
-
MediaSource_: {}
|
|
13
|
+
MediaSource_: {},
|
|
8
14
|
},
|
|
9
15
|
};
|
|
10
16
|
});
|
|
@@ -315,7 +315,7 @@ function defaultSetMediaKeys(
|
|
|
315
315
|
try {
|
|
316
316
|
let ret: unknown;
|
|
317
317
|
if (typeof elt.setMediaKeys === "function") {
|
|
318
|
-
// eslint-disable-next-line @typescript-eslint/no-restricted-types
|
|
318
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion, @typescript-eslint/no-restricted-types
|
|
319
319
|
ret = elt.setMediaKeys(mediaKeys as MediaKeys);
|
|
320
320
|
}
|
|
321
321
|
|
|
@@ -25,13 +25,12 @@ interface IWebKitSourceBufferConstructor {
|
|
|
25
25
|
prototype: IWebKitSourceBuffer;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
interface IWebKitSourceBuffer
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}> {
|
|
28
|
+
interface IWebKitSourceBuffer extends EventEmitter<{
|
|
29
|
+
updatestart: Event;
|
|
30
|
+
update: Event;
|
|
31
|
+
updateend: Event;
|
|
32
|
+
error: Event | Error;
|
|
33
|
+
}> {
|
|
35
34
|
_emitUpdate?: (eventName: "error" | "update", val: unknown) => void;
|
|
36
35
|
appendBuffer?: (data: BufferSource) => void;
|
|
37
36
|
updating: boolean;
|
|
@@ -54,6 +54,7 @@ export default class PendingRequestsStore {
|
|
|
54
54
|
public addProgress(progress: IPendingRequestStoreProgress): void {
|
|
55
55
|
const request = this._currentRequests[progress.id];
|
|
56
56
|
if (isNullOrUndefined(request)) {
|
|
57
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
57
58
|
if ((__ENVIRONMENT__.CURRENT_ENV as number) === (__ENVIRONMENT__.DEV as number)) {
|
|
58
59
|
throw new Error("ABR: progress for a request not added");
|
|
59
60
|
}
|
|
@@ -69,6 +70,7 @@ export default class PendingRequestsStore {
|
|
|
69
70
|
*/
|
|
70
71
|
public remove(id: string): void {
|
|
71
72
|
if (isNullOrUndefined(this._currentRequests[id])) {
|
|
73
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
72
74
|
if ((__ENVIRONMENT__.CURRENT_ENV as number) === (__ENVIRONMENT__.DEV as number)) {
|
|
73
75
|
throw new Error("ABR: can't remove unknown request");
|
|
74
76
|
}
|
|
@@ -150,6 +150,20 @@ describe("ContentTimeBoundariesObserver", () => {
|
|
|
150
150
|
});
|
|
151
151
|
});
|
|
152
152
|
|
|
153
|
+
it("should not trigger warning when position is within epsilon of manifest minimum", async () => {
|
|
154
|
+
mockGetMinimumSafePosition.mockReturnValue(10);
|
|
155
|
+
const manifest = createMockManifest();
|
|
156
|
+
const playbackObserver = createMockPlaybackObserver();
|
|
157
|
+
|
|
158
|
+
new ContentTimeBoundariesObserver(manifest, playbackObserver, ["audio"]);
|
|
159
|
+
await sleep(0);
|
|
160
|
+
|
|
161
|
+
const positionCallback = mockPlaybackObserverListen.mock.calls[0][0];
|
|
162
|
+
positionCallback({ position: { getWanted: () => 9.9995 } });
|
|
163
|
+
|
|
164
|
+
expect(mockTrigger).not.toHaveBeenCalled();
|
|
165
|
+
});
|
|
166
|
+
|
|
153
167
|
it("should trigger warning when position is after manifest maximum", async () => {
|
|
154
168
|
mockGetMaximumSafePosition.mockReturnValue(100);
|
|
155
169
|
const manifest = createMockManifest();
|
|
@@ -500,6 +500,7 @@ function createMediaSourceInterfaceAndSegmentSinksStore(
|
|
|
500
500
|
value: sentMediaSourceLink,
|
|
501
501
|
mediaSourceId: mediaSourceInterface.id,
|
|
502
502
|
},
|
|
503
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
503
504
|
[handle.value as unknown as Transferable],
|
|
504
505
|
);
|
|
505
506
|
} else {
|
|
@@ -47,6 +47,12 @@ import TaskCanceller from "../../utils/task_canceller";
|
|
|
47
47
|
* Manifest range.
|
|
48
48
|
* @class ContentTimeBoundariesObserver
|
|
49
49
|
*/
|
|
50
|
+
|
|
51
|
+
// `HTMLMediaElement.currentTime` can be off by a very small amount from the
|
|
52
|
+
// Manifest-derived boundaries. We keep an epsilon so those rounding
|
|
53
|
+
// differences do not trigger spurious boundary warnings.
|
|
54
|
+
const EPSILON = 1e-3;
|
|
55
|
+
|
|
50
56
|
export default class ContentTimeBoundariesObserver extends EventEmitter<IContentTimeBoundariesObserverEvent> {
|
|
51
57
|
/** Allows to interrupt everything the `ContentTimeBoundariesObserver` is doing. */
|
|
52
58
|
private _canceller: TaskCanceller;
|
|
@@ -115,7 +121,11 @@ export default class ContentTimeBoundariesObserver extends EventEmitter<IContent
|
|
|
115
121
|
const wantedPosition = position.getWanted();
|
|
116
122
|
const minimumPosition = manifest.getMinimumSafePosition();
|
|
117
123
|
const maximumPosition = maximumPositionCalculator.getMaximumAvailablePosition();
|
|
118
|
-
|
|
124
|
+
|
|
125
|
+
// Only report "before manifest" when the position is meaningfully
|
|
126
|
+
// behind the minimum, not when `<video>.currentTime` and the
|
|
127
|
+
// Manifest disagree by a tiny floating-point delta.
|
|
128
|
+
if (wantedPosition < minimumPosition - EPSILON) {
|
|
119
129
|
const warning = new MediaError(
|
|
120
130
|
"MEDIA_TIME_BEFORE_MANIFEST",
|
|
121
131
|
"The current position is behind the " +
|
|
@@ -129,7 +139,7 @@ export default class ContentTimeBoundariesObserver extends EventEmitter<IContent
|
|
|
129
139
|
},
|
|
130
140
|
);
|
|
131
141
|
this.trigger("warning", warning);
|
|
132
|
-
} else if (wantedPosition > maximumPosition) {
|
|
142
|
+
} else if (wantedPosition > maximumPosition + EPSILON) {
|
|
133
143
|
const warning = new MediaError(
|
|
134
144
|
"MEDIA_TIME_AFTER_MANIFEST",
|
|
135
145
|
"The current position is after the latest " +
|
|
@@ -349,6 +349,7 @@ export default class AudioVideoSegmentSink extends SegmentSink {
|
|
|
349
349
|
*/
|
|
350
350
|
function assertDataIsBufferSource(data: unknown): asserts data is BufferSource {
|
|
351
351
|
if (
|
|
352
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
352
353
|
(__ENVIRONMENT__.CURRENT_ENV as number) === (__ENVIRONMENT__.PRODUCTION as number)
|
|
353
354
|
) {
|
|
354
355
|
return;
|
|
@@ -191,6 +191,7 @@ function assertChunkIsTextTrackSegmentData(
|
|
|
191
191
|
chunk: unknown,
|
|
192
192
|
): asserts chunk is ITextTracksBufferSegmentData {
|
|
193
193
|
if (
|
|
194
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
194
195
|
(__ENVIRONMENT__.CURRENT_ENV as number) === (__ENVIRONMENT__.PRODUCTION as number)
|
|
195
196
|
) {
|
|
196
197
|
return;
|
|
@@ -285,6 +286,7 @@ export interface ITextDisplayerInterface {
|
|
|
285
286
|
* It doesn't correspond at all to real code that will be called. This is just
|
|
286
287
|
* a hack to tell TypeScript to perform that check.
|
|
287
288
|
*/
|
|
289
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
288
290
|
if ((__ENVIRONMENT__.CURRENT_ENV as number) === (__ENVIRONMENT__.DEV as number)) {
|
|
289
291
|
// @ts-expect-error: unused function for type checking
|
|
290
292
|
function _checkType(input: ITextTrackSegmentData): void {
|
|
@@ -36,6 +36,7 @@ export default class ManualTimeRanges implements TimeRanges {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
insert(start: number, end: number): void {
|
|
39
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
39
40
|
if ((__ENVIRONMENT__.CURRENT_ENV as number) === (__ENVIRONMENT__.DEV as number)) {
|
|
40
41
|
assert(start >= 0, "invalid start time");
|
|
41
42
|
assert(end - start > 0, "invalid end time");
|
|
@@ -45,6 +46,7 @@ export default class ManualTimeRanges implements TimeRanges {
|
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
remove(start: number, end: number): void {
|
|
49
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
48
50
|
if ((__ENVIRONMENT__.CURRENT_ENV as number) === (__ENVIRONMENT__.DEV as number)) {
|
|
49
51
|
assert(start >= 0, "invalid start time");
|
|
50
52
|
assert(end - start > 0, "invalid end time");
|
|
@@ -15,8 +15,10 @@ import type {
|
|
|
15
15
|
} from "../representation";
|
|
16
16
|
|
|
17
17
|
/** Callbacks called by the `AdaptationStream` on various events. */
|
|
18
|
-
export interface IAdaptationStreamCallbacks
|
|
19
|
-
|
|
18
|
+
export interface IAdaptationStreamCallbacks extends Omit<
|
|
19
|
+
IRepresentationStreamCallbacks,
|
|
20
|
+
"terminating" | "addedSegment"
|
|
21
|
+
> {
|
|
20
22
|
/** Called as new bitrate estimates are done. */
|
|
21
23
|
bitrateEstimateChange(payload: IBitrateEstimateChangePayload): void;
|
|
22
24
|
/**
|
|
@@ -111,8 +113,7 @@ export interface INeedsBufferFlushPayload {
|
|
|
111
113
|
}
|
|
112
114
|
|
|
113
115
|
/** Regular playback information needed by the AdaptationStream. */
|
|
114
|
-
export interface IAdaptationStreamPlaybackObservation
|
|
115
|
-
extends IRepresentationStreamPlaybackObservation {
|
|
116
|
+
export interface IAdaptationStreamPlaybackObservation extends IRepresentationStreamPlaybackObservation {
|
|
116
117
|
/**
|
|
117
118
|
* For the current SegmentSink, difference in seconds between the next position
|
|
118
119
|
* where no segment data is available and the current position.
|
|
@@ -710,8 +710,10 @@ export type IStreamOrchestratorOptions = IPeriodStreamOptions & {
|
|
|
710
710
|
};
|
|
711
711
|
|
|
712
712
|
/** Callbacks called by the `StreamOrchestrator` on various events. */
|
|
713
|
-
export interface IStreamOrchestratorCallbacks
|
|
714
|
-
|
|
713
|
+
export interface IStreamOrchestratorCallbacks extends Omit<
|
|
714
|
+
IPeriodStreamCallbacks,
|
|
715
|
+
"waitingMediaSourceReload"
|
|
716
|
+
> {
|
|
715
717
|
/**
|
|
716
718
|
* Called when a `PeriodStream` has been removed.
|
|
717
719
|
* This event can be used for clean-up purposes. For example, you are free to
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { describe, afterEach, it, expect, vi, beforeEach } from "vitest";
|
|
2
2
|
import probeHDCPPolicy from "../../probers/HDCPPolicy";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
type IRequestMediaKeySystemAccess =
|
|
5
|
+
| ((...args: unknown[]) => Promise<unknown>)
|
|
6
|
+
| undefined;
|
|
7
|
+
|
|
8
|
+
const compatEmeMock: {
|
|
9
|
+
default: { requestMediaKeySystemAccess: IRequestMediaKeySystemAccess };
|
|
10
|
+
} = vi.hoisted(() => {
|
|
5
11
|
return {
|
|
6
12
|
default: {
|
|
7
|
-
requestMediaKeySystemAccess: undefined
|
|
13
|
+
requestMediaKeySystemAccess: undefined,
|
|
8
14
|
},
|
|
9
15
|
};
|
|
10
16
|
});
|
package/src/experimental/tools/mediaCapabilitiesProber/probers/__tests__/defaultCodecsFinder.test.ts
CHANGED
|
@@ -4,10 +4,14 @@ import {
|
|
|
4
4
|
findDefaultAudioCodec,
|
|
5
5
|
} from "../../probers/defaultCodecsFinder";
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
type IMockedMediaSource = {
|
|
8
|
+
isTypeSupported?: ((codec: string) => boolean) | undefined;
|
|
9
|
+
} | null;
|
|
10
|
+
|
|
11
|
+
const mocks: { default: { MediaSource_: IMockedMediaSource } } = vi.hoisted(() => {
|
|
8
12
|
return {
|
|
9
13
|
default: {
|
|
10
|
-
MediaSource_: {}
|
|
14
|
+
MediaSource_: {},
|
|
11
15
|
},
|
|
12
16
|
};
|
|
13
17
|
});
|
package/src/experimental/tools/mediaCapabilitiesProber/probers/__tests__/mediaContentType.test.ts
CHANGED
|
@@ -2,10 +2,14 @@ import { describe, beforeEach, it, expect, vi, afterEach } from "vitest";
|
|
|
2
2
|
import probeMediaContentType from "../../probers/mediaContentType";
|
|
3
3
|
import type { IMediaConfiguration } from "../../types";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
type IMockedMediaSource = {
|
|
6
|
+
isTypeSupported?: ((codec: string) => boolean) | boolean | undefined;
|
|
7
|
+
} | null;
|
|
8
|
+
|
|
9
|
+
const mocks: { default: { MediaSource_: IMockedMediaSource } } = vi.hoisted(() => {
|
|
6
10
|
return {
|
|
7
11
|
default: {
|
|
8
|
-
MediaSource_: {}
|
|
12
|
+
MediaSource_: {},
|
|
9
13
|
},
|
|
10
14
|
};
|
|
11
15
|
});
|
|
@@ -83,6 +83,7 @@ export function filterConfigurationWithCapabilities(
|
|
|
83
83
|
}
|
|
84
84
|
)[capability] !== undefined
|
|
85
85
|
) {
|
|
86
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
86
87
|
(probedConfig as { [id: string]: string | IMediaConfiguration })[capability] = (
|
|
87
88
|
configuration as { [id: string]: string | IMediaConfiguration }
|
|
88
89
|
)[capability];
|
|
@@ -105,6 +106,7 @@ export function filterConfigurationWithCapabilities(
|
|
|
105
106
|
Object.keys((configuration as { [id: string]: IMediaConfiguration })[key])
|
|
106
107
|
.length === 0)
|
|
107
108
|
) {
|
|
109
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
108
110
|
(probedConfig as { [id: string]: IMediaConfiguration })[key] = subProbedConfig;
|
|
109
111
|
}
|
|
110
112
|
}
|
package/src/importable_worker.ts
CHANGED
|
@@ -63,6 +63,7 @@ export default class RxPlayerWorker<
|
|
|
63
63
|
globalScope.addEventListener("message", (evt: MessageEvent<IMainThreadMessage>) => {
|
|
64
64
|
if (evt.data.type === MainThreadMessageType.AppDefined) {
|
|
65
65
|
const { name, payload } = evt.data.value;
|
|
66
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
66
67
|
const listeners = this._messageListeners.get(name as keyof TReceivingEventRecord);
|
|
67
68
|
if (listeners === undefined) {
|
|
68
69
|
return;
|
|
@@ -133,6 +133,7 @@ import renderThumbnail from "../render_thumbnail";
|
|
|
133
133
|
import type { IMediaElementTracksStore, ITSPeriodObject } from "../tracks_store";
|
|
134
134
|
import TracksStore from "../tracks_store";
|
|
135
135
|
import { MainThreadMessageType } from "../types";
|
|
136
|
+
import { canHandleTextTracks, canHandleVideoTracks } from "../utils/media_capabilities";
|
|
136
137
|
import type { IParsedLoadVideoOptions, IParsedStartAtOption } from "./option_utils";
|
|
137
138
|
import {
|
|
138
139
|
checkReloadOptions,
|
|
@@ -179,6 +180,7 @@ try {
|
|
|
179
180
|
|
|
180
181
|
if (isDebugModeEnabled) {
|
|
181
182
|
log.setLevel("DEBUG", "full");
|
|
183
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
182
184
|
} else if ((__ENVIRONMENT__.CURRENT_ENV as number) === (__ENVIRONMENT__.DEV as number)) {
|
|
183
185
|
log.setLevel(__LOGGER_LEVEL__.CURRENT_LEVEL, "standard");
|
|
184
186
|
}
|
|
@@ -437,7 +439,7 @@ class Player extends EventEmitter<IPublicAPIEvent> {
|
|
|
437
439
|
// See: https://bugzilla.mozilla.org/show_bug.cgi?id=1194624
|
|
438
440
|
videoElement.preload = "auto";
|
|
439
441
|
|
|
440
|
-
this.version = /* PLAYER_VERSION */ "4.5.0-dev.
|
|
442
|
+
this.version = /* PLAYER_VERSION */ "4.5.0-dev.2026060401";
|
|
441
443
|
this.log = log;
|
|
442
444
|
this.state = "STOPPED";
|
|
443
445
|
this.videoElement = videoElement;
|
|
@@ -643,7 +645,7 @@ class Player extends EventEmitter<IPublicAPIEvent> {
|
|
|
643
645
|
sendBackLogs: isDebugModeEnabled,
|
|
644
646
|
date: Date.now(),
|
|
645
647
|
timestamp: getMonotonicTimeStamp(),
|
|
646
|
-
hasVideo: this.videoElement
|
|
648
|
+
hasVideo: canHandleVideoTracks(this.videoElement),
|
|
647
649
|
},
|
|
648
650
|
});
|
|
649
651
|
log.addEventListener(
|
|
@@ -1191,7 +1193,7 @@ class Player extends EventEmitter<IPublicAPIEvent> {
|
|
|
1191
1193
|
type: MainThreadMessageType.Init,
|
|
1192
1194
|
value: {
|
|
1193
1195
|
dashWasmUrl: undefined,
|
|
1194
|
-
hasVideo: this.videoElement
|
|
1196
|
+
hasVideo: canHandleVideoTracks(this.videoElement),
|
|
1195
1197
|
logLevel: log.getLevel(),
|
|
1196
1198
|
logFormat: log.getFormat(),
|
|
1197
1199
|
sendBackLogs: false,
|
|
@@ -1356,6 +1358,11 @@ class Player extends EventEmitter<IPublicAPIEvent> {
|
|
|
1356
1358
|
activeRepresentations: null,
|
|
1357
1359
|
tracksStore: null,
|
|
1358
1360
|
mediaElementTracksStore,
|
|
1361
|
+
handledTrackTypes: {
|
|
1362
|
+
audio: true,
|
|
1363
|
+
video: canHandleVideoTracks(this.videoElement),
|
|
1364
|
+
text: canHandleTextTracks(options),
|
|
1365
|
+
},
|
|
1359
1366
|
useWorker,
|
|
1360
1367
|
segmentSinkMetricsCallback: null,
|
|
1361
1368
|
fetchThumbnailDataCallback: null,
|
|
@@ -2981,6 +2988,7 @@ class Player extends EventEmitter<IPublicAPIEvent> {
|
|
|
2981
2988
|
const tracksStore = new TracksStore({
|
|
2982
2989
|
preferTrickModeTracks: this._priv_preferTrickModeTracks,
|
|
2983
2990
|
defaultAudioTrackSwitchingMode: contentInfos.defaultAudioTrackSwitchingMode,
|
|
2991
|
+
handledTrackTypes: contentInfos.handledTrackTypes,
|
|
2984
2992
|
onTracksNotPlayableForType: {
|
|
2985
2993
|
audio: contentInfos.onAudioTracksNotPlayable,
|
|
2986
2994
|
video: contentInfos.onVideoTracksNotPlayable,
|
|
@@ -3837,7 +3845,7 @@ class Player extends EventEmitter<IPublicAPIEvent> {
|
|
|
3837
3845
|
return true;
|
|
3838
3846
|
}
|
|
3839
3847
|
}
|
|
3840
|
-
Player.version = /* PLAYER_VERSION */ "4.5.0-dev.
|
|
3848
|
+
Player.version = /* PLAYER_VERSION */ "4.5.0-dev.2026060401";
|
|
3841
3849
|
|
|
3842
3850
|
/** Every events sent by the RxPlayer's public API. */
|
|
3843
3851
|
interface IPublicAPIEvent {
|
|
@@ -3932,6 +3940,8 @@ export interface IPublicApiContentInfos {
|
|
|
3932
3940
|
* has no MediaElementTracksStore.
|
|
3933
3941
|
*/
|
|
3934
3942
|
mediaElementTracksStore: IMediaElementTracksStore | null;
|
|
3943
|
+
/** Track types currently handled by the player for the loaded content. */
|
|
3944
|
+
handledTrackTypes: Record<ITrackType, boolean>;
|
|
3935
3945
|
/**
|
|
3936
3946
|
* If `true`, the RxPlayer's main logic is running in a WebWorker for this
|
|
3937
3947
|
* content.
|
|
@@ -471,7 +471,7 @@ export interface IStoredSessionEntry {
|
|
|
471
471
|
* awaited.
|
|
472
472
|
*/
|
|
473
473
|
closingStatus: /** Status when the MediaKeySession is currently being closed. */
|
|
474
|
-
|
|
474
|
+
| { type: "pending" }
|
|
475
475
|
/** Status when the MediaKeySession has been closed. */
|
|
476
476
|
| { type: "done" }
|
|
477
477
|
/** Status when the MediaKeySession failed to close. */
|
|
@@ -338,17 +338,25 @@ function getDirectFileInitialTime(
|
|
|
338
338
|
}
|
|
339
339
|
|
|
340
340
|
const duration = mediaElement.duration;
|
|
341
|
-
if (typeof startAt.fromLastPosition === "number") {
|
|
342
|
-
if (!isNullOrUndefined(duration) && isFinite(duration)) {
|
|
343
|
-
return Math.max(0, duration + startAt.fromLastPosition);
|
|
344
|
-
}
|
|
345
341
|
|
|
342
|
+
const getLastPosition = () => {
|
|
346
343
|
if (mediaElement.seekable.length > 0) {
|
|
347
344
|
const lastSegmentEnd = mediaElement.seekable.end(mediaElement.seekable.length - 1);
|
|
348
345
|
if (isFinite(lastSegmentEnd)) {
|
|
349
|
-
return
|
|
346
|
+
return lastSegmentEnd;
|
|
350
347
|
}
|
|
351
348
|
}
|
|
349
|
+
if (!isNullOrUndefined(duration) && isFinite(duration)) {
|
|
350
|
+
return duration;
|
|
351
|
+
}
|
|
352
|
+
return undefined;
|
|
353
|
+
};
|
|
354
|
+
|
|
355
|
+
if (typeof startAt.fromLastPosition === "number") {
|
|
356
|
+
const lastPosition = getLastPosition();
|
|
357
|
+
if (!isNullOrUndefined(lastPosition)) {
|
|
358
|
+
return Math.max(0, lastPosition + startAt.fromLastPosition);
|
|
359
|
+
}
|
|
352
360
|
log.warn(
|
|
353
361
|
"Init",
|
|
354
362
|
"startAt.fromLastPosition set but duration is not known, " +
|
|
@@ -356,17 +364,19 @@ function getDirectFileInitialTime(
|
|
|
356
364
|
);
|
|
357
365
|
return undefined;
|
|
358
366
|
} else if (typeof startAt.fromLivePosition === "number") {
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
"startAt.fromLivePosition set but live position is not known, " +
|
|
365
|
-
"beginning at 0.",
|
|
366
|
-
);
|
|
367
|
-
return 0;
|
|
367
|
+
// Directfile contents do not expose a distinct live edge here, so
|
|
368
|
+
// `fromLivePosition` falls back to the same reference point as `fromLastPosition`.
|
|
369
|
+
const livePosition = getLastPosition();
|
|
370
|
+
if (!isNullOrUndefined(livePosition)) {
|
|
371
|
+
return Math.max(0, livePosition + startAt.fromLivePosition);
|
|
368
372
|
}
|
|
369
|
-
|
|
373
|
+
log.warn(
|
|
374
|
+
"Init",
|
|
375
|
+
"startAt.fromLivePosition set but live position is not known, " +
|
|
376
|
+
"it may be too soon to seek",
|
|
377
|
+
);
|
|
378
|
+
|
|
379
|
+
return undefined;
|
|
370
380
|
} else if (!isNullOrUndefined(startAt.percentage)) {
|
|
371
381
|
if (isNullOrUndefined(duration) || !isFinite(duration)) {
|
|
372
382
|
log.warn(
|
|
@@ -64,6 +64,7 @@ import type IContentDecryptor from "../decrypt";
|
|
|
64
64
|
import { ContentDecryptorState, getKeySystemConfiguration } from "../decrypt";
|
|
65
65
|
import type { ITextDisplayer } from "../text_displayer";
|
|
66
66
|
import { MainThreadMessageType } from "../types";
|
|
67
|
+
import { canHandleTextTracks } from "../utils/media_capabilities";
|
|
67
68
|
import type { ITextDisplayerOptions } from "./types";
|
|
68
69
|
import { ContentInitializer } from "./types";
|
|
69
70
|
import type { ICorePlaybackObservation } from "./utils/create_core_playback_observer";
|
|
@@ -203,7 +204,7 @@ export default class MediaSourceContentInitializer extends ContentInitializer {
|
|
|
203
204
|
cmcd: this._settings.cmcd,
|
|
204
205
|
enableRepresentationAvoidance: this._settings.enableRepresentationAvoidance,
|
|
205
206
|
url: this._settings.url,
|
|
206
|
-
hasText: this.
|
|
207
|
+
hasText: canHandleTextTracks(this._settings.textTrackOptions),
|
|
207
208
|
transport,
|
|
208
209
|
transportOptions,
|
|
209
210
|
initialVideoBitrate,
|
|
@@ -358,16 +359,16 @@ export default class MediaSourceContentInitializer extends ContentInitializer {
|
|
|
358
359
|
this._settings.textTrackOptions.textTrackMode === "html" &&
|
|
359
360
|
features.htmlTextDisplayer !== null
|
|
360
361
|
) {
|
|
361
|
-
assert(this.
|
|
362
|
+
assert(canHandleTextTracks(this._settings.textTrackOptions));
|
|
362
363
|
textDisplayer = new features.htmlTextDisplayer(
|
|
363
364
|
mediaElement,
|
|
364
365
|
this._settings.textTrackOptions.textTrackElement,
|
|
365
366
|
);
|
|
366
367
|
} else if (features.nativeTextDisplayer !== null) {
|
|
367
|
-
assert(this.
|
|
368
|
+
assert(canHandleTextTracks(this._settings.textTrackOptions));
|
|
368
369
|
textDisplayer = new features.nativeTextDisplayer(mediaElement);
|
|
369
370
|
} else {
|
|
370
|
-
assert(!this.
|
|
371
|
+
assert(!canHandleTextTracks(this._settings.textTrackOptions));
|
|
371
372
|
}
|
|
372
373
|
} catch (err) {
|
|
373
374
|
log.error(
|
|
@@ -1575,14 +1576,6 @@ export default class MediaSourceContentInitializer extends ContentInitializer {
|
|
|
1575
1576
|
}
|
|
1576
1577
|
}
|
|
1577
1578
|
|
|
1578
|
-
private _hasTextBufferFeature(): boolean {
|
|
1579
|
-
return (
|
|
1580
|
-
(this._settings.textTrackOptions.textTrackMode === "html" &&
|
|
1581
|
-
features.htmlTextDisplayer !== null) ||
|
|
1582
|
-
features.nativeTextDisplayer !== null
|
|
1583
|
-
);
|
|
1584
|
-
}
|
|
1585
|
-
|
|
1586
1579
|
private _reload(
|
|
1587
1580
|
mediaElement: IMediaElement,
|
|
1588
1581
|
textDisplayer: ITextDisplayer | null,
|
|
@@ -2272,7 +2265,7 @@ function bindNumberReferencesToCore(
|
|
|
2272
2265
|
// overload, but the body here is not aware of that.
|
|
2273
2266
|
coreInterface.sendMessage({
|
|
2274
2267
|
type: MainThreadMessageType.ReferenceUpdate,
|
|
2275
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-explicit-any
|
|
2268
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-explicit-any, @typescript-eslint/no-unnecessary-type-assertion
|
|
2276
2269
|
value: { name: ref[1] as any, newVal: newVal as any },
|
|
2277
2270
|
});
|
|
2278
2271
|
},
|
|
@@ -123,7 +123,7 @@ function createPlaybackObserver(
|
|
|
123
123
|
deriveReadOnlyObserver() {
|
|
124
124
|
throw new Error("unused in this test");
|
|
125
125
|
},
|
|
126
|
-
}
|
|
126
|
+
};
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
function generateManifest(): IManifestMetadata {
|
|
@@ -451,6 +451,7 @@ export interface ITextTracksBufferSegmentData<
|
|
|
451
451
|
* It doesn't correspond at all to real code that will be called. This is just
|
|
452
452
|
* a hack to tell TypeScript to perform that check.
|
|
453
453
|
*/
|
|
454
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
454
455
|
if ((__ENVIRONMENT__.CURRENT_ENV as number) === (__ENVIRONMENT__.DEV as number)) {
|
|
455
456
|
// @ts-expect-error: uncalled function just for type-checking
|
|
456
457
|
function _checkType(input: ITextTrackSegmentData): void {
|