rx-player 4.5.0-dev.2026031700 → 4.5.0-dev.2026033100
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 +3 -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/compat/browser_compatibility_types.d.ts +16 -14
- package/dist/commonjs/compat/browser_compatibility_types.d.ts.map +1 -1
- package/dist/commonjs/compat/browser_compatibility_types.js +7 -4
- package/dist/commonjs/compat/browser_version.d.ts +2 -1
- package/dist/commonjs/compat/browser_version.d.ts.map +1 -1
- package/dist/commonjs/compat/browser_version.js +13 -0
- package/dist/commonjs/compat/disable_remote_playback_on_managed_media_source.d.ts.map +1 -1
- package/dist/commonjs/compat/disable_remote_playback_on_managed_media_source.js +1 -1
- package/dist/commonjs/compat/is_codec_supported.d.ts.map +1 -1
- package/dist/commonjs/compat/is_codec_supported.js +4 -3
- package/dist/commonjs/compat/should_patch_out_dolby_vision_config_data_from_mp4.d.ts +26 -0
- package/dist/commonjs/compat/should_patch_out_dolby_vision_config_data_from_mp4.d.ts.map +1 -0
- package/dist/commonjs/compat/should_patch_out_dolby_vision_config_data_from_mp4.js +45 -0
- package/dist/commonjs/core/entry/utils.js +3 -3
- package/dist/commonjs/core/fetchers/segment/segment_fetcher.d.ts.map +1 -1
- package/dist/commonjs/core/fetchers/segment/segment_fetcher.js +2 -1
- package/dist/commonjs/experimental/tools/VideoThumbnailLoader/prepare_source_buffer.d.ts.map +1 -1
- package/dist/commonjs/experimental/tools/VideoThumbnailLoader/prepare_source_buffer.js +2 -1
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/defaultCodecsFinder.d.ts.map +1 -1
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/defaultCodecsFinder.js +8 -6
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/mediaContentType.d.ts.map +1 -1
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/mediaContentType.js +4 -3
- package/dist/commonjs/initialize_worker.js +1 -1
- package/dist/commonjs/main_thread/api/debug/modules/segment_buffer_content.js +3 -3
- package/dist/commonjs/main_thread/api/public_api.js +2 -2
- package/dist/commonjs/main_thread/init/utils/update_manifest_codec_support.d.ts.map +1 -1
- package/dist/commonjs/main_thread/init/utils/update_manifest_codec_support.js +24 -12
- package/dist/commonjs/manifest/classes/adaptation.d.ts.map +1 -1
- package/dist/commonjs/manifest/classes/adaptation.js +3 -1
- package/dist/commonjs/manifest/classes/representation.d.ts +6 -2
- package/dist/commonjs/manifest/classes/representation.d.ts.map +1 -1
- package/dist/commonjs/manifest/classes/representation.js +45 -23
- package/dist/commonjs/manifest/types.d.ts +14 -6
- package/dist/commonjs/manifest/types.d.ts.map +1 -1
- package/dist/commonjs/manifest/utils.js +4 -4
- package/dist/commonjs/mse/main_media_source_interface.d.ts.map +1 -1
- package/dist/commonjs/mse/main_media_source_interface.js +3 -2
- package/dist/commonjs/mse/worker_media_source_interface.d.ts.map +1 -1
- package/dist/commonjs/parsers/containers/isobmff/get_box.d.ts +12 -1
- package/dist/commonjs/parsers/containers/isobmff/get_box.d.ts.map +1 -1
- package/dist/commonjs/parsers/containers/isobmff/get_box.js +16 -0
- package/dist/commonjs/parsers/containers/isobmff/index.d.ts +2 -1
- package/dist/commonjs/parsers/containers/isobmff/index.d.ts.map +1 -1
- package/dist/commonjs/parsers/containers/isobmff/index.js +3 -1
- package/dist/commonjs/parsers/containers/isobmff/remove_dolby_vision_config_data.d.ts +13 -0
- package/dist/commonjs/parsers/containers/isobmff/remove_dolby_vision_config_data.d.ts.map +1 -0
- package/dist/commonjs/parsers/containers/isobmff/remove_dolby_vision_config_data.js +180 -0
- package/dist/commonjs/parsers/manifest/metaplaylist/metaplaylist_parser.js +4 -4
- package/dist/commonjs/transports/dash/segment_parser.d.ts.map +1 -1
- package/dist/commonjs/transports/dash/segment_parser.js +6 -0
- package/dist/commonjs/transports/dash/text_parser.d.ts.map +1 -1
- package/dist/commonjs/transports/dash/text_parser.js +5 -1
- package/dist/commonjs/transports/local/text_parser.d.ts.map +1 -1
- package/dist/commonjs/transports/local/text_parser.js +5 -1
- package/dist/commonjs/transports/metaplaylist/pipelines.d.ts.map +1 -1
- package/dist/commonjs/transports/metaplaylist/pipelines.js +2 -1
- package/dist/commonjs/transports/smooth/pipelines.js +3 -3
- package/dist/commonjs/transports/types.d.ts +28 -2
- package/dist/commonjs/transports/types.d.ts.map +1 -1
- package/dist/commonjs/transports/utils/parse_text_track.d.ts +9 -2
- package/dist/commonjs/transports/utils/parse_text_track.d.ts.map +1 -1
- package/dist/commonjs/transports/utils/parse_text_track.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/browser_compatibility_types.d.ts +16 -14
- package/dist/es2017/compat/browser_compatibility_types.d.ts.map +1 -1
- package/dist/es2017/compat/browser_compatibility_types.js +7 -1
- package/dist/es2017/compat/browser_version.d.ts +2 -1
- package/dist/es2017/compat/browser_version.d.ts.map +1 -1
- package/dist/es2017/compat/browser_version.js +13 -1
- package/dist/es2017/compat/disable_remote_playback_on_managed_media_source.d.ts.map +1 -1
- package/dist/es2017/compat/disable_remote_playback_on_managed_media_source.js +2 -2
- package/dist/es2017/compat/is_codec_supported.d.ts.map +1 -1
- package/dist/es2017/compat/is_codec_supported.js +2 -1
- package/dist/es2017/compat/should_patch_out_dolby_vision_config_data_from_mp4.d.ts +26 -0
- package/dist/es2017/compat/should_patch_out_dolby_vision_config_data_from_mp4.d.ts.map +1 -0
- package/dist/es2017/compat/should_patch_out_dolby_vision_config_data_from_mp4.js +42 -0
- package/dist/es2017/core/entry/utils.js +4 -4
- package/dist/es2017/core/fetchers/segment/segment_fetcher.d.ts.map +1 -1
- package/dist/es2017/core/fetchers/segment/segment_fetcher.js +2 -1
- package/dist/es2017/experimental/tools/VideoThumbnailLoader/prepare_source_buffer.d.ts.map +1 -1
- package/dist/es2017/experimental/tools/VideoThumbnailLoader/prepare_source_buffer.js +2 -1
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/defaultCodecsFinder.d.ts.map +1 -1
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/defaultCodecsFinder.js +3 -1
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/mediaContentType.d.ts.map +1 -1
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/mediaContentType.js +2 -1
- package/dist/es2017/initialize_worker.js +1 -1
- package/dist/es2017/main_thread/api/debug/modules/segment_buffer_content.js +3 -3
- package/dist/es2017/main_thread/api/public_api.js +2 -2
- package/dist/es2017/main_thread/init/utils/update_manifest_codec_support.d.ts.map +1 -1
- package/dist/es2017/main_thread/init/utils/update_manifest_codec_support.js +9 -7
- package/dist/es2017/manifest/classes/adaptation.d.ts.map +1 -1
- package/dist/es2017/manifest/classes/adaptation.js +3 -1
- package/dist/es2017/manifest/classes/representation.d.ts +6 -2
- package/dist/es2017/manifest/classes/representation.d.ts.map +1 -1
- package/dist/es2017/manifest/classes/representation.js +45 -23
- package/dist/es2017/manifest/types.d.ts +14 -6
- package/dist/es2017/manifest/types.d.ts.map +1 -1
- package/dist/es2017/manifest/utils.js +4 -4
- package/dist/es2017/mse/main_media_source_interface.d.ts.map +1 -1
- package/dist/es2017/mse/main_media_source_interface.js +2 -1
- package/dist/es2017/mse/worker_media_source_interface.d.ts.map +1 -1
- package/dist/es2017/parsers/containers/isobmff/get_box.d.ts +12 -1
- package/dist/es2017/parsers/containers/isobmff/get_box.d.ts.map +1 -1
- package/dist/es2017/parsers/containers/isobmff/get_box.js +16 -1
- package/dist/es2017/parsers/containers/isobmff/index.d.ts +2 -1
- package/dist/es2017/parsers/containers/isobmff/index.d.ts.map +1 -1
- package/dist/es2017/parsers/containers/isobmff/index.js +2 -1
- package/dist/es2017/parsers/containers/isobmff/remove_dolby_vision_config_data.d.ts +13 -0
- package/dist/es2017/parsers/containers/isobmff/remove_dolby_vision_config_data.d.ts.map +1 -0
- package/dist/es2017/parsers/containers/isobmff/remove_dolby_vision_config_data.js +155 -0
- package/dist/es2017/parsers/manifest/metaplaylist/metaplaylist_parser.js +4 -4
- package/dist/es2017/transports/dash/segment_parser.d.ts.map +1 -1
- package/dist/es2017/transports/dash/segment_parser.js +7 -1
- package/dist/es2017/transports/dash/text_parser.d.ts.map +1 -1
- package/dist/es2017/transports/dash/text_parser.js +5 -1
- package/dist/es2017/transports/local/text_parser.d.ts.map +1 -1
- package/dist/es2017/transports/local/text_parser.js +5 -1
- package/dist/es2017/transports/metaplaylist/pipelines.d.ts.map +1 -1
- package/dist/es2017/transports/metaplaylist/pipelines.js +2 -1
- package/dist/es2017/transports/smooth/pipelines.js +3 -3
- package/dist/es2017/transports/types.d.ts +28 -2
- package/dist/es2017/transports/types.d.ts.map +1 -1
- package/dist/es2017/transports/utils/parse_text_track.d.ts +9 -2
- package/dist/es2017/transports/utils/parse_text_track.d.ts.map +1 -1
- package/dist/es2017/transports/utils/parse_text_track.js +1 -1
- package/dist/worker.js +6 -6
- package/eslint.config.mjs +1 -14
- package/package.json +1 -1
- package/src/__GENERATED_CODE/embedded_worker.ts +1 -1
- package/src/compat/__tests__/browser_compatibility_types.test.ts +15 -26
- package/src/compat/__tests__/browser_version.test.ts +57 -18
- package/src/compat/__tests__/clear_element_src.test.ts +20 -40
- package/src/compat/__tests__/is_codec_supported.test.ts +39 -44
- package/src/compat/__tests__/is_vtt_cue.test.ts +5 -8
- package/src/compat/__tests__/make_vtt_cue.test.ts +20 -31
- package/src/compat/__tests__/remove_cue.test.ts +8 -20
- package/src/compat/__tests__/should_patch_out_dolby_vision_config_data_from_mp4.test.ts +78 -0
- package/src/compat/browser_compatibility_types.ts +8 -1
- package/src/compat/browser_version.ts +17 -1
- package/src/compat/disable_remote_playback_on_managed_media_source.ts +2 -2
- package/src/compat/is_codec_supported.ts +2 -1
- package/src/compat/should_patch_out_dolby_vision_config_data_from_mp4.ts +50 -0
- package/src/core/adaptive/__tests__/adaptive_representation_selector.test.ts +68 -28
- package/src/core/adaptive/__tests__/buffer_based_chooser.test.ts +26 -84
- package/src/core/entry/__tests__/utils.test.ts +7 -1
- package/src/core/entry/utils.ts +4 -4
- package/src/core/fetchers/segment/segment_fetcher.ts +2 -1
- package/src/errors/__tests__/format_error.test.ts +23 -24
- package/src/experimental/tools/VideoThumbnailLoader/prepare_source_buffer.ts +2 -1
- package/src/experimental/tools/mediaCapabilitiesProber/__tests__/probers/mediaDisplayInfos.test.ts +106 -0
- package/src/experimental/tools/mediaCapabilitiesProber/probers/__tests__/HDCPPolicy.test.ts +19 -42
- package/src/experimental/tools/mediaCapabilitiesProber/probers/__tests__/decodingInfo.test.ts +33 -40
- package/src/experimental/tools/mediaCapabilitiesProber/probers/__tests__/defaultCodecsFinder.test.ts +44 -68
- package/src/experimental/tools/mediaCapabilitiesProber/probers/__tests__/mediaContentType.test.ts +45 -80
- package/src/experimental/tools/mediaCapabilitiesProber/probers/defaultCodecsFinder.ts +3 -1
- package/src/experimental/tools/mediaCapabilitiesProber/probers/mediaContentType.ts +2 -1
- package/src/features/__tests__/add_features.test.ts +12 -27
- package/src/initialize_worker.ts +1 -1
- package/src/main_thread/api/__tests__/option_utils.test.ts +38 -67
- package/src/main_thread/api/__tests__/public_api.test.ts +56 -138
- package/src/main_thread/api/debug/modules/segment_buffer_content.ts +3 -3
- package/src/main_thread/api/public_api.ts +2 -2
- package/src/main_thread/decrypt/__tests__/__global__/find_key_system.test.ts +46 -28
- package/src/main_thread/decrypt/__tests__/__global__/get_license.test.ts +40 -10
- package/src/main_thread/decrypt/__tests__/__global__/init_data.test.ts +112 -129
- package/src/main_thread/decrypt/__tests__/__global__/media_key_system_access.test.ts +282 -377
- package/src/main_thread/decrypt/__tests__/__global__/media_keys.test.ts +70 -63
- package/src/main_thread/decrypt/__tests__/__global__/server_certificate.test.ts +73 -54
- package/src/main_thread/decrypt/__tests__/__global__/utils.ts +43 -83
- package/src/main_thread/decrypt/__tests__/find_key_system.test.ts +36 -17
- package/src/main_thread/decrypt/utils/__tests__/clean_old_stored_persistent_info.test.ts +44 -48
- package/src/main_thread/init/utils/__tests__/are_same_stream_events.test.ts +7 -22
- package/src/main_thread/init/utils/__tests__/refresh_scheduled_events_list.test.ts +3 -6
- package/src/main_thread/init/utils/__tests__/update_manifest_codec_support.test.ts +42 -19
- package/src/main_thread/init/utils/update_manifest_codec_support.ts +8 -6
- package/src/manifest/classes/__tests__/adaptation.test.ts +69 -125
- package/src/manifest/classes/__tests__/manifest.test.ts +88 -95
- package/src/manifest/classes/__tests__/period.test.ts +167 -117
- package/src/manifest/classes/__tests__/representation.test.ts +84 -25
- package/src/manifest/classes/__tests__/update_periods.test.ts +96 -225
- package/src/manifest/classes/adaptation.ts +4 -1
- package/src/manifest/classes/representation.ts +59 -27
- package/src/manifest/types.ts +14 -6
- package/src/manifest/utils.ts +4 -4
- package/src/mse/__tests__/main_media_source_interface.test.ts +3 -1
- package/src/mse/__tests__/worker_media_source_interface.test.ts +608 -0
- package/src/mse/main_media_source_interface.ts +2 -1
- package/src/mse/worker_media_source_interface.ts +2 -2
- package/src/parsers/containers/isobmff/__tests__/get_box.test.ts +449 -0
- package/src/parsers/containers/isobmff/__tests__/remove_dolby_vision_config_data.test.ts +282 -0
- package/src/parsers/containers/isobmff/get_box.ts +17 -0
- package/src/parsers/containers/isobmff/index.ts +8 -1
- package/src/parsers/containers/isobmff/remove_dolby_vision_config_data.ts +179 -0
- package/src/parsers/manifest/dash/common/__tests__/get_clock_offset.test.ts +19 -25
- package/src/parsers/manifest/dash/common/__tests__/get_http_utc-timing_url.test.ts +7 -19
- package/src/parsers/manifest/dash/js-parser/node_parsers/__tests__/ContentProtection.test.ts +26 -37
- package/src/parsers/manifest/dash/js-parser/node_parsers/__tests__/Initialization.test.ts +24 -53
- package/src/parsers/manifest/dash/js-parser/node_parsers/__tests__/SegmentURL.test.ts +31 -78
- package/src/parsers/manifest/metaplaylist/metaplaylist_parser.ts +6 -4
- package/src/parsers/manifest/utils/__tests__/update_segment_timeline.test.ts +79 -87
- package/src/parsers/texttracks/ttml/__tests__/resolve_styles_inheritance.test.ts +20 -26
- package/src/parsers/texttracks/ttml/html/__tests__/__global__/html_ttml_parser.test.ts +2 -7
- package/src/parsers/texttracks/webvtt/__tests__/parse_cue_block.test.ts +33 -30
- package/src/parsers/texttracks/webvtt/__tests__/parse_style_block.test.ts +33 -100
- package/src/parsers/texttracks/webvtt/html/__tests__/convert_payload_to_html.test.ts +16 -18
- package/src/parsers/texttracks/webvtt/html/__tests__/parse_webvtt_to_div.test.ts +73 -78
- package/src/parsers/texttracks/webvtt/html/__tests__/to_html.test.ts +36 -37
- package/src/transports/dash/segment_parser.ts +13 -0
- package/src/transports/dash/text_parser.ts +5 -1
- package/src/transports/local/text_parser.ts +5 -1
- package/src/transports/metaplaylist/pipelines.ts +2 -1
- package/src/transports/smooth/isobmff/__tests__/create_boxes.test.ts +150 -127
- package/src/transports/smooth/pipelines.ts +3 -3
- package/src/transports/types.ts +28 -2
- package/src/transports/utils/__tests__/check_isobmff_integrity.test.ts +49 -75
- package/src/transports/utils/parse_text_track.ts +10 -3
- package/src/utils/__tests__/object_assign.test.ts +2 -2
|
@@ -2,15 +2,30 @@ import { describe, beforeEach, it, expect, vi } from "vitest";
|
|
|
2
2
|
import type { IParsedAdaptation, IParsedPeriod } from "../../../parsers/manifest";
|
|
3
3
|
import type Adaptation from "../adaptation";
|
|
4
4
|
import CodecSupportCache from "../codec_support_cache";
|
|
5
|
-
import
|
|
5
|
+
import Period from "../period";
|
|
6
|
+
|
|
7
|
+
const mocks = vi.hoisted(() => {
|
|
8
|
+
const fakeAdaptation = vi.fn();
|
|
9
|
+
const SUPPORTED_ADAPTATIONS_TYPE: string[] = [];
|
|
10
|
+
return {
|
|
11
|
+
fakeAdaptation,
|
|
12
|
+
SUPPORTED_ADAPTATIONS_TYPE,
|
|
13
|
+
};
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
vi.mock("../adaptation", () => ({
|
|
17
|
+
default: mocks.fakeAdaptation,
|
|
18
|
+
}));
|
|
6
19
|
|
|
7
20
|
describe("Manifest - Period", () => {
|
|
8
21
|
beforeEach(() => {
|
|
22
|
+
mocks.fakeAdaptation.mockClear();
|
|
23
|
+
mocks.SUPPORTED_ADAPTATIONS_TYPE.length = 0;
|
|
9
24
|
vi.resetModules();
|
|
10
25
|
});
|
|
11
26
|
|
|
12
27
|
it("should throw if no adaptation is given", async () => {
|
|
13
|
-
|
|
28
|
+
mocks.fakeAdaptation.mockImplementation(function (arg: IParsedAdaptation) {
|
|
14
29
|
return {
|
|
15
30
|
...arg,
|
|
16
31
|
supportStatus: {
|
|
@@ -20,14 +35,10 @@ describe("Manifest - Period", () => {
|
|
|
20
35
|
},
|
|
21
36
|
};
|
|
22
37
|
});
|
|
23
|
-
|
|
24
|
-
default: mockAdaptation,
|
|
25
|
-
SUPPORTED_ADAPTATIONS_TYPE: ["audio", "video", "text"],
|
|
26
|
-
}));
|
|
38
|
+
mocks.SUPPORTED_ADAPTATIONS_TYPE.push(...["audio", "video", "text"]);
|
|
27
39
|
|
|
28
|
-
const Period = (await vi.importActual("../period")).default as typeof IPeriod;
|
|
29
40
|
const args = { id: "12", adaptations: {}, start: 0, thumbnailTracks: [] };
|
|
30
|
-
let period:
|
|
41
|
+
let period: Period | null = null;
|
|
31
42
|
let errorReceived: unknown = null;
|
|
32
43
|
try {
|
|
33
44
|
const codecSupportCache = new CodecSupportCache([]);
|
|
@@ -49,11 +60,13 @@ describe("Manifest - Period", () => {
|
|
|
49
60
|
expect(errorReceived.message).toContain(
|
|
50
61
|
"The manifest has no video nor audio tracks.",
|
|
51
62
|
);
|
|
52
|
-
expect(
|
|
63
|
+
expect(mocks.fakeAdaptation).not.toHaveBeenCalled();
|
|
53
64
|
});
|
|
54
65
|
|
|
55
66
|
it("should throw if no audio nor video adaptation is given", async () => {
|
|
56
|
-
|
|
67
|
+
mocks.fakeAdaptation.mockImplementation(function (
|
|
68
|
+
arg: IParsedAdaptation,
|
|
69
|
+
): Adaptation {
|
|
57
70
|
return {
|
|
58
71
|
...arg,
|
|
59
72
|
supportStatus: {
|
|
@@ -63,12 +76,8 @@ describe("Manifest - Period", () => {
|
|
|
63
76
|
},
|
|
64
77
|
} as unknown as Adaptation;
|
|
65
78
|
});
|
|
66
|
-
|
|
67
|
-
default: mockAdaptation,
|
|
68
|
-
SUPPORTED_ADAPTATIONS_TYPE: ["audio", "video", "text", "foo"],
|
|
69
|
-
}));
|
|
79
|
+
mocks.SUPPORTED_ADAPTATIONS_TYPE.push(...["audio", "video", "text", "foo"]);
|
|
70
80
|
|
|
71
|
-
const Period = (await vi.importActual("../period")).default as typeof IPeriod;
|
|
72
81
|
const fooAda1 = {
|
|
73
82
|
type: "foo",
|
|
74
83
|
id: "54",
|
|
@@ -86,7 +95,7 @@ describe("Manifest - Period", () => {
|
|
|
86
95
|
start: 0,
|
|
87
96
|
thumbnailTracks: [],
|
|
88
97
|
} as unknown as IParsedPeriod;
|
|
89
|
-
let period:
|
|
98
|
+
let period: Period | null = null;
|
|
90
99
|
let errorReceived: unknown = null;
|
|
91
100
|
const codecSupportCache = new CodecSupportCache([]);
|
|
92
101
|
try {
|
|
@@ -110,13 +119,25 @@ describe("Manifest - Period", () => {
|
|
|
110
119
|
"The manifest has no video nor audio tracks.",
|
|
111
120
|
);
|
|
112
121
|
|
|
113
|
-
expect(
|
|
114
|
-
expect(
|
|
115
|
-
|
|
122
|
+
expect(mocks.fakeAdaptation).toHaveBeenCalledTimes(2);
|
|
123
|
+
expect(mocks.fakeAdaptation).toHaveBeenNthCalledWith(
|
|
124
|
+
1,
|
|
125
|
+
fooAda1,
|
|
126
|
+
codecSupportCache,
|
|
127
|
+
{},
|
|
128
|
+
);
|
|
129
|
+
expect(mocks.fakeAdaptation).toHaveBeenNthCalledWith(
|
|
130
|
+
2,
|
|
131
|
+
fooAda2,
|
|
132
|
+
codecSupportCache,
|
|
133
|
+
{},
|
|
134
|
+
);
|
|
116
135
|
});
|
|
117
136
|
|
|
118
137
|
it("should throw if only empty audio and video adaptations is given", async () => {
|
|
119
|
-
|
|
138
|
+
mocks.fakeAdaptation.mockImplementation(function (
|
|
139
|
+
arg: IParsedAdaptation,
|
|
140
|
+
): Adaptation {
|
|
120
141
|
return {
|
|
121
142
|
...arg,
|
|
122
143
|
supportStatus: {
|
|
@@ -126,19 +147,15 @@ describe("Manifest - Period", () => {
|
|
|
126
147
|
},
|
|
127
148
|
} as unknown as Adaptation;
|
|
128
149
|
});
|
|
129
|
-
|
|
130
|
-
default: mockAdaptation,
|
|
131
|
-
SUPPORTED_ADAPTATIONS_TYPE: ["audio", "video", "text", "foo"],
|
|
132
|
-
}));
|
|
150
|
+
mocks.SUPPORTED_ADAPTATIONS_TYPE.push(...["audio", "video", "text", "foo"]);
|
|
133
151
|
|
|
134
|
-
const Period = (await vi.importActual("../period")).default as typeof IPeriod;
|
|
135
152
|
const args = {
|
|
136
153
|
id: "12",
|
|
137
154
|
thumbnailTracks: [],
|
|
138
155
|
adaptations: { video: [], audio: [] },
|
|
139
156
|
start: 0,
|
|
140
157
|
};
|
|
141
|
-
let period:
|
|
158
|
+
let period: Period | null = null;
|
|
142
159
|
let errorReceived: unknown = null;
|
|
143
160
|
try {
|
|
144
161
|
const codecSupportCache = new CodecSupportCache([]);
|
|
@@ -162,11 +179,13 @@ describe("Manifest - Period", () => {
|
|
|
162
179
|
"The manifest has no video nor audio tracks.",
|
|
163
180
|
);
|
|
164
181
|
|
|
165
|
-
expect(
|
|
182
|
+
expect(mocks.fakeAdaptation).toHaveBeenCalledTimes(0);
|
|
166
183
|
});
|
|
167
184
|
|
|
168
185
|
it("should throw if there is no video nor audio representations in any adaptations.", async () => {
|
|
169
|
-
|
|
186
|
+
mocks.fakeAdaptation.mockImplementation(function (
|
|
187
|
+
arg: IParsedAdaptation,
|
|
188
|
+
): Adaptation {
|
|
170
189
|
return {
|
|
171
190
|
...arg,
|
|
172
191
|
supportStatus: {
|
|
@@ -176,12 +195,8 @@ describe("Manifest - Period", () => {
|
|
|
176
195
|
},
|
|
177
196
|
} as unknown as Adaptation;
|
|
178
197
|
});
|
|
179
|
-
|
|
180
|
-
default: mockAdaptation,
|
|
181
|
-
SUPPORTED_ADAPTATIONS_TYPE: ["audio", "video", "text", "foo"],
|
|
182
|
-
}));
|
|
198
|
+
mocks.SUPPORTED_ADAPTATIONS_TYPE.push(...["audio", "video", "text", "foo"]);
|
|
183
199
|
|
|
184
|
-
const Period = (await vi.importActual("../period")).default as typeof IPeriod;
|
|
185
200
|
const videoAda1 = {
|
|
186
201
|
type: "video",
|
|
187
202
|
id: "54",
|
|
@@ -231,7 +246,7 @@ describe("Manifest - Period", () => {
|
|
|
231
246
|
thumbnailTracks: [],
|
|
232
247
|
start: 0,
|
|
233
248
|
} as unknown as IParsedPeriod;
|
|
234
|
-
let period:
|
|
249
|
+
let period: Period | null = null;
|
|
235
250
|
let errorReceived: unknown = null;
|
|
236
251
|
try {
|
|
237
252
|
const codecSupportCache = new CodecSupportCache([]);
|
|
@@ -257,7 +272,9 @@ describe("Manifest - Period", () => {
|
|
|
257
272
|
});
|
|
258
273
|
|
|
259
274
|
it("should not throw if there is no video representation but it has an audio representation.", async () => {
|
|
260
|
-
|
|
275
|
+
mocks.fakeAdaptation.mockImplementation(function (
|
|
276
|
+
arg: IParsedAdaptation,
|
|
277
|
+
): Adaptation {
|
|
261
278
|
return {
|
|
262
279
|
...arg,
|
|
263
280
|
supportStatus: {
|
|
@@ -267,12 +284,8 @@ describe("Manifest - Period", () => {
|
|
|
267
284
|
},
|
|
268
285
|
} as unknown as Adaptation;
|
|
269
286
|
});
|
|
270
|
-
|
|
271
|
-
default: mockAdaptation,
|
|
272
|
-
SUPPORTED_ADAPTATIONS_TYPE: ["audio", "video", "text"],
|
|
273
|
-
}));
|
|
287
|
+
mocks.SUPPORTED_ADAPTATIONS_TYPE.push(...["audio", "video", "text"]);
|
|
274
288
|
|
|
275
|
-
const Period = (await vi.importActual("../period")).default as typeof IPeriod;
|
|
276
289
|
const videoAdaptation = {
|
|
277
290
|
type: "video",
|
|
278
291
|
id: "54",
|
|
@@ -297,7 +310,7 @@ describe("Manifest - Period", () => {
|
|
|
297
310
|
start: 0,
|
|
298
311
|
thumbnailTracks: [],
|
|
299
312
|
} as unknown as IParsedPeriod;
|
|
300
|
-
let period:
|
|
313
|
+
let period: Period | null = null;
|
|
301
314
|
let errorReceived: unknown = null;
|
|
302
315
|
try {
|
|
303
316
|
const codecSupportCache = new CodecSupportCache([]);
|
|
@@ -311,7 +324,9 @@ describe("Manifest - Period", () => {
|
|
|
311
324
|
});
|
|
312
325
|
|
|
313
326
|
it("should report that all video adaptations are not supported", async () => {
|
|
314
|
-
|
|
327
|
+
mocks.fakeAdaptation.mockImplementation(function (
|
|
328
|
+
arg: IParsedAdaptation,
|
|
329
|
+
): Adaptation {
|
|
315
330
|
return {
|
|
316
331
|
...arg,
|
|
317
332
|
supportStatus: {
|
|
@@ -321,12 +336,8 @@ describe("Manifest - Period", () => {
|
|
|
321
336
|
},
|
|
322
337
|
} as unknown as Adaptation;
|
|
323
338
|
});
|
|
324
|
-
|
|
325
|
-
default: mockAdaptation,
|
|
326
|
-
SUPPORTED_ADAPTATIONS_TYPE: ["audio", "video", "text", "foo"],
|
|
327
|
-
}));
|
|
339
|
+
mocks.SUPPORTED_ADAPTATIONS_TYPE.push(...["audio", "video", "text", "foo"]);
|
|
328
340
|
|
|
329
|
-
const Period = (await vi.importActual("../period")).default as typeof IPeriod;
|
|
330
341
|
const videoAda1 = {
|
|
331
342
|
type: "video",
|
|
332
343
|
id: "54",
|
|
@@ -393,7 +404,9 @@ describe("Manifest - Period", () => {
|
|
|
393
404
|
});
|
|
394
405
|
|
|
395
406
|
it("should not set a parsing error if an empty unsupported adaptation is given", async () => {
|
|
396
|
-
|
|
407
|
+
mocks.fakeAdaptation.mockImplementation(function (
|
|
408
|
+
arg: IParsedAdaptation,
|
|
409
|
+
): Adaptation {
|
|
397
410
|
return {
|
|
398
411
|
...arg,
|
|
399
412
|
supportStatus: {
|
|
@@ -403,12 +416,7 @@ describe("Manifest - Period", () => {
|
|
|
403
416
|
},
|
|
404
417
|
} as unknown as Adaptation;
|
|
405
418
|
});
|
|
406
|
-
|
|
407
|
-
default: mockAdaptation,
|
|
408
|
-
SUPPORTED_ADAPTATIONS_TYPE: ["audio", "video", "text", "foo"],
|
|
409
|
-
}));
|
|
410
|
-
|
|
411
|
-
const Period = (await vi.importActual("../period")).default as typeof IPeriod;
|
|
419
|
+
mocks.SUPPORTED_ADAPTATIONS_TYPE.push(...["audio", "video", "text", "foo"]);
|
|
412
420
|
|
|
413
421
|
const videoAda1 = {
|
|
414
422
|
type: "video",
|
|
@@ -439,13 +447,15 @@ describe("Manifest - Period", () => {
|
|
|
439
447
|
})),
|
|
440
448
|
});
|
|
441
449
|
|
|
442
|
-
expect(
|
|
443
|
-
expect(
|
|
450
|
+
expect(mocks.fakeAdaptation).toHaveBeenCalledTimes(1);
|
|
451
|
+
expect(mocks.fakeAdaptation).toHaveBeenCalledWith(videoAda1, codecSupportCache, {});
|
|
444
452
|
expect(period.adaptations.audio).toBe(undefined);
|
|
445
453
|
});
|
|
446
454
|
|
|
447
|
-
it("should give a representationFilter to the adaptation",
|
|
448
|
-
|
|
455
|
+
it("should give a representationFilter to the adaptation", () => {
|
|
456
|
+
mocks.fakeAdaptation.mockImplementation(function (
|
|
457
|
+
arg: IParsedAdaptation,
|
|
458
|
+
): Adaptation {
|
|
449
459
|
return {
|
|
450
460
|
...arg,
|
|
451
461
|
supportStatus: {
|
|
@@ -456,12 +466,8 @@ describe("Manifest - Period", () => {
|
|
|
456
466
|
} as unknown as Adaptation;
|
|
457
467
|
});
|
|
458
468
|
const representationFilter = vi.fn();
|
|
459
|
-
|
|
460
|
-
default: mockAdaptation,
|
|
461
|
-
SUPPORTED_ADAPTATIONS_TYPE: ["audio", "video", "text"],
|
|
462
|
-
}));
|
|
469
|
+
mocks.SUPPORTED_ADAPTATIONS_TYPE.push(...["audio", "video", "text"]);
|
|
463
470
|
|
|
464
|
-
const Period = (await vi.importActual("../period")).default as typeof IPeriod;
|
|
465
471
|
const videoAda1 = {
|
|
466
472
|
type: "video",
|
|
467
473
|
id: "54",
|
|
@@ -485,18 +491,30 @@ describe("Manifest - Period", () => {
|
|
|
485
491
|
|
|
486
492
|
expect(period.adaptations.video).toHaveLength(2);
|
|
487
493
|
|
|
488
|
-
expect(
|
|
489
|
-
expect(
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
494
|
+
expect(mocks.fakeAdaptation).toHaveBeenCalledTimes(2);
|
|
495
|
+
expect(mocks.fakeAdaptation).toHaveBeenNthCalledWith(
|
|
496
|
+
1,
|
|
497
|
+
videoAda1,
|
|
498
|
+
codecSupportCache,
|
|
499
|
+
{
|
|
500
|
+
representationFilter,
|
|
501
|
+
},
|
|
502
|
+
);
|
|
503
|
+
expect(mocks.fakeAdaptation).toHaveBeenNthCalledWith(
|
|
504
|
+
2,
|
|
505
|
+
videoAda2,
|
|
506
|
+
codecSupportCache,
|
|
507
|
+
{
|
|
508
|
+
representationFilter,
|
|
509
|
+
},
|
|
510
|
+
);
|
|
495
511
|
expect(representationFilter).not.toHaveBeenCalled();
|
|
496
512
|
});
|
|
497
513
|
|
|
498
514
|
it("should not report if an Adaptation has no Representation", async () => {
|
|
499
|
-
|
|
515
|
+
mocks.fakeAdaptation.mockImplementation(function (
|
|
516
|
+
arg: IParsedAdaptation,
|
|
517
|
+
): Adaptation {
|
|
500
518
|
return {
|
|
501
519
|
...arg,
|
|
502
520
|
supportStatus: {
|
|
@@ -506,12 +524,8 @@ describe("Manifest - Period", () => {
|
|
|
506
524
|
},
|
|
507
525
|
} as unknown as Adaptation;
|
|
508
526
|
});
|
|
509
|
-
|
|
510
|
-
default: mockAdaptation,
|
|
511
|
-
SUPPORTED_ADAPTATIONS_TYPE: ["audio", "video", "text"],
|
|
512
|
-
}));
|
|
527
|
+
mocks.SUPPORTED_ADAPTATIONS_TYPE.push(...["audio", "video", "text"]);
|
|
513
528
|
|
|
514
|
-
const Period = (await vi.importActual("../period")).default as typeof IPeriod;
|
|
515
529
|
const videoAda1 = {
|
|
516
530
|
type: "video",
|
|
517
531
|
id: "54",
|
|
@@ -548,7 +562,9 @@ describe("Manifest - Period", () => {
|
|
|
548
562
|
});
|
|
549
563
|
|
|
550
564
|
it("should set the given start", async () => {
|
|
551
|
-
|
|
565
|
+
mocks.fakeAdaptation.mockImplementation(function (
|
|
566
|
+
arg: IParsedAdaptation,
|
|
567
|
+
): Adaptation {
|
|
552
568
|
return {
|
|
553
569
|
...arg,
|
|
554
570
|
supportStatus: {
|
|
@@ -558,12 +574,8 @@ describe("Manifest - Period", () => {
|
|
|
558
574
|
},
|
|
559
575
|
} as unknown as Adaptation;
|
|
560
576
|
});
|
|
561
|
-
|
|
562
|
-
default: mockAdaptation,
|
|
563
|
-
SUPPORTED_ADAPTATIONS_TYPE: ["audio", "video", "text"],
|
|
564
|
-
}));
|
|
577
|
+
mocks.SUPPORTED_ADAPTATIONS_TYPE.push(...["audio", "video", "text"]);
|
|
565
578
|
|
|
566
|
-
const Period = (await vi.importActual("../period")).default as typeof IPeriod;
|
|
567
579
|
const videoAda1 = {
|
|
568
580
|
type: "video",
|
|
569
581
|
id: "54",
|
|
@@ -590,7 +602,9 @@ describe("Manifest - Period", () => {
|
|
|
590
602
|
});
|
|
591
603
|
|
|
592
604
|
it("should set a given duration", async () => {
|
|
593
|
-
|
|
605
|
+
mocks.fakeAdaptation.mockImplementation(function (
|
|
606
|
+
arg: IParsedAdaptation,
|
|
607
|
+
): Adaptation {
|
|
594
608
|
return {
|
|
595
609
|
...arg,
|
|
596
610
|
supportStatus: {
|
|
@@ -600,12 +614,8 @@ describe("Manifest - Period", () => {
|
|
|
600
614
|
},
|
|
601
615
|
} as unknown as Adaptation;
|
|
602
616
|
});
|
|
603
|
-
|
|
604
|
-
default: mockAdaptation,
|
|
605
|
-
SUPPORTED_ADAPTATIONS_TYPE: ["audio", "video", "text"],
|
|
606
|
-
}));
|
|
617
|
+
mocks.SUPPORTED_ADAPTATIONS_TYPE.push(...["audio", "video", "text"]);
|
|
607
618
|
|
|
608
|
-
const Period = (await vi.importActual("../period")).default as typeof IPeriod;
|
|
609
619
|
const videoAda1 = {
|
|
610
620
|
type: "video",
|
|
611
621
|
id: "54",
|
|
@@ -638,7 +648,9 @@ describe("Manifest - Period", () => {
|
|
|
638
648
|
});
|
|
639
649
|
|
|
640
650
|
it("should infer the end from the start and the duration", async () => {
|
|
641
|
-
|
|
651
|
+
mocks.fakeAdaptation.mockImplementation(function (
|
|
652
|
+
arg: IParsedAdaptation,
|
|
653
|
+
): Adaptation {
|
|
642
654
|
return {
|
|
643
655
|
...arg,
|
|
644
656
|
supportStatus: {
|
|
@@ -648,12 +660,8 @@ describe("Manifest - Period", () => {
|
|
|
648
660
|
},
|
|
649
661
|
} as unknown as Adaptation;
|
|
650
662
|
});
|
|
651
|
-
|
|
652
|
-
default: mockAdaptation,
|
|
653
|
-
SUPPORTED_ADAPTATIONS_TYPE: ["audio", "video", "text"],
|
|
654
|
-
}));
|
|
663
|
+
mocks.SUPPORTED_ADAPTATIONS_TYPE.push(...["audio", "video", "text"]);
|
|
655
664
|
|
|
656
|
-
const Period = (await vi.importActual("../period")).default as typeof IPeriod;
|
|
657
665
|
const videoAda1 = {
|
|
658
666
|
type: "video",
|
|
659
667
|
id: "54",
|
|
@@ -686,7 +694,9 @@ describe("Manifest - Period", () => {
|
|
|
686
694
|
});
|
|
687
695
|
|
|
688
696
|
it("should return every Adaptations combined with `getAdaptations`", async () => {
|
|
689
|
-
|
|
697
|
+
mocks.fakeAdaptation.mockImplementation(function (
|
|
698
|
+
arg: IParsedAdaptation,
|
|
699
|
+
): Adaptation {
|
|
690
700
|
return {
|
|
691
701
|
...arg,
|
|
692
702
|
supportStatus: {
|
|
@@ -696,12 +706,8 @@ describe("Manifest - Period", () => {
|
|
|
696
706
|
},
|
|
697
707
|
} as unknown as Adaptation;
|
|
698
708
|
});
|
|
699
|
-
|
|
700
|
-
default: mockAdaptation,
|
|
701
|
-
SUPPORTED_ADAPTATIONS_TYPE: ["audio", "video", "text"],
|
|
702
|
-
}));
|
|
709
|
+
mocks.SUPPORTED_ADAPTATIONS_TYPE.push(...["audio", "video", "text"]);
|
|
703
710
|
|
|
704
|
-
const Period = (await vi.importActual("../period")).default as typeof IPeriod;
|
|
705
711
|
const videoAda1 = {
|
|
706
712
|
type: "video",
|
|
707
713
|
id: "54",
|
|
@@ -746,7 +752,9 @@ describe("Manifest - Period", () => {
|
|
|
746
752
|
});
|
|
747
753
|
|
|
748
754
|
it("should return every Adaptations from a given type with `getAdaptationsForType`", async () => {
|
|
749
|
-
|
|
755
|
+
mocks.fakeAdaptation.mockImplementation(function (
|
|
756
|
+
arg: IParsedAdaptation,
|
|
757
|
+
): Adaptation {
|
|
750
758
|
return {
|
|
751
759
|
...arg,
|
|
752
760
|
supportStatus: {
|
|
@@ -756,12 +764,8 @@ describe("Manifest - Period", () => {
|
|
|
756
764
|
},
|
|
757
765
|
} as unknown as Adaptation;
|
|
758
766
|
});
|
|
759
|
-
|
|
760
|
-
default: mockAdaptation,
|
|
761
|
-
SUPPORTED_ADAPTATIONS_TYPE: ["audio", "video", "text"],
|
|
762
|
-
}));
|
|
767
|
+
mocks.SUPPORTED_ADAPTATIONS_TYPE.push(...["audio", "video", "text"]);
|
|
763
768
|
|
|
764
|
-
const Period = (await vi.importActual("../period")).default as typeof IPeriod;
|
|
765
769
|
const videoAda1 = {
|
|
766
770
|
type: "video",
|
|
767
771
|
id: "54",
|
|
@@ -815,7 +819,9 @@ describe("Manifest - Period", () => {
|
|
|
815
819
|
});
|
|
816
820
|
|
|
817
821
|
it("should return the first Adaptations with a given Id when calling `getAdaptation`", async () => {
|
|
818
|
-
|
|
822
|
+
mocks.fakeAdaptation.mockImplementation(function (
|
|
823
|
+
arg: IParsedAdaptation,
|
|
824
|
+
): Adaptation {
|
|
819
825
|
return {
|
|
820
826
|
...arg,
|
|
821
827
|
supportStatus: {
|
|
@@ -825,12 +831,8 @@ describe("Manifest - Period", () => {
|
|
|
825
831
|
},
|
|
826
832
|
} as unknown as Adaptation;
|
|
827
833
|
});
|
|
828
|
-
|
|
829
|
-
default: mockAdaptation,
|
|
830
|
-
SUPPORTED_ADAPTATIONS_TYPE: ["audio", "video", "text"],
|
|
831
|
-
}));
|
|
834
|
+
mocks.SUPPORTED_ADAPTATIONS_TYPE.push(...["audio", "video", "text"]);
|
|
832
835
|
|
|
833
|
-
const Period = (await vi.importActual("../period")).default as typeof IPeriod;
|
|
834
836
|
const videoAda1 = {
|
|
835
837
|
type: "video",
|
|
836
838
|
id: "54",
|
|
@@ -882,7 +884,9 @@ describe("Manifest - Period", () => {
|
|
|
882
884
|
});
|
|
883
885
|
|
|
884
886
|
it("should return undefind if no adaptation has the given Id when calling `getAdaptation`", () => {
|
|
885
|
-
|
|
887
|
+
mocks.fakeAdaptation.mockImplementation(function (
|
|
888
|
+
arg: IParsedAdaptation,
|
|
889
|
+
): Adaptation {
|
|
886
890
|
return {
|
|
887
891
|
...arg,
|
|
888
892
|
supportStatus: {
|
|
@@ -892,9 +896,55 @@ describe("Manifest - Period", () => {
|
|
|
892
896
|
},
|
|
893
897
|
} as unknown as Adaptation;
|
|
894
898
|
});
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
+
mocks.SUPPORTED_ADAPTATIONS_TYPE.push(...["audio", "video", "text"]);
|
|
900
|
+
|
|
901
|
+
const videoAda1 = {
|
|
902
|
+
type: "video",
|
|
903
|
+
id: "54",
|
|
904
|
+
representations: [{}],
|
|
905
|
+
toVideoTrack() {
|
|
906
|
+
return videoAda1;
|
|
907
|
+
},
|
|
908
|
+
};
|
|
909
|
+
const videoAda2 = {
|
|
910
|
+
type: "video",
|
|
911
|
+
id: "55",
|
|
912
|
+
representations: [{}],
|
|
913
|
+
toVideoTrack() {
|
|
914
|
+
return videoAda2;
|
|
915
|
+
},
|
|
916
|
+
};
|
|
917
|
+
const videoAda3 = {
|
|
918
|
+
type: "video",
|
|
919
|
+
id: "55",
|
|
920
|
+
representations: [{}],
|
|
921
|
+
toVideoTrack() {
|
|
922
|
+
return videoAda3;
|
|
923
|
+
},
|
|
924
|
+
};
|
|
925
|
+
const video = [videoAda1, videoAda2, videoAda3] as unknown as IParsedAdaptation[];
|
|
926
|
+
|
|
927
|
+
const audioAda1 = {
|
|
928
|
+
type: "audio",
|
|
929
|
+
id: "56",
|
|
930
|
+
representations: [{}],
|
|
931
|
+
toAudioTrack() {
|
|
932
|
+
return audioAda1;
|
|
933
|
+
},
|
|
934
|
+
};
|
|
935
|
+
const audio = [audioAda1] as unknown as IParsedAdaptation[];
|
|
936
|
+
|
|
937
|
+
const args = {
|
|
938
|
+
id: "12",
|
|
939
|
+
adaptations: { video, audio },
|
|
940
|
+
thumbnailTracks: [],
|
|
941
|
+
start: 50,
|
|
942
|
+
duration: 12,
|
|
943
|
+
};
|
|
944
|
+
const unsupportedAdaptations: Adaptation[] = [];
|
|
945
|
+
const codecSupportCache = new CodecSupportCache([]);
|
|
946
|
+
const period = new Period(args, codecSupportCache);
|
|
947
|
+
expect(unsupportedAdaptations).toHaveLength(0);
|
|
948
|
+
expect(period.getAdaptation("Oh, comely")).toEqual(undefined);
|
|
899
949
|
});
|
|
900
950
|
});
|