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
|
@@ -1,58 +1,50 @@
|
|
|
1
|
-
import type { MockInstance } from "vitest";
|
|
2
1
|
import { describe, beforeEach, afterEach, it, expect, vi } from "vitest";
|
|
2
|
+
import log from "../../../../log";
|
|
3
3
|
import type { IIndexSegment } from "../index_helpers";
|
|
4
|
-
import
|
|
4
|
+
import updateSegmentTimeline from "../update_segment_timeline";
|
|
5
|
+
|
|
6
|
+
const logWarn = vi.spyOn(log, "warn").mockImplementation(() => {
|
|
7
|
+
/* noop */
|
|
8
|
+
});
|
|
5
9
|
|
|
6
10
|
describe("Manifest Parsers utils - updateSegmentTimeline", () => {
|
|
7
|
-
|
|
8
|
-
let updateSegmentTimeline:
|
|
9
|
-
| ((a: IIndexSegment[], b: IIndexSegment[]) => boolean)
|
|
10
|
-
| undefined;
|
|
11
|
-
beforeEach(async () => {
|
|
11
|
+
beforeEach(() => {
|
|
12
12
|
vi.resetModules();
|
|
13
|
-
|
|
14
|
-
mockLogWarn = vi.fn();
|
|
15
|
-
vi.doMock("../../../../log", () => ({
|
|
16
|
-
default: {
|
|
17
|
-
warn: mockLogWarn,
|
|
18
|
-
},
|
|
19
|
-
}));
|
|
20
|
-
updateSegmentTimeline = (await vi.importActual("../update_segment_timeline"))
|
|
21
|
-
.default as typeof IUpdateSegmentTimeline;
|
|
22
13
|
});
|
|
23
14
|
|
|
24
15
|
afterEach(() => {
|
|
25
16
|
vi.resetModules();
|
|
26
17
|
vi.resetAllMocks();
|
|
18
|
+
logWarn.mockClear();
|
|
27
19
|
});
|
|
28
20
|
|
|
29
21
|
it("should just replace with the new timeline if the old was empty", () => {
|
|
30
22
|
const oldTimeline: IIndexSegment[] = [];
|
|
31
23
|
const newTimeline1 = [{ start: 0, duration: 1000, repeatCount: 10 }];
|
|
32
24
|
const newTimeline2: IIndexSegment[] = [];
|
|
33
|
-
expect(updateSegmentTimeline
|
|
25
|
+
expect(updateSegmentTimeline(oldTimeline, newTimeline1)).toEqual(true);
|
|
34
26
|
expect(oldTimeline).toEqual(newTimeline1);
|
|
35
27
|
|
|
36
28
|
oldTimeline.length = 0; // reset
|
|
37
|
-
updateSegmentTimeline
|
|
29
|
+
updateSegmentTimeline(oldTimeline, newTimeline2);
|
|
38
30
|
expect(oldTimeline).toEqual(newTimeline2);
|
|
39
|
-
expect(
|
|
31
|
+
expect(logWarn).not.toHaveBeenCalled();
|
|
40
32
|
});
|
|
41
33
|
|
|
42
34
|
it("should not do anything if the new timeline is empty", () => {
|
|
43
35
|
const oldTimeline = [{ start: 0, duration: 1000, repeatCount: 10 }];
|
|
44
36
|
const newTimeline: IIndexSegment[] = [];
|
|
45
37
|
const oldTimelineCloned = oldTimeline.slice();
|
|
46
|
-
expect(updateSegmentTimeline
|
|
38
|
+
expect(updateSegmentTimeline(oldTimeline, newTimeline)).toEqual(false);
|
|
47
39
|
expect(oldTimeline).toEqual(oldTimelineCloned);
|
|
48
|
-
expect(
|
|
40
|
+
expect(logWarn).not.toHaveBeenCalled();
|
|
49
41
|
});
|
|
50
42
|
|
|
51
43
|
it("should not do anything if the timelines are equal", () => {
|
|
52
44
|
const oldTimeline1 = [{ start: 0, duration: 1000, repeatCount: 10 }];
|
|
53
45
|
const newTimeline1 = [{ start: 0, duration: 1000, repeatCount: 10 }];
|
|
54
46
|
const oldTimeline1Cloned = oldTimeline1.slice();
|
|
55
|
-
expect(updateSegmentTimeline
|
|
47
|
+
expect(updateSegmentTimeline(oldTimeline1, newTimeline1)).toEqual(false);
|
|
56
48
|
expect(oldTimeline1).toEqual(oldTimeline1Cloned);
|
|
57
49
|
|
|
58
50
|
const oldTimeline2 = [
|
|
@@ -66,9 +58,9 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
|
|
|
66
58
|
{ start: 12000, duration: 1000, repeatCount: 1 },
|
|
67
59
|
];
|
|
68
60
|
const oldTimeline2Cloned = oldTimeline2.slice();
|
|
69
|
-
expect(updateSegmentTimeline
|
|
61
|
+
expect(updateSegmentTimeline(oldTimeline2, newTimeline2)).toEqual(false);
|
|
70
62
|
expect(oldTimeline2).toEqual(oldTimeline2Cloned);
|
|
71
|
-
expect(
|
|
63
|
+
expect(logWarn).not.toHaveBeenCalled();
|
|
72
64
|
});
|
|
73
65
|
|
|
74
66
|
it("should throw if the new timeline begin long after the old one", () => {
|
|
@@ -85,7 +77,7 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
|
|
|
85
77
|
|
|
86
78
|
let err: unknown = null;
|
|
87
79
|
try {
|
|
88
|
-
expect(updateSegmentTimeline
|
|
80
|
+
expect(updateSegmentTimeline(oldTimeline1, newTimeline1)).not.toHaveReturned();
|
|
89
81
|
} catch (e) {
|
|
90
82
|
err = e;
|
|
91
83
|
}
|
|
@@ -102,7 +94,7 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
|
|
|
102
94
|
"MANIFEST_UPDATE_ERROR: Cannot perform partial update: not enough data",
|
|
103
95
|
);
|
|
104
96
|
expect(oldTimeline1).toEqual(oldTimeline1Cloned);
|
|
105
|
-
expect(
|
|
97
|
+
expect(logWarn).not.toHaveBeenCalled();
|
|
106
98
|
});
|
|
107
99
|
|
|
108
100
|
it("should merge consecutive timelines", () => {
|
|
@@ -117,9 +109,9 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
|
|
|
117
109
|
];
|
|
118
110
|
const oldTimeline1Cloned = oldTimeline1.slice();
|
|
119
111
|
const newTimeline1Cloned = newTimeline1.slice();
|
|
120
|
-
expect(updateSegmentTimeline
|
|
112
|
+
expect(updateSegmentTimeline(oldTimeline1, newTimeline1)).toEqual(false);
|
|
121
113
|
expect(oldTimeline1).toEqual([...oldTimeline1Cloned, ...newTimeline1Cloned]);
|
|
122
|
-
expect(
|
|
114
|
+
expect(logWarn).not.toHaveBeenCalled();
|
|
123
115
|
|
|
124
116
|
// With repeats
|
|
125
117
|
|
|
@@ -134,9 +126,9 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
|
|
|
134
126
|
];
|
|
135
127
|
const oldTimeline2Cloned = oldTimeline2.slice();
|
|
136
128
|
const newTimeline2Cloned = newTimeline2.slice();
|
|
137
|
-
expect(updateSegmentTimeline
|
|
129
|
+
expect(updateSegmentTimeline(oldTimeline2, newTimeline2)).toEqual(false);
|
|
138
130
|
expect(oldTimeline2).toEqual([...oldTimeline2Cloned, ...newTimeline2Cloned]);
|
|
139
|
-
expect(
|
|
131
|
+
expect(logWarn).not.toHaveBeenCalled();
|
|
140
132
|
});
|
|
141
133
|
|
|
142
134
|
it("should merge consecutive timelines with a repeatCount set to -1 for the old timeline", () => {
|
|
@@ -149,7 +141,7 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
|
|
|
149
141
|
{ start: 24000, duration: 1100, repeatCount: 0 },
|
|
150
142
|
{ start: 25100, duration: 1000, repeatCount: 1 },
|
|
151
143
|
];
|
|
152
|
-
expect(updateSegmentTimeline
|
|
144
|
+
expect(updateSegmentTimeline(oldTimeline1, newTimeline1)).toEqual(false);
|
|
153
145
|
expect(oldTimeline1).toEqual([
|
|
154
146
|
{ start: 0, duration: 500, repeatCount: 20 },
|
|
155
147
|
{ start: 11000, duration: 1000, repeatCount: 0 },
|
|
@@ -167,7 +159,7 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
|
|
|
167
159
|
{ start: 24000, duration: 1100, repeatCount: 0 },
|
|
168
160
|
{ start: 25100, duration: 1000, repeatCount: 1 },
|
|
169
161
|
];
|
|
170
|
-
expect(updateSegmentTimeline
|
|
162
|
+
expect(updateSegmentTimeline(oldTimeline2, newTimeline2)).toEqual(false);
|
|
171
163
|
expect(oldTimeline2).toEqual([
|
|
172
164
|
{ start: 0, duration: 500, repeatCount: 20 },
|
|
173
165
|
{ start: 11000, duration: 1000, repeatCount: 8 },
|
|
@@ -175,7 +167,7 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
|
|
|
175
167
|
{ start: 24000, duration: 1100, repeatCount: 0 },
|
|
176
168
|
{ start: 25100, duration: 1000, repeatCount: 1 },
|
|
177
169
|
]);
|
|
178
|
-
expect(
|
|
170
|
+
expect(logWarn).not.toHaveBeenCalled();
|
|
179
171
|
});
|
|
180
172
|
|
|
181
173
|
it("should merge perfectly overlapping timelines without repeatCounts", () => {
|
|
@@ -190,7 +182,7 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
|
|
|
190
182
|
{ start: 2500, duration: 500, repeatCount: 0 },
|
|
191
183
|
{ start: 3000, duration: 5000, repeatCount: 0 },
|
|
192
184
|
];
|
|
193
|
-
expect(updateSegmentTimeline
|
|
185
|
+
expect(updateSegmentTimeline(oldTimeline1, newTimeline1)).toEqual(false);
|
|
194
186
|
expect(oldTimeline1).toEqual([
|
|
195
187
|
{ start: 0, duration: 1000, repeatCount: 0 },
|
|
196
188
|
{ start: 1000, duration: 500, repeatCount: 0 },
|
|
@@ -198,7 +190,7 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
|
|
|
198
190
|
{ start: 2500, duration: 500, repeatCount: 0 },
|
|
199
191
|
{ start: 3000, duration: 5000, repeatCount: 0 },
|
|
200
192
|
]);
|
|
201
|
-
expect(
|
|
193
|
+
expect(logWarn).not.toHaveBeenCalled();
|
|
202
194
|
});
|
|
203
195
|
|
|
204
196
|
it("should merge perfectly overlapping timelines with repeatCounts", () => {
|
|
@@ -213,7 +205,7 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
|
|
|
213
205
|
{ start: 13000, duration: 7000, repeatCount: 0 },
|
|
214
206
|
{ start: 20000, duration: 5000, repeatCount: 0 },
|
|
215
207
|
];
|
|
216
|
-
expect(updateSegmentTimeline
|
|
208
|
+
expect(updateSegmentTimeline(oldTimeline1, newTimeline1)).toEqual(false);
|
|
217
209
|
expect(oldTimeline1).toEqual([
|
|
218
210
|
{ start: 0, duration: 1000, repeatCount: 0 },
|
|
219
211
|
{ start: 1000, duration: 500, repeatCount: 21 },
|
|
@@ -221,7 +213,7 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
|
|
|
221
213
|
{ start: 13000, duration: 7000, repeatCount: 0 },
|
|
222
214
|
{ start: 20000, duration: 5000, repeatCount: 0 },
|
|
223
215
|
]);
|
|
224
|
-
expect(
|
|
216
|
+
expect(logWarn).not.toHaveBeenCalled();
|
|
225
217
|
|
|
226
218
|
const oldTimeline2 = [
|
|
227
219
|
{ start: 1000, duration: 500, repeatCount: 21 },
|
|
@@ -233,7 +225,7 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
|
|
|
233
225
|
{ start: 13000, duration: 7000, repeatCount: 0 },
|
|
234
226
|
{ start: 20000, duration: 5000, repeatCount: 0 },
|
|
235
227
|
];
|
|
236
|
-
expect(updateSegmentTimeline
|
|
228
|
+
expect(updateSegmentTimeline(oldTimeline2, newTimeline2)).toEqual(false);
|
|
237
229
|
expect(oldTimeline2).toEqual([
|
|
238
230
|
{ start: 1000, duration: 500, repeatCount: 21 },
|
|
239
231
|
{ start: 12000, duration: 1000, repeatCount: 0 },
|
|
@@ -251,14 +243,14 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
|
|
|
251
243
|
{ start: 13000, duration: 7000, repeatCount: 0 },
|
|
252
244
|
{ start: 20000, duration: 5000, repeatCount: 0 },
|
|
253
245
|
];
|
|
254
|
-
expect(updateSegmentTimeline
|
|
246
|
+
expect(updateSegmentTimeline(oldTimeline3, newTimeline3)).toEqual(false);
|
|
255
247
|
expect(oldTimeline3).toEqual([
|
|
256
248
|
{ start: 1000, duration: 500, repeatCount: -1 },
|
|
257
249
|
{ start: 12000, duration: 1000, repeatCount: 0 },
|
|
258
250
|
{ start: 13000, duration: 7000, repeatCount: 0 },
|
|
259
251
|
{ start: 20000, duration: 5000, repeatCount: 0 },
|
|
260
252
|
]);
|
|
261
|
-
expect(
|
|
253
|
+
expect(logWarn).not.toHaveBeenCalled();
|
|
262
254
|
});
|
|
263
255
|
|
|
264
256
|
it('should merge even if there are "holes" in the old timeline', () => {
|
|
@@ -273,7 +265,7 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
|
|
|
273
265
|
{ start: 13000, duration: 7000, repeatCount: 0 },
|
|
274
266
|
{ start: 20000, duration: 5000, repeatCount: 0 },
|
|
275
267
|
];
|
|
276
|
-
expect(updateSegmentTimeline
|
|
268
|
+
expect(updateSegmentTimeline(oldTimeline1, newTimeline1)).toEqual(false);
|
|
277
269
|
expect(oldTimeline1).toEqual([
|
|
278
270
|
{ start: 0, duration: 1000, repeatCount: 0 },
|
|
279
271
|
{ start: 1000, duration: 500, repeatCount: 0 },
|
|
@@ -294,7 +286,7 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
|
|
|
294
286
|
{ start: 13000, duration: 7000, repeatCount: 0 },
|
|
295
287
|
{ start: 20000, duration: 5000, repeatCount: 0 },
|
|
296
288
|
];
|
|
297
|
-
expect(updateSegmentTimeline
|
|
289
|
+
expect(updateSegmentTimeline(oldTimeline2, newTimeline2)).toEqual(false);
|
|
298
290
|
expect(oldTimeline2).toEqual([
|
|
299
291
|
{ start: 0, duration: 1000, repeatCount: 0 },
|
|
300
292
|
{ start: 1000, duration: 500, repeatCount: 3 },
|
|
@@ -304,7 +296,7 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
|
|
|
304
296
|
{ start: 20000, duration: 5000, repeatCount: 0 },
|
|
305
297
|
]);
|
|
306
298
|
|
|
307
|
-
expect(
|
|
299
|
+
expect(logWarn).not.toHaveBeenCalled();
|
|
308
300
|
});
|
|
309
301
|
|
|
310
302
|
it("should handle cases where the new timeline's start cannot be reached with the old timeline's repeatCount ", () => {
|
|
@@ -319,7 +311,7 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
|
|
|
319
311
|
{ start: 13700, duration: 7000, repeatCount: 0 },
|
|
320
312
|
{ start: 20700, duration: 5000, repeatCount: 0 },
|
|
321
313
|
];
|
|
322
|
-
expect(updateSegmentTimeline
|
|
314
|
+
expect(updateSegmentTimeline(oldTimeline1, newTimeline1)).toEqual(false);
|
|
323
315
|
expect(oldTimeline1).toEqual([
|
|
324
316
|
{ start: 0, duration: 1000, repeatCount: 0 },
|
|
325
317
|
{ start: 1000, duration: 500, repeatCount: 2 },
|
|
@@ -328,12 +320,12 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
|
|
|
328
320
|
{ start: 13700, duration: 7000, repeatCount: 0 },
|
|
329
321
|
{ start: 20700, duration: 5000, repeatCount: 0 },
|
|
330
322
|
]);
|
|
331
|
-
expect(
|
|
332
|
-
expect(
|
|
323
|
+
expect(logWarn).toHaveBeenCalledTimes(1);
|
|
324
|
+
expect(logWarn).toHaveBeenCalledWith(
|
|
333
325
|
"utils",
|
|
334
326
|
"Manifest update removed previous segments",
|
|
335
327
|
);
|
|
336
|
-
|
|
328
|
+
logWarn?.mockClear();
|
|
337
329
|
|
|
338
330
|
const oldTimeline2 = [
|
|
339
331
|
{ start: 0, duration: 1000, repeatCount: 0 },
|
|
@@ -345,7 +337,7 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
|
|
|
345
337
|
{ start: 13700, duration: 7000, repeatCount: 0 },
|
|
346
338
|
{ start: 20700, duration: 5000, repeatCount: 0 },
|
|
347
339
|
];
|
|
348
|
-
expect(updateSegmentTimeline
|
|
340
|
+
expect(updateSegmentTimeline(oldTimeline2, newTimeline2)).toEqual(false);
|
|
349
341
|
expect(oldTimeline2).toEqual([
|
|
350
342
|
{ start: 0, duration: 1000, repeatCount: 0 },
|
|
351
343
|
{ start: 1000, duration: 500, repeatCount: 2 },
|
|
@@ -354,26 +346,26 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
|
|
|
354
346
|
{ start: 13700, duration: 7000, repeatCount: 0 },
|
|
355
347
|
{ start: 20700, duration: 5000, repeatCount: 0 },
|
|
356
348
|
]);
|
|
357
|
-
expect(
|
|
358
|
-
expect(
|
|
349
|
+
expect(logWarn).toHaveBeenCalledTimes(1);
|
|
350
|
+
expect(logWarn).toHaveBeenCalledWith(
|
|
359
351
|
"utils",
|
|
360
352
|
"Manifest update removed previous segments",
|
|
361
353
|
);
|
|
362
|
-
|
|
354
|
+
logWarn?.mockClear();
|
|
363
355
|
|
|
364
356
|
const oldTimeline3 = [
|
|
365
357
|
{ start: 0, duration: 1000, repeatCount: 0 },
|
|
366
358
|
{ start: 1000, duration: 500, repeatCount: 21 },
|
|
367
359
|
];
|
|
368
360
|
const newTimeline3 = [{ start: 2700, duration: 500, repeatCount: 19 }];
|
|
369
|
-
expect(updateSegmentTimeline
|
|
361
|
+
expect(updateSegmentTimeline(oldTimeline3, newTimeline3)).toEqual(false);
|
|
370
362
|
expect(oldTimeline3).toEqual([
|
|
371
363
|
{ start: 0, duration: 1000, repeatCount: 0 },
|
|
372
364
|
{ start: 1000, duration: 500, repeatCount: 2 },
|
|
373
365
|
{ start: 2700, duration: 500, repeatCount: 19 },
|
|
374
366
|
]);
|
|
375
|
-
expect(
|
|
376
|
-
expect(
|
|
367
|
+
expect(logWarn).toHaveBeenCalledTimes(1);
|
|
368
|
+
expect(logWarn).toHaveBeenCalledWith(
|
|
377
369
|
"utils",
|
|
378
370
|
"Manifest update removed previous segments",
|
|
379
371
|
);
|
|
@@ -391,7 +383,7 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
|
|
|
391
383
|
{ start: 13000, duration: 7000, repeatCount: 0 },
|
|
392
384
|
{ start: 20000, duration: 5000, repeatCount: 0 },
|
|
393
385
|
];
|
|
394
|
-
expect(updateSegmentTimeline
|
|
386
|
+
expect(updateSegmentTimeline(oldTimeline1, newTimeline1)).toEqual(false);
|
|
395
387
|
expect(oldTimeline1).toEqual([
|
|
396
388
|
{ start: 0, duration: 1000, repeatCount: 0 },
|
|
397
389
|
{ start: 1000, duration: 500, repeatCount: 1 },
|
|
@@ -400,12 +392,12 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
|
|
|
400
392
|
{ start: 13000, duration: 7000, repeatCount: 0 },
|
|
401
393
|
{ start: 20000, duration: 5000, repeatCount: 0 },
|
|
402
394
|
]);
|
|
403
|
-
expect(
|
|
404
|
-
expect(
|
|
395
|
+
expect(logWarn).toHaveBeenCalledTimes(1);
|
|
396
|
+
expect(logWarn).toHaveBeenCalledWith(
|
|
405
397
|
"utils",
|
|
406
398
|
"Manifest update removed previous segments",
|
|
407
399
|
);
|
|
408
|
-
|
|
400
|
+
logWarn?.mockClear();
|
|
409
401
|
|
|
410
402
|
const oldTimeline2 = [
|
|
411
403
|
{ start: 0, duration: 1000, repeatCount: 0 },
|
|
@@ -417,7 +409,7 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
|
|
|
417
409
|
{ start: 13000, duration: 7000, repeatCount: 0 },
|
|
418
410
|
{ start: 20000, duration: 5000, repeatCount: 0 },
|
|
419
411
|
];
|
|
420
|
-
expect(updateSegmentTimeline
|
|
412
|
+
expect(updateSegmentTimeline(oldTimeline2, newTimeline2)).toEqual(false);
|
|
421
413
|
expect(oldTimeline2).toEqual([
|
|
422
414
|
{ start: 0, duration: 1000, repeatCount: 0 },
|
|
423
415
|
{ start: 1000, duration: 500, repeatCount: 1 },
|
|
@@ -426,22 +418,22 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
|
|
|
426
418
|
{ start: 13000, duration: 7000, repeatCount: 0 },
|
|
427
419
|
{ start: 20000, duration: 5000, repeatCount: 0 },
|
|
428
420
|
]);
|
|
429
|
-
expect(
|
|
430
|
-
expect(
|
|
421
|
+
expect(logWarn).toHaveBeenCalledTimes(1);
|
|
422
|
+
expect(logWarn).toHaveBeenCalledWith(
|
|
431
423
|
"utils",
|
|
432
424
|
"Manifest update removed previous segments",
|
|
433
425
|
);
|
|
434
|
-
|
|
426
|
+
logWarn?.mockClear();
|
|
435
427
|
|
|
436
428
|
const oldTimeline3 = [{ start: 1000, duration: 500, repeatCount: 21 }];
|
|
437
429
|
const newTimeline3 = [{ start: 2000, duration: 1000, repeatCount: 9 }];
|
|
438
|
-
expect(updateSegmentTimeline
|
|
430
|
+
expect(updateSegmentTimeline(oldTimeline3, newTimeline3)).toEqual(false);
|
|
439
431
|
expect(oldTimeline3).toEqual([
|
|
440
432
|
{ start: 1000, duration: 500, repeatCount: 1 },
|
|
441
433
|
{ start: 2000, duration: 1000, repeatCount: 9 },
|
|
442
434
|
]);
|
|
443
|
-
expect(
|
|
444
|
-
expect(
|
|
435
|
+
expect(logWarn).toHaveBeenCalledTimes(1);
|
|
436
|
+
expect(logWarn).toHaveBeenCalledWith(
|
|
445
437
|
"utils",
|
|
446
438
|
"Manifest update removed previous segments",
|
|
447
439
|
);
|
|
@@ -461,7 +453,7 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
|
|
|
461
453
|
{ start: 13000, duration: 7000, repeatCount: 0 },
|
|
462
454
|
{ start: 20000, duration: 5000, repeatCount: 0 },
|
|
463
455
|
];
|
|
464
|
-
expect(updateSegmentTimeline
|
|
456
|
+
expect(updateSegmentTimeline(oldTimeline1, newTimeline1)).toEqual(true);
|
|
465
457
|
expect(oldTimeline1).toEqual([
|
|
466
458
|
{ start: 2000, duration: 1000, repeatCount: 0 },
|
|
467
459
|
{ start: 3000, duration: 9000, repeatCount: 0 },
|
|
@@ -469,8 +461,8 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
|
|
|
469
461
|
{ start: 13000, duration: 7000, repeatCount: 0 },
|
|
470
462
|
{ start: 20000, duration: 5000, repeatCount: 0 },
|
|
471
463
|
]);
|
|
472
|
-
expect(
|
|
473
|
-
expect(
|
|
464
|
+
expect(logWarn).toHaveBeenCalledTimes(1);
|
|
465
|
+
expect(logWarn).toHaveBeenCalledWith(
|
|
474
466
|
"utils",
|
|
475
467
|
"Manifest update removed all previous segments",
|
|
476
468
|
);
|
|
@@ -482,7 +474,7 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
|
|
|
482
474
|
{ start: 1000, duration: 500, repeatCount: 21 },
|
|
483
475
|
];
|
|
484
476
|
const newTimeline1 = [{ start: 1000, duration: 500, repeatCount: 51 }];
|
|
485
|
-
expect(updateSegmentTimeline
|
|
477
|
+
expect(updateSegmentTimeline(oldTimeline1, newTimeline1)).toEqual(false);
|
|
486
478
|
expect(oldTimeline1).toEqual([
|
|
487
479
|
{ start: 0, duration: 1000, repeatCount: 0 },
|
|
488
480
|
{ start: 1000, duration: 500, repeatCount: 51 },
|
|
@@ -490,7 +482,7 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
|
|
|
490
482
|
|
|
491
483
|
const oldTimeline2 = [{ start: 1000, duration: 500, repeatCount: 64 }];
|
|
492
484
|
const newTimeline2 = [{ start: 1000, duration: 500, repeatCount: 72 }];
|
|
493
|
-
expect(updateSegmentTimeline
|
|
485
|
+
expect(updateSegmentTimeline(oldTimeline2, newTimeline2)).toEqual(false);
|
|
494
486
|
expect(oldTimeline2).toEqual([{ start: 1000, duration: 500, repeatCount: 72 }]);
|
|
495
487
|
|
|
496
488
|
const oldTimeline3 = [{ start: 1000, duration: 500, repeatCount: 64 }];
|
|
@@ -498,13 +490,13 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
|
|
|
498
490
|
{ start: 1000, duration: 500, repeatCount: 72 },
|
|
499
491
|
{ start: 37500, duration: 1000, repeatCount: 5 },
|
|
500
492
|
];
|
|
501
|
-
expect(updateSegmentTimeline
|
|
493
|
+
expect(updateSegmentTimeline(oldTimeline3, newTimeline3)).toEqual(false);
|
|
502
494
|
expect(oldTimeline3).toEqual([
|
|
503
495
|
{ start: 1000, duration: 500, repeatCount: 72 },
|
|
504
496
|
{ start: 37500, duration: 1000, repeatCount: 5 },
|
|
505
497
|
]);
|
|
506
498
|
|
|
507
|
-
expect(
|
|
499
|
+
expect(logWarn).not.toHaveBeenCalled();
|
|
508
500
|
});
|
|
509
501
|
|
|
510
502
|
it("should handle when the newer timeline has more depth than the older one", () => {
|
|
@@ -519,7 +511,7 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
|
|
|
519
511
|
{ start: 13000, duration: 7000, repeatCount: 0 },
|
|
520
512
|
{ start: 20000, duration: 5000, repeatCount: 0 },
|
|
521
513
|
];
|
|
522
|
-
expect(updateSegmentTimeline
|
|
514
|
+
expect(updateSegmentTimeline(oldTimeline1, newTimeline1)).toEqual(true);
|
|
523
515
|
expect(oldTimeline1).toEqual([
|
|
524
516
|
{ start: 0, duration: 1000, repeatCount: 0 },
|
|
525
517
|
{ start: 1000, duration: 500, repeatCount: 21 },
|
|
@@ -528,13 +520,13 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
|
|
|
528
520
|
{ start: 20000, duration: 5000, repeatCount: 0 },
|
|
529
521
|
]);
|
|
530
522
|
|
|
531
|
-
expect(
|
|
532
|
-
expect(
|
|
523
|
+
expect(logWarn).toHaveBeenCalledTimes(1);
|
|
524
|
+
expect(logWarn).toHaveBeenCalledWith(
|
|
533
525
|
"utils",
|
|
534
526
|
'The new index is "bigger" than the previous one',
|
|
535
527
|
);
|
|
536
528
|
|
|
537
|
-
|
|
529
|
+
logWarn?.mockClear();
|
|
538
530
|
|
|
539
531
|
const oldTimeline2 = [
|
|
540
532
|
{ start: 1000, duration: 500, repeatCount: 21 },
|
|
@@ -547,7 +539,7 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
|
|
|
547
539
|
{ start: 13000, duration: 7000, repeatCount: 0 },
|
|
548
540
|
{ start: 20000, duration: 5000, repeatCount: 0 },
|
|
549
541
|
];
|
|
550
|
-
expect(updateSegmentTimeline
|
|
542
|
+
expect(updateSegmentTimeline(oldTimeline2, newTimeline2)).toEqual(true);
|
|
551
543
|
expect(oldTimeline2).toEqual([
|
|
552
544
|
{ start: 0, duration: 1000, repeatCount: 0 },
|
|
553
545
|
{ start: 1000, duration: 500, repeatCount: 21 },
|
|
@@ -556,8 +548,8 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
|
|
|
556
548
|
{ start: 20000, duration: 5000, repeatCount: 0 },
|
|
557
549
|
]);
|
|
558
550
|
|
|
559
|
-
expect(
|
|
560
|
-
expect(
|
|
551
|
+
expect(logWarn).toHaveBeenCalledTimes(1);
|
|
552
|
+
expect(logWarn).toHaveBeenCalledWith(
|
|
561
553
|
"utils",
|
|
562
554
|
'The new index is "bigger" than the previous one',
|
|
563
555
|
);
|
|
@@ -574,7 +566,7 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
|
|
|
574
566
|
{ start: 0, duration: 1000, repeatCount: 0 },
|
|
575
567
|
{ start: 1000, duration: 500, repeatCount: 21 },
|
|
576
568
|
];
|
|
577
|
-
expect(updateSegmentTimeline
|
|
569
|
+
expect(updateSegmentTimeline(oldTimeline1, newTimeline1)).toEqual(false);
|
|
578
570
|
expect(oldTimeline1).toEqual([
|
|
579
571
|
{ start: 1000, duration: 500, repeatCount: 21 },
|
|
580
572
|
{ start: 12000, duration: 1000, repeatCount: 0 },
|
|
@@ -582,13 +574,13 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
|
|
|
582
574
|
{ start: 20000, duration: 5000, repeatCount: 0 },
|
|
583
575
|
]);
|
|
584
576
|
|
|
585
|
-
expect(
|
|
586
|
-
expect(
|
|
577
|
+
expect(logWarn).toHaveBeenCalledTimes(1);
|
|
578
|
+
expect(logWarn).toHaveBeenCalledWith(
|
|
587
579
|
"utils",
|
|
588
580
|
"The new index is older than the previous one",
|
|
589
581
|
);
|
|
590
582
|
|
|
591
|
-
|
|
583
|
+
logWarn?.mockClear();
|
|
592
584
|
|
|
593
585
|
const oldTimeline2 = [
|
|
594
586
|
{ start: 1000, duration: 500, repeatCount: 21 },
|
|
@@ -600,7 +592,7 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
|
|
|
600
592
|
{ start: 0, duration: 1000, repeatCount: 0 },
|
|
601
593
|
{ start: 1000, duration: 500, repeatCount: 21 },
|
|
602
594
|
];
|
|
603
|
-
expect(updateSegmentTimeline
|
|
595
|
+
expect(updateSegmentTimeline(oldTimeline2, newTimeline2)).toEqual(false);
|
|
604
596
|
expect(oldTimeline2).toEqual([
|
|
605
597
|
{ start: 1000, duration: 500, repeatCount: 21 },
|
|
606
598
|
{ start: 12000, duration: 1000, repeatCount: 0 },
|
|
@@ -608,12 +600,12 @@ describe("Manifest Parsers utils - updateSegmentTimeline", () => {
|
|
|
608
600
|
{ start: 20000, duration: 5000, repeatCount: -1 },
|
|
609
601
|
]);
|
|
610
602
|
|
|
611
|
-
expect(
|
|
612
|
-
expect(
|
|
603
|
+
expect(logWarn).toHaveBeenCalledTimes(1);
|
|
604
|
+
expect(logWarn).toHaveBeenCalledWith(
|
|
613
605
|
"utils",
|
|
614
606
|
"The new index is older than the previous one",
|
|
615
607
|
);
|
|
616
608
|
|
|
617
|
-
|
|
609
|
+
logWarn?.mockClear();
|
|
618
610
|
});
|
|
619
611
|
});
|
|
@@ -1,22 +1,16 @@
|
|
|
1
|
-
import { describe,
|
|
2
|
-
import
|
|
1
|
+
import { describe, afterEach, it, expect, vi } from "vitest";
|
|
2
|
+
import log from "../../../../log";
|
|
3
|
+
import resolveStylesInheritance from "../resolve_styles_inheritance";
|
|
3
4
|
|
|
4
|
-
const
|
|
5
|
-
|
|
5
|
+
const logWarn = vi.spyOn(log, "warn").mockImplementation(() => {
|
|
6
|
+
/* noop */
|
|
7
|
+
});
|
|
6
8
|
|
|
7
9
|
describe("resolve_styles_inheritance", () => {
|
|
8
|
-
beforeEach(async () => {
|
|
9
|
-
vi.doMock("../../../../log", () => ({
|
|
10
|
-
default: {
|
|
11
|
-
warn: logWarnMock,
|
|
12
|
-
},
|
|
13
|
-
}));
|
|
14
|
-
resolveStylesInheritance = (await vi.importActual("../resolve_styles_inheritance"))
|
|
15
|
-
.default as typeof IResolveStylesInheritance;
|
|
16
|
-
});
|
|
17
10
|
afterEach(() => {
|
|
18
11
|
vi.resetModules();
|
|
19
12
|
vi.resetAllMocks();
|
|
13
|
+
logWarn.mockClear();
|
|
20
14
|
});
|
|
21
15
|
|
|
22
16
|
it("should not update styles without any inheritance", () => {
|
|
@@ -31,7 +25,7 @@ describe("resolve_styles_inheritance", () => {
|
|
|
31
25
|
{ id: "2", style: { toti: "toti", tati: "totu" }, extendsStyles: [] },
|
|
32
26
|
{ id: "3", style: { titu: "totu", tatu: "tatu" }, extendsStyles: [] },
|
|
33
27
|
]);
|
|
34
|
-
expect(
|
|
28
|
+
expect(logWarn).not.toHaveBeenCalled();
|
|
35
29
|
});
|
|
36
30
|
|
|
37
31
|
it("should resolve simple inheritance", () => {
|
|
@@ -65,7 +59,7 @@ describe("resolve_styles_inheritance", () => {
|
|
|
65
59
|
extendsStyles: [],
|
|
66
60
|
},
|
|
67
61
|
]);
|
|
68
|
-
expect(
|
|
62
|
+
expect(logWarn).not.toHaveBeenCalled();
|
|
69
63
|
});
|
|
70
64
|
|
|
71
65
|
it("should be able to inherit multiple styles at once", () => {
|
|
@@ -95,7 +89,7 @@ describe("resolve_styles_inheritance", () => {
|
|
|
95
89
|
{ id: "2", style: { toti: "toti", tati: "totu" }, extendsStyles: [] },
|
|
96
90
|
{ id: "3", style: { titu: "totu", tatu: "tatu" }, extendsStyles: [] },
|
|
97
91
|
]);
|
|
98
|
-
expect(
|
|
92
|
+
expect(logWarn).not.toHaveBeenCalled();
|
|
99
93
|
});
|
|
100
94
|
|
|
101
95
|
it("should correctly overwrite inherited properties", () => {
|
|
@@ -118,7 +112,7 @@ describe("resolve_styles_inheritance", () => {
|
|
|
118
112
|
{ id: "2", style: { titi: "tito", tata: "titu" }, extendsStyles: [] },
|
|
119
113
|
{ id: "3", style: { teti: "teto", tata: "tutu" }, extendsStyles: [] },
|
|
120
114
|
]);
|
|
121
|
-
expect(
|
|
115
|
+
expect(logWarn).not.toHaveBeenCalled();
|
|
122
116
|
});
|
|
123
117
|
|
|
124
118
|
it("should correctly handle multiple levels of inheritance", () => {
|
|
@@ -153,7 +147,7 @@ describe("resolve_styles_inheritance", () => {
|
|
|
153
147
|
{ id: "3", style: { teti: "teto", tata: "tutu" }, extendsStyles: [] },
|
|
154
148
|
{ id: "4", style: { four: "4", four2: "four2" }, extendsStyles: [] },
|
|
155
149
|
]);
|
|
156
|
-
expect(
|
|
150
|
+
expect(logWarn).not.toHaveBeenCalled();
|
|
157
151
|
});
|
|
158
152
|
|
|
159
153
|
it("should avoid infinite inheritance loops", () => {
|
|
@@ -178,13 +172,13 @@ describe("resolve_styles_inheritance", () => {
|
|
|
178
172
|
},
|
|
179
173
|
]);
|
|
180
174
|
|
|
181
|
-
expect(
|
|
175
|
+
expect(logWarn).toHaveBeenNthCalledWith(
|
|
182
176
|
1,
|
|
183
177
|
"ttml",
|
|
184
178
|
"infinite style inheritance loop avoided",
|
|
185
179
|
);
|
|
186
|
-
expect(
|
|
187
|
-
|
|
180
|
+
expect(logWarn).toHaveBeenCalledTimes(1);
|
|
181
|
+
logWarn.mockReset();
|
|
188
182
|
|
|
189
183
|
// 2. More complex case
|
|
190
184
|
const initialStyle2 = [
|
|
@@ -214,17 +208,17 @@ describe("resolve_styles_inheritance", () => {
|
|
|
214
208
|
extendsStyles: [],
|
|
215
209
|
},
|
|
216
210
|
]);
|
|
217
|
-
expect(
|
|
211
|
+
expect(logWarn).toHaveBeenNthCalledWith(
|
|
218
212
|
1,
|
|
219
213
|
"ttml",
|
|
220
214
|
"infinite style inheritance loop avoided",
|
|
221
215
|
);
|
|
222
|
-
expect(
|
|
216
|
+
expect(logWarn).toHaveBeenNthCalledWith(
|
|
223
217
|
2,
|
|
224
218
|
"ttml",
|
|
225
219
|
"infinite style inheritance loop avoided",
|
|
226
220
|
);
|
|
227
|
-
expect(
|
|
221
|
+
expect(logWarn).toHaveBeenCalledTimes(2);
|
|
228
222
|
});
|
|
229
223
|
|
|
230
224
|
it("should ignore unknown IDs", () => {
|
|
@@ -247,9 +241,9 @@ describe("resolve_styles_inheritance", () => {
|
|
|
247
241
|
{ id: "2", style: { titi: "tito", teta: "tutu" }, extendsStyles: [] },
|
|
248
242
|
{ id: "3", style: { tata: "toto", tota: "tutu" }, extendsStyles: [] },
|
|
249
243
|
]);
|
|
250
|
-
expect(
|
|
244
|
+
expect(logWarn).toHaveBeenNthCalledWith(1, "ttml", "unknown style inheritance", {
|
|
251
245
|
id: "6",
|
|
252
246
|
});
|
|
253
|
-
expect(
|
|
247
|
+
expect(logWarn).toHaveBeenCalledTimes(1);
|
|
254
248
|
});
|
|
255
249
|
});
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { describe, it, expect } from "vitest";
|
|
2
2
|
import parseTTMLToDiv from "../../";
|
|
3
|
-
import globalScope from "../../../../../../utils/global_scope";
|
|
4
3
|
|
|
5
4
|
const testingText = `<?xml version="1.0" encoding="UTF-8"?>
|
|
6
5
|
<tt xmlns="http://www.w3.org/ns/ttml">
|
|
@@ -167,9 +166,7 @@ describe("Global TTML HTML parsing tests", () => {
|
|
|
167
166
|
for (const textNode of textNodes) {
|
|
168
167
|
const parentElement = textNode.parentElement;
|
|
169
168
|
if (parentElement !== null) {
|
|
170
|
-
expect(
|
|
171
|
-
"rgb(255, 255, 0)",
|
|
172
|
-
);
|
|
169
|
+
expect(parentElement.style.color).toEqual("yellow");
|
|
173
170
|
nbTextNodes++;
|
|
174
171
|
}
|
|
175
172
|
}
|
|
@@ -179,9 +176,7 @@ describe("Global TTML HTML parsing tests", () => {
|
|
|
179
176
|
for (const textNode of textNodes) {
|
|
180
177
|
const parentElement = textNode.parentElement;
|
|
181
178
|
if (parentElement !== null) {
|
|
182
|
-
expect(
|
|
183
|
-
"rgb(255, 255, 255)",
|
|
184
|
-
);
|
|
179
|
+
expect(parentElement.style.color).toEqual("white");
|
|
185
180
|
nbTextNodes++;
|
|
186
181
|
}
|
|
187
182
|
}
|