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
package/src/parsers/manifest/dash/js-parser/node_parsers/__tests__/ContentProtection.test.ts
CHANGED
|
@@ -1,14 +1,21 @@
|
|
|
1
|
-
import { describe, beforeEach, it, expect, vi } from "vitest";
|
|
1
|
+
import { describe, beforeEach, it, expect, vi, afterEach } from "vitest";
|
|
2
2
|
import type { ITNode } from "../../../../../../utils/xml-parser";
|
|
3
3
|
import { parseXml } from "../../../../../../utils/xml-parser";
|
|
4
|
-
import
|
|
4
|
+
import parseContentProtection from "../ContentProtection";
|
|
5
|
+
|
|
6
|
+
const mocks = vi.hoisted(() => {
|
|
7
|
+
return {
|
|
8
|
+
hexToBytes: vi.fn(),
|
|
9
|
+
};
|
|
10
|
+
});
|
|
11
|
+
vi.mock("../../../../../../utils/string_parsing", () => ({
|
|
12
|
+
hexToBytes: mocks.hexToBytes,
|
|
13
|
+
}));
|
|
5
14
|
|
|
6
15
|
function testStringAttribute(attributeName: string, variableName?: string): void {
|
|
7
16
|
const _variableName = variableName ?? attributeName;
|
|
8
17
|
|
|
9
|
-
it(`should correctly parse a ContentProtection element with a correct ${attributeName} attribute`,
|
|
10
|
-
const parseContentProtection = (await vi.importActual("../ContentProtection"))
|
|
11
|
-
.default as typeof IContentProtection;
|
|
18
|
+
it(`should correctly parse a ContentProtection element with a correct ${attributeName} attribute`, () => {
|
|
12
19
|
const element1 = parseXml(
|
|
13
20
|
`<ContentProtection ${attributeName}="foobar" />`,
|
|
14
21
|
)[0] as ITNode;
|
|
@@ -29,10 +36,11 @@ describe("DASH Node Parsers - ContentProtection", () => {
|
|
|
29
36
|
beforeEach(() => {
|
|
30
37
|
vi.resetModules();
|
|
31
38
|
});
|
|
39
|
+
afterEach(() => {
|
|
40
|
+
mocks.hexToBytes.mockReset();
|
|
41
|
+
});
|
|
32
42
|
|
|
33
|
-
it("should correctly parse a ContentProtection element without attributes",
|
|
34
|
-
const parseContentProtection = (await vi.importActual("../ContentProtection"))
|
|
35
|
-
.default as typeof IContentProtection;
|
|
43
|
+
it("should correctly parse a ContentProtection element without attributes", () => {
|
|
36
44
|
const element = parseXml("<ContentProtection />")[0] as ITNode;
|
|
37
45
|
expect(parseContentProtection(element)).toEqual([
|
|
38
46
|
{ attributes: {}, children: { cencPssh: [] } },
|
|
@@ -43,16 +51,11 @@ describe("DASH Node Parsers - ContentProtection", () => {
|
|
|
43
51
|
testStringAttribute("schemeIdUri");
|
|
44
52
|
testStringAttribute("value");
|
|
45
53
|
|
|
46
|
-
it("should correctly parse a ContentProtection element with a correct cenc:default_KID attribute",
|
|
54
|
+
it("should correctly parse a ContentProtection element with a correct cenc:default_KID attribute", () => {
|
|
47
55
|
const keyId = new Uint8Array([0, 1, 2, 3]);
|
|
48
|
-
|
|
56
|
+
mocks.hexToBytes.mockImplementation(() => {
|
|
49
57
|
return keyId;
|
|
50
58
|
});
|
|
51
|
-
vi.doMock("../../../../../../utils/string_parsing", () => ({
|
|
52
|
-
hexToBytes: mockHexToBytes,
|
|
53
|
-
}));
|
|
54
|
-
const parseContentProtection = (await vi.importActual("../ContentProtection"))
|
|
55
|
-
.default as typeof IContentProtection;
|
|
56
59
|
const element1 = parseXml(
|
|
57
60
|
'<ContentProtection cenc:default_KID="dead-beef" />',
|
|
58
61
|
)[0] as ITNode;
|
|
@@ -61,20 +64,15 @@ describe("DASH Node Parsers - ContentProtection", () => {
|
|
|
61
64
|
{ attributes: { keyId }, children: { cencPssh: [] } },
|
|
62
65
|
[],
|
|
63
66
|
]);
|
|
64
|
-
expect(
|
|
65
|
-
expect(
|
|
67
|
+
expect(mocks.hexToBytes).toHaveBeenCalledTimes(1);
|
|
68
|
+
expect(mocks.hexToBytes).toHaveBeenCalledWith("deadbeef");
|
|
66
69
|
});
|
|
67
70
|
|
|
68
|
-
it("should correctly parse a ContentProtection with every attributes",
|
|
71
|
+
it("should correctly parse a ContentProtection with every attributes", () => {
|
|
69
72
|
const keyId = new Uint8Array([0, 1, 2, 3]);
|
|
70
|
-
|
|
73
|
+
mocks.hexToBytes.mockImplementation(() => {
|
|
71
74
|
return keyId;
|
|
72
75
|
});
|
|
73
|
-
vi.doMock("../../../../../../utils/string_parsing", () => ({
|
|
74
|
-
hexToBytes: mockHexToBytes,
|
|
75
|
-
}));
|
|
76
|
-
const parseContentProtection = (await vi.importActual("../ContentProtection"))
|
|
77
|
-
.default as typeof IContentProtection;
|
|
78
76
|
const element = parseXml(
|
|
79
77
|
`<ContentProtection
|
|
80
78
|
schemeIdUri="foo"
|
|
@@ -91,9 +89,7 @@ describe("DASH Node Parsers - ContentProtection", () => {
|
|
|
91
89
|
]);
|
|
92
90
|
});
|
|
93
91
|
|
|
94
|
-
it("should correctly parse a ContentProtection with cenc:pssh children",
|
|
95
|
-
const parseContentProtection = (await vi.importActual("../ContentProtection"))
|
|
96
|
-
.default as typeof IContentProtection;
|
|
92
|
+
it("should correctly parse a ContentProtection with cenc:pssh children", () => {
|
|
97
93
|
const element = parseXml(
|
|
98
94
|
`<ContentProtection>
|
|
99
95
|
<cenc:pssh>AABBCC</cenc:pssh>
|
|
@@ -113,16 +109,11 @@ describe("DASH Node Parsers - ContentProtection", () => {
|
|
|
113
109
|
]);
|
|
114
110
|
});
|
|
115
111
|
|
|
116
|
-
it("should correctly parse a ContentProtection with both cenc:pssh children and every attributes",
|
|
112
|
+
it("should correctly parse a ContentProtection with both cenc:pssh children and every attributes", () => {
|
|
117
113
|
const keyId = new Uint8Array([0, 1, 2, 3]);
|
|
118
|
-
|
|
114
|
+
mocks.hexToBytes.mockImplementation(() => {
|
|
119
115
|
return keyId;
|
|
120
116
|
});
|
|
121
|
-
vi.doMock("../../../../../../utils/string_parsing", () => ({
|
|
122
|
-
hexToBytes: mockHexToBytes,
|
|
123
|
-
}));
|
|
124
|
-
const parseContentProtection = (await vi.importActual("../ContentProtection"))
|
|
125
|
-
.default as typeof IContentProtection;
|
|
126
117
|
const element = parseXml(
|
|
127
118
|
`<ContentProtection
|
|
128
119
|
schemeIdUri="foo"
|
|
@@ -144,9 +135,7 @@ describe("DASH Node Parsers - ContentProtection", () => {
|
|
|
144
135
|
]);
|
|
145
136
|
});
|
|
146
137
|
|
|
147
|
-
it("should return a warning if one of the cenc:pssh is invalid base64",
|
|
148
|
-
const parseContentProtection = (await vi.importActual("../ContentProtection"))
|
|
149
|
-
.default as typeof IContentProtection;
|
|
138
|
+
it("should return a warning if one of the cenc:pssh is invalid base64", () => {
|
|
150
139
|
const element = parseXml(
|
|
151
140
|
`<ContentProtection>
|
|
152
141
|
<cenc:pssh>AA!BCC</cenc:pssh>
|
|
@@ -1,62 +1,49 @@
|
|
|
1
|
-
import { describe, beforeEach, it, expect, vi } from "vitest";
|
|
1
|
+
import { describe, beforeEach, it, expect, vi, afterEach } from "vitest";
|
|
2
|
+
import log from "../../../../../../log";
|
|
2
3
|
import type { ITNode } from "../../../../../../utils/xml-parser";
|
|
3
4
|
import { parseXml } from "../../../../../../utils/xml-parser";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
5
|
+
import parseInitialization from "../Initialization";
|
|
6
|
+
import { MPDError } from "../utils";
|
|
7
|
+
|
|
8
|
+
const logWarn = vi.spyOn(log, "warn").mockImplementation(() => {
|
|
9
|
+
/* noop */
|
|
10
|
+
});
|
|
6
11
|
|
|
7
12
|
describe("DASH Node Parsers - Initialization", () => {
|
|
8
13
|
beforeEach(() => {
|
|
9
14
|
vi.resetModules();
|
|
10
15
|
});
|
|
16
|
+
afterEach(() => {
|
|
17
|
+
logWarn.mockClear();
|
|
18
|
+
});
|
|
11
19
|
|
|
12
|
-
it("should correctly parse an element with no known attribute",
|
|
13
|
-
const log = { default: { warn: () => null } };
|
|
14
|
-
vi.doMock("../../../../../../log", () => log);
|
|
15
|
-
const mockLog = vi.spyOn(log.default, "warn");
|
|
16
|
-
|
|
17
|
-
const parseInitialization = (await vi.importActual("../Initialization"))
|
|
18
|
-
.default as typeof IParseInitialization;
|
|
20
|
+
it("should correctly parse an element with no known attribute", () => {
|
|
19
21
|
const element1 = parseXml("<Foo />")[0] as ITNode;
|
|
20
22
|
expect(parseInitialization(element1)).toEqual([{}, []]);
|
|
21
23
|
|
|
22
24
|
const element2 = parseXml('<Foo test="" />')[0] as ITNode;
|
|
23
25
|
expect(parseInitialization(element2)).toEqual([{}, []]);
|
|
24
26
|
|
|
25
|
-
expect(
|
|
26
|
-
mockLog.mockRestore();
|
|
27
|
+
expect(logWarn).not.toHaveBeenCalled();
|
|
27
28
|
});
|
|
28
29
|
|
|
29
|
-
it("should correctly parse an element with a well-formed `range` attribute",
|
|
30
|
-
const log = { default: { warn: () => null } };
|
|
31
|
-
vi.doMock("../../../../../../log", () => log);
|
|
32
|
-
const mockLog = vi.spyOn(log.default, "warn");
|
|
33
|
-
|
|
34
|
-
const parseInitialization = (await vi.importActual("../Initialization"))
|
|
35
|
-
.default as typeof IParseInitialization;
|
|
30
|
+
it("should correctly parse an element with a well-formed `range` attribute", () => {
|
|
36
31
|
const element1 = parseXml('<Foo range="0-1" />')[0] as ITNode;
|
|
37
32
|
expect(parseInitialization(element1)).toEqual([{ range: [0, 1] }, []]);
|
|
38
33
|
|
|
39
34
|
const element2 = parseXml('<Foo range="100-1000" />')[0] as ITNode;
|
|
40
35
|
expect(parseInitialization(element2)).toEqual([{ range: [100, 1000] }, []]);
|
|
41
36
|
|
|
42
|
-
expect(
|
|
43
|
-
mockLog.mockRestore();
|
|
37
|
+
expect(logWarn).not.toHaveBeenCalled();
|
|
44
38
|
});
|
|
45
39
|
|
|
46
|
-
it("should correctly parse an element with an incorrect `range` attribute",
|
|
47
|
-
const log = { default: { warn: () => null } };
|
|
48
|
-
vi.doMock("../../../../../../log", () => log);
|
|
49
|
-
const mockLog = vi.spyOn(log.default, "warn").mockImplementation(vi.fn());
|
|
50
|
-
|
|
51
|
-
const parseInitialization = (await vi.importActual("../Initialization"))
|
|
52
|
-
.default as typeof IParseInitialization;
|
|
53
|
-
const MPDError = (await vi.importActual("../utils")).MPDError as typeof IMPDError;
|
|
40
|
+
it("should correctly parse an element with an incorrect `range` attribute", () => {
|
|
54
41
|
const element1 = parseXml('<Foo range="a" />')[0] as ITNode;
|
|
55
42
|
const error1 = new MPDError('`range` property has an unrecognized format "a"');
|
|
56
43
|
expect(parseInitialization(element1)).toEqual([{}, [error1]]);
|
|
57
44
|
|
|
58
|
-
expect(
|
|
59
|
-
expect(
|
|
45
|
+
expect(logWarn).toHaveBeenCalledTimes(1);
|
|
46
|
+
expect(logWarn).toHaveBeenCalledWith(
|
|
60
47
|
"dash",
|
|
61
48
|
"failed to parse DASH value:",
|
|
62
49
|
error1.message,
|
|
@@ -67,45 +54,29 @@ describe("DASH Node Parsers - Initialization", () => {
|
|
|
67
54
|
const error2 = new MPDError('`range` property has an unrecognized format ""');
|
|
68
55
|
expect(parseInitialization(element2)).toEqual([{}, [error2]]);
|
|
69
56
|
|
|
70
|
-
expect(
|
|
71
|
-
expect(
|
|
57
|
+
expect(logWarn).toHaveBeenCalledTimes(2);
|
|
58
|
+
expect(logWarn).toHaveBeenCalledWith(
|
|
72
59
|
"dash",
|
|
73
60
|
"failed to parse DASH value:",
|
|
74
61
|
error2.message,
|
|
75
62
|
{ dashName: "range" },
|
|
76
63
|
);
|
|
77
|
-
|
|
78
|
-
mockLog.mockRestore();
|
|
79
64
|
});
|
|
80
65
|
|
|
81
|
-
it("should correctly parse an element with a sourceURL attribute",
|
|
82
|
-
const log = { default: { warn: () => null } };
|
|
83
|
-
vi.doMock("../../../../../../log", () => log);
|
|
84
|
-
const mockLog = vi.spyOn(log.default, "warn");
|
|
85
|
-
|
|
86
|
-
const parseInitialization = (await vi.importActual("../Initialization"))
|
|
87
|
-
.default as typeof IParseInitialization;
|
|
66
|
+
it("should correctly parse an element with a sourceURL attribute", () => {
|
|
88
67
|
const element1 = parseXml('<Foo sourceURL="a" />')[0] as ITNode;
|
|
89
68
|
expect(parseInitialization(element1)).toEqual([{ media: "a" }, []]);
|
|
90
69
|
|
|
91
70
|
const element2 = parseXml('<Foo sourceURL="" />')[0] as ITNode;
|
|
92
71
|
expect(parseInitialization(element2)).toEqual([{ media: "" }, []]);
|
|
93
72
|
|
|
94
|
-
expect(
|
|
95
|
-
mockLog.mockRestore();
|
|
73
|
+
expect(logWarn).not.toHaveBeenCalled();
|
|
96
74
|
});
|
|
97
75
|
|
|
98
|
-
it("should correctly parse an element with both a sourceURL and range attributes",
|
|
99
|
-
const log = { default: { warn: () => null } };
|
|
100
|
-
vi.doMock("../../../../../../log", () => log);
|
|
101
|
-
const mockLog = vi.spyOn(log.default, "warn");
|
|
102
|
-
|
|
103
|
-
const parseInitialization = (await vi.importActual("../Initialization"))
|
|
104
|
-
.default as typeof IParseInitialization;
|
|
76
|
+
it("should correctly parse an element with both a sourceURL and range attributes", () => {
|
|
105
77
|
const element1 = parseXml('<Foo sourceURL="a" range="4-10" />')[0] as ITNode;
|
|
106
78
|
expect(parseInitialization(element1)).toEqual([{ media: "a", range: [4, 10] }, []]);
|
|
107
79
|
|
|
108
|
-
expect(
|
|
109
|
-
mockLog.mockRestore();
|
|
80
|
+
expect(logWarn).not.toHaveBeenCalled();
|
|
110
81
|
});
|
|
111
82
|
});
|
|
@@ -1,62 +1,49 @@
|
|
|
1
|
-
import { describe, beforeEach, it, expect, vi } from "vitest";
|
|
1
|
+
import { describe, beforeEach, it, expect, vi, afterEach } from "vitest";
|
|
2
|
+
import log from "../../../../../../log";
|
|
2
3
|
import type { ITNode } from "../../../../../../utils/xml-parser";
|
|
3
4
|
import { parseXml } from "../../../../../../utils/xml-parser";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
5
|
+
import parseSegmentURL from "../SegmentURL";
|
|
6
|
+
import { MPDError } from "../utils";
|
|
7
|
+
|
|
8
|
+
const logWarn = vi.spyOn(log, "warn").mockImplementation(() => {
|
|
9
|
+
/* noop */
|
|
10
|
+
});
|
|
6
11
|
|
|
7
12
|
describe("DASH Node Parsers - SegmentURL", () => {
|
|
8
13
|
beforeEach(() => {
|
|
9
14
|
vi.resetModules();
|
|
10
15
|
});
|
|
16
|
+
afterEach(() => {
|
|
17
|
+
logWarn.mockClear();
|
|
18
|
+
});
|
|
11
19
|
|
|
12
|
-
it("should correctly parse an element with no known attribute",
|
|
13
|
-
const log = { default: { warn: () => null } };
|
|
14
|
-
vi.doMock("../../../../../../log", () => log);
|
|
15
|
-
const mockLog = vi.spyOn(log.default, "warn");
|
|
16
|
-
|
|
17
|
-
const parseSegmentURL = (await vi.importActual("../SegmentURL"))
|
|
18
|
-
.default as typeof IParseSegmentURL;
|
|
20
|
+
it("should correctly parse an element with no known attribute", () => {
|
|
19
21
|
const element1 = parseXml("<Foo />")[0] as ITNode;
|
|
20
22
|
expect(parseSegmentURL(element1)).toEqual([{}, []]);
|
|
21
23
|
|
|
22
24
|
const element2 = parseXml('<Foo test="" />')[0] as ITNode;
|
|
23
25
|
expect(parseSegmentURL(element2)).toEqual([{}, []]);
|
|
24
26
|
|
|
25
|
-
expect(
|
|
26
|
-
mockLog.mockRestore();
|
|
27
|
+
expect(logWarn).not.toHaveBeenCalled();
|
|
27
28
|
});
|
|
28
29
|
|
|
29
|
-
it("should correctly parse an element with a well-formed `mediaRange` attribute",
|
|
30
|
-
const log = { default: { warn: () => null } };
|
|
31
|
-
vi.doMock("../../../../../../log", () => log);
|
|
32
|
-
const mockLog = vi.spyOn(log.default, "warn");
|
|
33
|
-
|
|
34
|
-
const parseSegmentURL = (await vi.importActual("../SegmentURL"))
|
|
35
|
-
.default as typeof IParseSegmentURL;
|
|
30
|
+
it("should correctly parse an element with a well-formed `mediaRange` attribute", () => {
|
|
36
31
|
const element1 = parseXml('<Foo mediaRange="10-100" />')[0] as ITNode;
|
|
37
32
|
expect(parseSegmentURL(element1)).toEqual([{ mediaRange: [10, 100] }, []]);
|
|
38
33
|
|
|
39
34
|
const element2 = parseXml('<Foo mediaRange="0-1" />')[0] as ITNode;
|
|
40
35
|
expect(parseSegmentURL(element2)).toEqual([{ mediaRange: [0, 1] }, []]);
|
|
41
36
|
|
|
42
|
-
expect(
|
|
43
|
-
mockLog.mockRestore();
|
|
37
|
+
expect(logWarn).not.toHaveBeenCalled();
|
|
44
38
|
});
|
|
45
39
|
|
|
46
|
-
it("should correctly parse an element with an incorrect `mediaRange` attribute",
|
|
47
|
-
const log = { default: { warn: () => null } };
|
|
48
|
-
vi.doMock("../../../../../../log", () => log);
|
|
49
|
-
const mockLog = vi.spyOn(log.default, "warn").mockImplementation(vi.fn());
|
|
50
|
-
|
|
51
|
-
const parseSegmentURL = (await vi.importActual("../SegmentURL"))
|
|
52
|
-
.default as typeof IParseSegmentURL;
|
|
53
|
-
const MPDError = (await vi.importActual("../utils")).MPDError as typeof IMPDError;
|
|
40
|
+
it("should correctly parse an element with an incorrect `mediaRange` attribute", () => {
|
|
54
41
|
const element1 = parseXml('<Foo mediaRange="a" />')[0] as ITNode;
|
|
55
42
|
const error1 = new MPDError('`mediaRange` property has an unrecognized format "a"');
|
|
56
43
|
expect(parseSegmentURL(element1)).toEqual([{}, [error1]]);
|
|
57
44
|
|
|
58
|
-
expect(
|
|
59
|
-
expect(
|
|
45
|
+
expect(logWarn).toHaveBeenCalledTimes(1);
|
|
46
|
+
expect(logWarn).toHaveBeenCalledWith(
|
|
60
47
|
"dash",
|
|
61
48
|
"failed to parse DASH value:",
|
|
62
49
|
error1.message,
|
|
@@ -67,50 +54,32 @@ describe("DASH Node Parsers - SegmentURL", () => {
|
|
|
67
54
|
const error2 = new MPDError('`mediaRange` property has an unrecognized format ""');
|
|
68
55
|
expect(parseSegmentURL(element2)).toEqual([{}, [error2]]);
|
|
69
56
|
|
|
70
|
-
expect(
|
|
71
|
-
expect(
|
|
57
|
+
expect(logWarn).toHaveBeenCalledTimes(2);
|
|
58
|
+
expect(logWarn).toHaveBeenCalledWith(
|
|
72
59
|
"dash",
|
|
73
60
|
"failed to parse DASH value:",
|
|
74
61
|
error2.message,
|
|
75
62
|
{ dashName: "mediaRange" },
|
|
76
63
|
);
|
|
77
|
-
|
|
78
|
-
mockLog.mockRestore();
|
|
79
64
|
});
|
|
80
65
|
|
|
81
|
-
it("should correctly parse an element with a well-formed `indexRange` attribute",
|
|
82
|
-
const log = {
|
|
83
|
-
default: { warn: () => null },
|
|
84
|
-
};
|
|
85
|
-
vi.doMock("../../../../../../log", () => log);
|
|
86
|
-
const mockLog = vi.spyOn(log.default, "warn");
|
|
87
|
-
|
|
88
|
-
const parseSegmentURL = (await vi.importActual("../SegmentURL"))
|
|
89
|
-
.default as typeof IParseSegmentURL;
|
|
66
|
+
it("should correctly parse an element with a well-formed `indexRange` attribute", () => {
|
|
90
67
|
const element1 = parseXml('<Foo indexRange="0-100" />')[0] as ITNode;
|
|
91
68
|
expect(parseSegmentURL(element1)).toEqual([{ indexRange: [0, 100] }, []]);
|
|
92
69
|
|
|
93
70
|
const element2 = parseXml('<Foo indexRange="72-47" />')[0] as ITNode;
|
|
94
71
|
expect(parseSegmentURL(element2)).toEqual([{ indexRange: [72, 47] }, []]);
|
|
95
72
|
|
|
96
|
-
expect(
|
|
97
|
-
mockLog.mockRestore();
|
|
73
|
+
expect(logWarn).not.toHaveBeenCalled();
|
|
98
74
|
});
|
|
99
75
|
|
|
100
|
-
it("should correctly parse an element with an incorrect `indexRange` attribute",
|
|
101
|
-
const log = { default: { warn: () => null } };
|
|
102
|
-
vi.doMock("../../../../../../log", () => log);
|
|
103
|
-
const mockLog = vi.spyOn(log.default, "warn").mockImplementation(vi.fn());
|
|
104
|
-
|
|
105
|
-
const parseSegmentURL = (await vi.importActual("../SegmentURL"))
|
|
106
|
-
.default as typeof IParseSegmentURL;
|
|
107
|
-
const MPDError = (await vi.importActual("../utils")).MPDError as typeof IMPDError;
|
|
76
|
+
it("should correctly parse an element with an incorrect `indexRange` attribute", () => {
|
|
108
77
|
const element1 = parseXml('<Foo indexRange="a" />')[0] as ITNode;
|
|
109
78
|
const error1 = new MPDError('`indexRange` property has an unrecognized format "a"');
|
|
110
79
|
expect(parseSegmentURL(element1)).toEqual([{}, [error1]]);
|
|
111
80
|
|
|
112
|
-
expect(
|
|
113
|
-
expect(
|
|
81
|
+
expect(logWarn).toHaveBeenCalledTimes(1);
|
|
82
|
+
expect(logWarn).toHaveBeenCalledWith(
|
|
114
83
|
"dash",
|
|
115
84
|
"failed to parse DASH value:",
|
|
116
85
|
error1.message,
|
|
@@ -121,48 +90,32 @@ describe("DASH Node Parsers - SegmentURL", () => {
|
|
|
121
90
|
const error2 = new MPDError('`indexRange` property has an unrecognized format ""');
|
|
122
91
|
expect(parseSegmentURL(element2)).toEqual([{}, [error2]]);
|
|
123
92
|
|
|
124
|
-
expect(
|
|
125
|
-
expect(
|
|
93
|
+
expect(logWarn).toHaveBeenCalledTimes(2);
|
|
94
|
+
expect(logWarn).toHaveBeenCalledWith(
|
|
126
95
|
"dash",
|
|
127
96
|
"failed to parse DASH value:",
|
|
128
97
|
error2.message,
|
|
129
98
|
{ dashName: "indexRange" },
|
|
130
99
|
);
|
|
131
|
-
|
|
132
|
-
mockLog.mockRestore();
|
|
133
100
|
});
|
|
134
101
|
|
|
135
|
-
it("should correctly parse an element with a media attribute",
|
|
136
|
-
const log = { default: { warn: () => null } };
|
|
137
|
-
vi.doMock("../../../../../../log", () => log);
|
|
138
|
-
const mockLog = vi.spyOn(log.default, "warn");
|
|
139
|
-
|
|
140
|
-
const parseSegmentURL = (await vi.importActual("../SegmentURL"))
|
|
141
|
-
.default as typeof IParseSegmentURL;
|
|
102
|
+
it("should correctly parse an element with a media attribute", () => {
|
|
142
103
|
const element1 = parseXml('<Foo media="a" />')[0] as ITNode;
|
|
143
104
|
expect(parseSegmentURL(element1)).toEqual([{ media: "a" }, []]);
|
|
144
105
|
|
|
145
106
|
const element2 = parseXml('<Foo media="" />')[0] as ITNode;
|
|
146
107
|
expect(parseSegmentURL(element2)).toEqual([{ media: "" }, []]);
|
|
147
108
|
|
|
148
|
-
expect(
|
|
149
|
-
mockLog.mockRestore();
|
|
109
|
+
expect(logWarn).not.toHaveBeenCalled();
|
|
150
110
|
});
|
|
151
111
|
|
|
152
|
-
it("should correctly parse an element with a index attribute",
|
|
153
|
-
const log = { default: { warn: () => null } };
|
|
154
|
-
vi.doMock("../../../../../../log", () => log);
|
|
155
|
-
const mockLog = vi.spyOn(log.default, "warn");
|
|
156
|
-
|
|
157
|
-
const parseSegmentURL = (await vi.importActual("../SegmentURL"))
|
|
158
|
-
.default as typeof IParseSegmentURL;
|
|
112
|
+
it("should correctly parse an element with a index attribute", () => {
|
|
159
113
|
const element1 = parseXml('<Foo index="a" />')[0] as ITNode;
|
|
160
114
|
expect(parseSegmentURL(element1)).toEqual([{ index: "a" }, []]);
|
|
161
115
|
|
|
162
116
|
const element2 = parseXml('<Foo index="" />')[0] as ITNode;
|
|
163
117
|
expect(parseSegmentURL(element2)).toEqual([{ index: "" }, []]);
|
|
164
118
|
|
|
165
|
-
expect(
|
|
166
|
-
mockLog.mockRestore();
|
|
119
|
+
expect(logWarn).not.toHaveBeenCalled();
|
|
167
120
|
});
|
|
168
121
|
});
|
|
@@ -224,18 +224,20 @@ function createManifest(
|
|
|
224
224
|
baseContentMetadata,
|
|
225
225
|
);
|
|
226
226
|
let supplementalCodecs: string | undefined;
|
|
227
|
-
if (currentRepresentation.
|
|
228
|
-
if (currentRepresentation.
|
|
227
|
+
if (currentRepresentation.baseCodecs.length > 1) {
|
|
228
|
+
if (currentRepresentation.baseCodecs.length > 2) {
|
|
229
229
|
log.warn(
|
|
230
230
|
"metaplaylist",
|
|
231
231
|
"MetaPlaylist relying on more than 2 groups of " +
|
|
232
232
|
"codecs with retro-compatibility",
|
|
233
233
|
);
|
|
234
234
|
}
|
|
235
|
-
supplementalCodecs = currentRepresentation.
|
|
235
|
+
supplementalCodecs = currentRepresentation.baseCodecs[0];
|
|
236
236
|
}
|
|
237
237
|
const codecs =
|
|
238
|
-
currentRepresentation.
|
|
238
|
+
currentRepresentation.baseCodecs[
|
|
239
|
+
currentRepresentation.baseCodecs.length - 1
|
|
240
|
+
];
|
|
239
241
|
representations.push({
|
|
240
242
|
bitrate: currentRepresentation.bitrate,
|
|
241
243
|
index: newIndex,
|