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
|
@@ -36,10 +36,12 @@ export function getCodecsWithUnknownSupport(
|
|
|
36
36
|
}
|
|
37
37
|
for (const representation of adaptation.representations) {
|
|
38
38
|
if (representation.isSupported === undefined) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
for (const codec of representation.baseCodecs ?? []) {
|
|
40
|
+
codecsWithUnknownSupport.push({
|
|
41
|
+
mimeType: representation.mimeType ?? "",
|
|
42
|
+
codec,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
43
45
|
}
|
|
44
46
|
}
|
|
45
47
|
}
|
|
@@ -151,7 +153,7 @@ export function updateManifestCodecSupport(
|
|
|
151
153
|
|
|
152
154
|
const isEncrypted = representation.contentProtections !== undefined;
|
|
153
155
|
const mimeType = representation.mimeType ?? "";
|
|
154
|
-
let codecs = representation.
|
|
156
|
+
let codecs = representation.baseCodecs ?? [];
|
|
155
157
|
if (codecs.length === 0) {
|
|
156
158
|
codecs = [""];
|
|
157
159
|
}
|
|
@@ -169,7 +171,7 @@ export function updateManifestCodecSupport(
|
|
|
169
171
|
hasCodecWithUndefinedSupport = true;
|
|
170
172
|
} else if (representation.isSupported) {
|
|
171
173
|
hasSupportedCodec = true;
|
|
172
|
-
representation.
|
|
174
|
+
representation.chosenCodec = codec; // we found the first compatible codec
|
|
173
175
|
|
|
174
176
|
// Don't test subsequent codecs for that Representation
|
|
175
177
|
break;
|
|
@@ -1,13 +1,27 @@
|
|
|
1
|
-
import { describe, beforeEach,
|
|
1
|
+
import { describe, beforeEach, it, expect, vi } from "vitest";
|
|
2
2
|
import type { IParsedAdaptation, IParsedRepresentation } from "../../../parsers/manifest";
|
|
3
3
|
import type {
|
|
4
4
|
IRepresentationContext,
|
|
5
5
|
IRepresentationFilterRepresentation,
|
|
6
6
|
} from "../../../public_types";
|
|
7
|
-
import
|
|
7
|
+
import Adaptation from "../adaptation";
|
|
8
8
|
import CodecSupportCache from "../codec_support_cache";
|
|
9
9
|
import type { IRepresentationIndex } from "../representation_index";
|
|
10
10
|
|
|
11
|
+
const mocks = vi.hoisted(() => {
|
|
12
|
+
return {
|
|
13
|
+
fakeRepresentation: vi.fn(),
|
|
14
|
+
normalize: vi.fn(),
|
|
15
|
+
};
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
vi.mock("../representation", () => ({
|
|
19
|
+
default: mocks.fakeRepresentation,
|
|
20
|
+
}));
|
|
21
|
+
vi.mock("../../../utils/languages", () => ({
|
|
22
|
+
default: mocks.normalize,
|
|
23
|
+
}));
|
|
24
|
+
|
|
11
25
|
const minimalRepresentationIndex: IRepresentationIndex = {
|
|
12
26
|
getInitSegment() {
|
|
13
27
|
return null;
|
|
@@ -61,7 +75,7 @@ const minimalRepresentationIndex: IRepresentationIndex = {
|
|
|
61
75
|
/* noop */
|
|
62
76
|
},
|
|
63
77
|
};
|
|
64
|
-
const mockDefaultRepresentationImpl =
|
|
78
|
+
const mockDefaultRepresentationImpl = function (arg: IParsedRepresentation) {
|
|
65
79
|
return {
|
|
66
80
|
bitrate: arg.bitrate,
|
|
67
81
|
id: arg.id,
|
|
@@ -71,23 +85,18 @@ const mockDefaultRepresentationImpl = vi.fn(function (arg: IParsedRepresentation
|
|
|
71
85
|
},
|
|
72
86
|
index: arg.index,
|
|
73
87
|
};
|
|
74
|
-
}
|
|
88
|
+
};
|
|
75
89
|
|
|
76
90
|
describe("Manifest - Adaptation", () => {
|
|
77
91
|
beforeEach(() => {
|
|
78
92
|
vi.resetModules();
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
mockDefaultRepresentationImpl.mockClear();
|
|
93
|
+
mocks.fakeRepresentation.mockReset();
|
|
94
|
+
mocks.normalize.mockReset();
|
|
82
95
|
});
|
|
83
96
|
|
|
84
|
-
it("should be able to create a minimal Adaptation",
|
|
85
|
-
|
|
86
|
-
default: mockDefaultRepresentationImpl,
|
|
87
|
-
}));
|
|
97
|
+
it("should be able to create a minimal Adaptation", () => {
|
|
98
|
+
mocks.fakeRepresentation.mockImplementation(mockDefaultRepresentationImpl);
|
|
88
99
|
|
|
89
|
-
const Adaptation = (await vi.importActual("../adaptation"))
|
|
90
|
-
.default as typeof IAdaptation;
|
|
91
100
|
const args: IParsedAdaptation = { id: "12", representations: [], type: "video" };
|
|
92
101
|
const codecSupportCache = new CodecSupportCache([]);
|
|
93
102
|
const adaptation = new Adaptation(args, codecSupportCache);
|
|
@@ -101,20 +110,13 @@ describe("Manifest - Adaptation", () => {
|
|
|
101
110
|
expect(adaptation.manuallyAdded).toBe(false);
|
|
102
111
|
expect(adaptation.getRepresentation("")).toBe(undefined);
|
|
103
112
|
|
|
104
|
-
expect(
|
|
113
|
+
expect(mocks.fakeRepresentation).not.toHaveBeenCalled();
|
|
105
114
|
});
|
|
106
115
|
|
|
107
|
-
it("should normalize a given language",
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
const mockNormalize = vi.fn((lang: string) => lang + "foo");
|
|
112
|
-
vi.doMock("../../../utils/languages", () => ({
|
|
113
|
-
default: mockNormalize,
|
|
114
|
-
}));
|
|
115
|
-
|
|
116
|
-
const Adaptation = (await vi.importActual("../adaptation"))
|
|
117
|
-
.default as typeof IAdaptation;
|
|
116
|
+
it("should normalize a given language", () => {
|
|
117
|
+
mocks.fakeRepresentation.mockImplementation(mockDefaultRepresentationImpl);
|
|
118
|
+
mocks.normalize.mockImplementation((lang: string) => lang + "foo");
|
|
119
|
+
|
|
118
120
|
const args1: IParsedAdaptation = {
|
|
119
121
|
id: "12",
|
|
120
122
|
representations: [],
|
|
@@ -125,9 +127,9 @@ describe("Manifest - Adaptation", () => {
|
|
|
125
127
|
const adaptation1 = new Adaptation(args1, codecSupportCache);
|
|
126
128
|
expect(adaptation1.language).toBe("fr");
|
|
127
129
|
expect(adaptation1.normalizedLanguage).toBe("frfoo");
|
|
128
|
-
expect(
|
|
129
|
-
expect(
|
|
130
|
-
|
|
130
|
+
expect(mocks.normalize).toHaveBeenCalledTimes(1);
|
|
131
|
+
expect(mocks.normalize).toHaveBeenCalledWith("fr");
|
|
132
|
+
mocks.normalize.mockClear();
|
|
131
133
|
|
|
132
134
|
const args2: IParsedAdaptation = {
|
|
133
135
|
id: "12",
|
|
@@ -138,36 +140,25 @@ describe("Manifest - Adaptation", () => {
|
|
|
138
140
|
const adaptation2 = new Adaptation(args2, codecSupportCache);
|
|
139
141
|
expect(adaptation2.language).toBe("toto");
|
|
140
142
|
expect(adaptation2.normalizedLanguage).toBe("totofoo");
|
|
141
|
-
expect(
|
|
142
|
-
expect(
|
|
143
|
+
expect(mocks.normalize).toHaveBeenCalledTimes(1);
|
|
144
|
+
expect(mocks.normalize).toHaveBeenCalledWith("toto");
|
|
143
145
|
});
|
|
144
146
|
|
|
145
|
-
it("should not call normalize if no language is given",
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
const mockNormalize = vi.fn((lang: string) => lang + "foo");
|
|
150
|
-
vi.doMock("../../../utils/languages", () => ({
|
|
151
|
-
default: mockNormalize,
|
|
152
|
-
}));
|
|
153
|
-
|
|
154
|
-
const Adaptation = (await vi.importActual("../adaptation"))
|
|
155
|
-
.default as typeof IAdaptation;
|
|
147
|
+
it("should not call normalize if no language is given", () => {
|
|
148
|
+
mocks.fakeRepresentation.mockImplementation(mockDefaultRepresentationImpl);
|
|
149
|
+
mocks.normalize.mockImplementation((lang: string) => lang + "foo");
|
|
150
|
+
|
|
156
151
|
const args1: IParsedAdaptation = { id: "12", representations: [], type: "video" };
|
|
157
152
|
const codecSupportCache = new CodecSupportCache([]);
|
|
158
153
|
const adaptation1 = new Adaptation(args1, codecSupportCache);
|
|
159
154
|
expect(adaptation1.language).toBe(undefined);
|
|
160
155
|
expect(adaptation1.normalizedLanguage).toBe(undefined);
|
|
161
|
-
expect(
|
|
156
|
+
expect(mocks.normalize).not.toHaveBeenCalled();
|
|
162
157
|
});
|
|
163
158
|
|
|
164
|
-
it("should create and sort the corresponding Representations",
|
|
165
|
-
|
|
166
|
-
default: mockDefaultRepresentationImpl,
|
|
167
|
-
}));
|
|
159
|
+
it("should create and sort the corresponding Representations", () => {
|
|
160
|
+
mocks.fakeRepresentation.mockImplementation(mockDefaultRepresentationImpl);
|
|
168
161
|
|
|
169
|
-
const Adaptation = (await vi.importActual("../adaptation"))
|
|
170
|
-
.default as typeof IAdaptation;
|
|
171
162
|
const rep1 = {
|
|
172
163
|
bitrate: 10,
|
|
173
164
|
id: "rep1",
|
|
@@ -192,20 +183,20 @@ describe("Manifest - Adaptation", () => {
|
|
|
192
183
|
const codecSupportCache = new CodecSupportCache([]);
|
|
193
184
|
const adaptation = new Adaptation(args, codecSupportCache);
|
|
194
185
|
const parsedRepresentations = adaptation.representations;
|
|
195
|
-
expect(
|
|
196
|
-
expect(
|
|
186
|
+
expect(mocks.fakeRepresentation).toHaveBeenCalledTimes(3);
|
|
187
|
+
expect(mocks.fakeRepresentation).toHaveBeenNthCalledWith(
|
|
197
188
|
1,
|
|
198
189
|
rep1,
|
|
199
190
|
"text",
|
|
200
191
|
codecSupportCache,
|
|
201
192
|
);
|
|
202
|
-
expect(
|
|
193
|
+
expect(mocks.fakeRepresentation).toHaveBeenNthCalledWith(
|
|
203
194
|
2,
|
|
204
195
|
rep2,
|
|
205
196
|
"text",
|
|
206
197
|
codecSupportCache,
|
|
207
198
|
);
|
|
208
|
-
expect(
|
|
199
|
+
expect(mocks.fakeRepresentation).toHaveBeenNthCalledWith(
|
|
209
200
|
3,
|
|
210
201
|
rep3,
|
|
211
202
|
"text",
|
|
@@ -220,8 +211,8 @@ describe("Manifest - Adaptation", () => {
|
|
|
220
211
|
expect(adaptation.getRepresentation("rep2")?.bitrate).toEqual(30);
|
|
221
212
|
});
|
|
222
213
|
|
|
223
|
-
it("should execute the representationFilter if given",
|
|
224
|
-
|
|
214
|
+
it("should execute the representationFilter if given", () => {
|
|
215
|
+
mocks.fakeRepresentation.mockImplementation(function (arg: IParsedRepresentation) {
|
|
225
216
|
return {
|
|
226
217
|
bitrate: arg.bitrate,
|
|
227
218
|
id: arg.id,
|
|
@@ -233,12 +224,6 @@ describe("Manifest - Adaptation", () => {
|
|
|
233
224
|
};
|
|
234
225
|
});
|
|
235
226
|
|
|
236
|
-
vi.doMock("../representation", () => ({
|
|
237
|
-
default: mockRepresentation,
|
|
238
|
-
}));
|
|
239
|
-
|
|
240
|
-
const Adaptation = (await vi.importActual("../adaptation"))
|
|
241
|
-
.default as typeof IAdaptation;
|
|
242
227
|
const rep1 = {
|
|
243
228
|
bitrate: 10,
|
|
244
229
|
id: "rep1",
|
|
@@ -313,17 +298,9 @@ describe("Manifest - Adaptation", () => {
|
|
|
313
298
|
expect(adaptation.getRepresentation("rep4")?.id).toEqual("rep4");
|
|
314
299
|
});
|
|
315
300
|
|
|
316
|
-
it("should set an isDub value if one",
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
}));
|
|
320
|
-
const mockNormalize = vi.fn((lang: string) => lang + "foo");
|
|
321
|
-
vi.doMock("../../../utils/languages", () => ({
|
|
322
|
-
default: mockNormalize,
|
|
323
|
-
}));
|
|
324
|
-
|
|
325
|
-
const Adaptation = (await vi.importActual("../adaptation"))
|
|
326
|
-
.default as typeof IAdaptation;
|
|
301
|
+
it("should set an isDub value if one", () => {
|
|
302
|
+
mocks.fakeRepresentation.mockImplementation(mockDefaultRepresentationImpl);
|
|
303
|
+
mocks.normalize.mockImplementation((lang: string) => lang + "foo");
|
|
327
304
|
|
|
328
305
|
const args1: IParsedAdaptation = {
|
|
329
306
|
id: "12",
|
|
@@ -336,7 +313,7 @@ describe("Manifest - Adaptation", () => {
|
|
|
336
313
|
expect(adaptation1.language).toBe(undefined);
|
|
337
314
|
expect(adaptation1.normalizedLanguage).toBe(undefined);
|
|
338
315
|
expect(adaptation1.isDub).toEqual(false);
|
|
339
|
-
expect(
|
|
316
|
+
expect(mocks.normalize).not.toHaveBeenCalled();
|
|
340
317
|
|
|
341
318
|
const args2: IParsedAdaptation = {
|
|
342
319
|
id: "12",
|
|
@@ -348,20 +325,12 @@ describe("Manifest - Adaptation", () => {
|
|
|
348
325
|
expect(adaptation2.language).toBe(undefined);
|
|
349
326
|
expect(adaptation2.normalizedLanguage).toBe(undefined);
|
|
350
327
|
expect(adaptation2.isDub).toEqual(true);
|
|
351
|
-
expect(
|
|
328
|
+
expect(mocks.normalize).not.toHaveBeenCalled();
|
|
352
329
|
});
|
|
353
330
|
|
|
354
|
-
it("should set an isClosedCaption value if one",
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
}));
|
|
358
|
-
const mockNormalize = vi.fn((lang: string) => lang + "foo");
|
|
359
|
-
vi.doMock("../../../utils/languages", () => ({
|
|
360
|
-
default: mockNormalize,
|
|
361
|
-
}));
|
|
362
|
-
|
|
363
|
-
const Adaptation = (await vi.importActual("../adaptation"))
|
|
364
|
-
.default as typeof IAdaptation;
|
|
331
|
+
it("should set an isClosedCaption value if one", () => {
|
|
332
|
+
mocks.fakeRepresentation.mockImplementation(mockDefaultRepresentationImpl);
|
|
333
|
+
mocks.normalize.mockImplementation((lang: string) => lang + "foo");
|
|
365
334
|
|
|
366
335
|
const args1: IParsedAdaptation = {
|
|
367
336
|
id: "12",
|
|
@@ -374,7 +343,7 @@ describe("Manifest - Adaptation", () => {
|
|
|
374
343
|
expect(adaptation1.language).toBe(undefined);
|
|
375
344
|
expect(adaptation1.normalizedLanguage).toBe(undefined);
|
|
376
345
|
expect(adaptation1.isClosedCaption).toEqual(false);
|
|
377
|
-
expect(
|
|
346
|
+
expect(mocks.normalize).not.toHaveBeenCalled();
|
|
378
347
|
|
|
379
348
|
const args2: IParsedAdaptation = {
|
|
380
349
|
id: "12",
|
|
@@ -386,21 +355,12 @@ describe("Manifest - Adaptation", () => {
|
|
|
386
355
|
expect(adaptation2.language).toBe(undefined);
|
|
387
356
|
expect(adaptation2.normalizedLanguage).toBe(undefined);
|
|
388
357
|
expect(adaptation2.isClosedCaption).toEqual(true);
|
|
389
|
-
expect(
|
|
358
|
+
expect(mocks.normalize).not.toHaveBeenCalled();
|
|
390
359
|
});
|
|
391
360
|
|
|
392
|
-
it("should set an isAudioDescription value if one",
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
}));
|
|
396
|
-
const mockNormalize = vi.fn((lang: string) => lang + "foo");
|
|
397
|
-
|
|
398
|
-
vi.doMock("../../../utils/languages", () => ({
|
|
399
|
-
default: mockNormalize,
|
|
400
|
-
}));
|
|
401
|
-
|
|
402
|
-
const Adaptation = (await vi.importActual("../adaptation"))
|
|
403
|
-
.default as typeof IAdaptation;
|
|
361
|
+
it("should set an isAudioDescription value if one", () => {
|
|
362
|
+
mocks.fakeRepresentation.mockImplementation(mockDefaultRepresentationImpl);
|
|
363
|
+
mocks.normalize.mockImplementation((lang: string) => lang + "foo");
|
|
404
364
|
|
|
405
365
|
const args1: IParsedAdaptation = {
|
|
406
366
|
id: "12",
|
|
@@ -413,7 +373,7 @@ describe("Manifest - Adaptation", () => {
|
|
|
413
373
|
expect(adaptation1.language).toBe(undefined);
|
|
414
374
|
expect(adaptation1.normalizedLanguage).toBe(undefined);
|
|
415
375
|
expect(adaptation1.isAudioDescription).toEqual(false);
|
|
416
|
-
expect(
|
|
376
|
+
expect(mocks.normalize).not.toHaveBeenCalled();
|
|
417
377
|
|
|
418
378
|
const args2: IParsedAdaptation = {
|
|
419
379
|
id: "12",
|
|
@@ -425,20 +385,12 @@ describe("Manifest - Adaptation", () => {
|
|
|
425
385
|
expect(adaptation2.language).toBe(undefined);
|
|
426
386
|
expect(adaptation2.normalizedLanguage).toBe(undefined);
|
|
427
387
|
expect(adaptation2.isAudioDescription).toEqual(true);
|
|
428
|
-
expect(
|
|
388
|
+
expect(mocks.normalize).not.toHaveBeenCalled();
|
|
429
389
|
});
|
|
430
390
|
|
|
431
|
-
it("should set a manuallyAdded value if one",
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
}));
|
|
435
|
-
const mockNormalize = vi.fn((lang: string) => lang + "foo");
|
|
436
|
-
vi.doMock("../../../utils/languages", () => ({
|
|
437
|
-
default: mockNormalize,
|
|
438
|
-
}));
|
|
439
|
-
|
|
440
|
-
const Adaptation = (await vi.importActual("../adaptation"))
|
|
441
|
-
.default as typeof IAdaptation;
|
|
391
|
+
it("should set a manuallyAdded value if one", () => {
|
|
392
|
+
mocks.fakeRepresentation.mockImplementation(mockDefaultRepresentationImpl);
|
|
393
|
+
mocks.normalize.mockImplementation((lang: string) => lang + "foo");
|
|
442
394
|
|
|
443
395
|
const args1: IParsedAdaptation = { id: "12", representations: [], type: "video" };
|
|
444
396
|
const codecSupportCache = new CodecSupportCache([]);
|
|
@@ -448,7 +400,7 @@ describe("Manifest - Adaptation", () => {
|
|
|
448
400
|
expect(adaptation1.language).toBe(undefined);
|
|
449
401
|
expect(adaptation1.normalizedLanguage).toBe(undefined);
|
|
450
402
|
expect(adaptation1.manuallyAdded).toEqual(false);
|
|
451
|
-
expect(
|
|
403
|
+
expect(mocks.normalize).not.toHaveBeenCalled();
|
|
452
404
|
|
|
453
405
|
const args2: IParsedAdaptation = { id: "12", representations: [], type: "video" };
|
|
454
406
|
const adaptation2 = new Adaptation(args2, codecSupportCache, {
|
|
@@ -457,16 +409,12 @@ describe("Manifest - Adaptation", () => {
|
|
|
457
409
|
expect(adaptation2.language).toBe(undefined);
|
|
458
410
|
expect(adaptation2.normalizedLanguage).toBe(undefined);
|
|
459
411
|
expect(adaptation2.manuallyAdded).toEqual(true);
|
|
460
|
-
expect(
|
|
412
|
+
expect(mocks.normalize).not.toHaveBeenCalled();
|
|
461
413
|
});
|
|
462
414
|
|
|
463
|
-
it("should return the first Representation with the given Id with `getRepresentation`",
|
|
464
|
-
|
|
465
|
-
default: mockDefaultRepresentationImpl,
|
|
466
|
-
}));
|
|
415
|
+
it("should return the first Representation with the given Id with `getRepresentation`", () => {
|
|
416
|
+
mocks.fakeRepresentation.mockImplementation(mockDefaultRepresentationImpl);
|
|
467
417
|
|
|
468
|
-
const Adaptation = (await vi.importActual("../adaptation"))
|
|
469
|
-
.default as typeof IAdaptation;
|
|
470
418
|
const rep1 = {
|
|
471
419
|
bitrate: 10,
|
|
472
420
|
id: "rep1",
|
|
@@ -494,13 +442,9 @@ describe("Manifest - Adaptation", () => {
|
|
|
494
442
|
expect(adaptation.getRepresentation("rep2")?.bitrate).toEqual(20);
|
|
495
443
|
});
|
|
496
444
|
|
|
497
|
-
it("should return undefined in `getRepresentation` if no representation is found with this Id",
|
|
498
|
-
|
|
499
|
-
default: mockDefaultRepresentationImpl,
|
|
500
|
-
}));
|
|
445
|
+
it("should return undefined in `getRepresentation` if no representation is found with this Id", () => {
|
|
446
|
+
mocks.fakeRepresentation.mockImplementation(mockDefaultRepresentationImpl);
|
|
501
447
|
|
|
502
|
-
const Adaptation = (await vi.importActual("../adaptation"))
|
|
503
|
-
.default as typeof IAdaptation;
|
|
504
448
|
const rep1 = {
|
|
505
449
|
bitrate: 10,
|
|
506
450
|
id: "rep1",
|