rx-player 4.5.0-dev.2026033100 → 4.5.0-dev.2026041501
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 +22 -5
- package/VERSION +1 -1
- package/dist/commonjs/__GENERATED_CODE/embedded_dash_wasm.d.ts.map +1 -1
- package/dist/commonjs/__GENERATED_CODE/embedded_dash_wasm.js +1 -1
- package/dist/commonjs/__GENERATED_CODE/embedded_worker.d.ts.map +1 -1
- package/dist/commonjs/__GENERATED_CODE/embedded_worker.js +1 -1
- package/dist/commonjs/compat/can_patch_out_pssh.d.ts +42 -0
- package/dist/commonjs/compat/can_patch_out_pssh.d.ts.map +1 -0
- package/dist/commonjs/compat/can_patch_out_pssh.js +53 -0
- package/dist/commonjs/compat/env_detector.d.ts +2 -0
- package/dist/commonjs/compat/env_detector.d.ts.map +1 -1
- package/dist/commonjs/compat/env_detector.js +5 -0
- package/dist/commonjs/core/adaptive/network_analyzer.d.ts +1 -2
- package/dist/commonjs/core/adaptive/network_analyzer.d.ts.map +1 -1
- package/dist/commonjs/core/adaptive/network_analyzer.js +3 -3
- package/dist/commonjs/core/adaptive/utils/representation_score_calculator.js +2 -2
- package/dist/commonjs/core/cmcd/cmcd_data_builder.d.ts.map +1 -1
- package/dist/commonjs/core/cmcd/cmcd_data_builder.js +9 -3
- package/dist/commonjs/core/entry/content_preparer.d.ts.map +1 -1
- package/dist/commonjs/core/entry/content_preparer.js +5 -7
- package/dist/commonjs/core/entry/core_entry.d.ts.map +1 -1
- package/dist/commonjs/core/entry/core_entry.js +6 -2
- package/dist/commonjs/core/entry/core_text_displayer_interface.js +3 -3
- package/dist/commonjs/core/fetchers/manifest/manifest_fetcher.d.ts.map +1 -1
- package/dist/commonjs/core/fetchers/manifest/manifest_fetcher.js +12 -0
- package/dist/commonjs/core/fetchers/thumbnails/thumbnail_fetcher.js +1 -1
- package/dist/commonjs/core/fetchers/utils/schedule_request.d.ts.map +1 -1
- package/dist/commonjs/core/fetchers/utils/schedule_request.js +4 -3
- package/dist/commonjs/core/segment_sinks/garbage_collector.d.ts +0 -2
- package/dist/commonjs/core/segment_sinks/garbage_collector.d.ts.map +1 -1
- package/dist/commonjs/core/segment_sinks/garbage_collector.js +0 -3
- package/dist/commonjs/core/segment_sinks/implementations/text/text_segment_sink.d.ts +1 -1
- package/dist/commonjs/core/segment_sinks/implementations/text/text_segment_sink.d.ts.map +1 -1
- package/dist/commonjs/core/segment_sinks/implementations/text/text_segment_sink.js +2 -2
- package/dist/commonjs/core/stream/adaptation/adaptation_stream.d.ts.map +1 -1
- package/dist/commonjs/core/stream/adaptation/adaptation_stream.js +6 -6
- package/dist/commonjs/core/stream/orchestrator/stream_orchestrator.d.ts.map +1 -1
- package/dist/commonjs/core/stream/orchestrator/stream_orchestrator.js +37 -40
- package/dist/commonjs/default_config.d.ts +5 -0
- package/dist/commonjs/default_config.d.ts.map +1 -1
- package/dist/commonjs/default_config.js +5 -0
- package/dist/commonjs/main_thread/api/public_api.d.ts.map +1 -1
- package/dist/commonjs/main_thread/api/public_api.js +23 -16
- package/dist/commonjs/main_thread/decrypt/content_decryptor.d.ts.map +1 -1
- package/dist/commonjs/main_thread/decrypt/content_decryptor.js +4 -1
- package/dist/commonjs/main_thread/decrypt/session_events_listener.js +1 -1
- package/dist/commonjs/main_thread/decrypt/set_server_certificate.d.ts +2 -0
- package/dist/commonjs/main_thread/decrypt/set_server_certificate.d.ts.map +1 -1
- package/dist/commonjs/main_thread/decrypt/set_server_certificate.js +4 -0
- package/dist/commonjs/main_thread/init/media_source_content_initializer.d.ts +0 -8
- package/dist/commonjs/main_thread/init/media_source_content_initializer.d.ts.map +1 -1
- package/dist/commonjs/main_thread/init/media_source_content_initializer.js +58 -50
- package/dist/commonjs/main_thread/init/utils/stream_events_emitter/stream_events_emitter.d.ts +35 -5
- package/dist/commonjs/main_thread/init/utils/stream_events_emitter/stream_events_emitter.d.ts.map +1 -1
- package/dist/commonjs/main_thread/init/utils/stream_events_emitter/stream_events_emitter.js +60 -19
- package/dist/commonjs/main_thread/render_thumbnail.d.ts.map +1 -1
- package/dist/commonjs/main_thread/render_thumbnail.js +4 -0
- package/dist/commonjs/main_thread/tracks_store/media_element_tracks_store.d.ts.map +1 -1
- package/dist/commonjs/main_thread/tracks_store/media_element_tracks_store.js +1 -0
- package/dist/commonjs/main_thread/tracks_store/tracks_store.d.ts +1 -1
- package/dist/commonjs/main_thread/tracks_store/tracks_store.js +1 -1
- package/dist/{es2017/parsers/containers/isobmff/take_pssh_out.d.ts → commonjs/parsers/containers/isobmff/extract_pssh.d.ts} +6 -4
- package/dist/commonjs/parsers/containers/isobmff/extract_pssh.d.ts.map +1 -0
- package/dist/commonjs/parsers/containers/isobmff/{take_pssh_out.js → extract_pssh.js} +22 -17
- package/dist/commonjs/parsers/containers/isobmff/index.d.ts +2 -2
- package/dist/commonjs/parsers/containers/isobmff/index.d.ts.map +1 -1
- package/dist/commonjs/parsers/containers/isobmff/index.js +4 -4
- package/dist/commonjs/playback_observer/core_playback_observer.d.ts +4 -4
- package/dist/commonjs/playback_observer/core_playback_observer.d.ts.map +1 -1
- package/dist/commonjs/playback_observer/media_element_playback_observer.d.ts +1 -2
- package/dist/commonjs/playback_observer/media_element_playback_observer.d.ts.map +1 -1
- package/dist/commonjs/transports/dash/segment_parser.js +1 -1
- package/dist/commonjs/transports/local/segment_parser.js +1 -1
- package/dist/commonjs/utils/test-utils.d.ts +30 -0
- package/dist/commonjs/utils/test-utils.d.ts.map +1 -0
- package/dist/commonjs/utils/test-utils.js +79 -0
- package/dist/es2017/__GENERATED_CODE/embedded_dash_wasm.d.ts.map +1 -1
- package/dist/es2017/__GENERATED_CODE/embedded_dash_wasm.js +1 -1
- package/dist/es2017/__GENERATED_CODE/embedded_worker.d.ts.map +1 -1
- package/dist/es2017/__GENERATED_CODE/embedded_worker.js +1 -1
- package/dist/es2017/compat/can_patch_out_pssh.d.ts +42 -0
- package/dist/es2017/compat/can_patch_out_pssh.d.ts.map +1 -0
- package/dist/es2017/compat/can_patch_out_pssh.js +50 -0
- package/dist/es2017/compat/env_detector.d.ts +2 -0
- package/dist/es2017/compat/env_detector.d.ts.map +1 -1
- package/dist/es2017/compat/env_detector.js +5 -0
- package/dist/es2017/core/adaptive/network_analyzer.d.ts +1 -2
- package/dist/es2017/core/adaptive/network_analyzer.d.ts.map +1 -1
- package/dist/es2017/core/adaptive/network_analyzer.js +3 -3
- package/dist/es2017/core/adaptive/utils/representation_score_calculator.js +2 -2
- package/dist/es2017/core/cmcd/cmcd_data_builder.d.ts.map +1 -1
- package/dist/es2017/core/cmcd/cmcd_data_builder.js +9 -3
- package/dist/es2017/core/entry/content_preparer.d.ts.map +1 -1
- package/dist/es2017/core/entry/content_preparer.js +3 -5
- package/dist/es2017/core/entry/core_entry.d.ts.map +1 -1
- package/dist/es2017/core/entry/core_entry.js +6 -2
- package/dist/es2017/core/entry/core_text_displayer_interface.js +3 -3
- package/dist/es2017/core/fetchers/manifest/manifest_fetcher.d.ts.map +1 -1
- package/dist/es2017/core/fetchers/manifest/manifest_fetcher.js +12 -0
- package/dist/es2017/core/fetchers/thumbnails/thumbnail_fetcher.js +1 -1
- package/dist/es2017/core/fetchers/utils/schedule_request.d.ts.map +1 -1
- package/dist/es2017/core/fetchers/utils/schedule_request.js +2 -3
- package/dist/es2017/core/segment_sinks/garbage_collector.d.ts +0 -2
- package/dist/es2017/core/segment_sinks/garbage_collector.d.ts.map +1 -1
- package/dist/es2017/core/segment_sinks/garbage_collector.js +0 -3
- package/dist/es2017/core/segment_sinks/implementations/text/text_segment_sink.d.ts +1 -1
- package/dist/es2017/core/segment_sinks/implementations/text/text_segment_sink.d.ts.map +1 -1
- package/dist/es2017/core/segment_sinks/implementations/text/text_segment_sink.js +2 -2
- package/dist/es2017/core/stream/adaptation/adaptation_stream.d.ts.map +1 -1
- package/dist/es2017/core/stream/adaptation/adaptation_stream.js +6 -6
- package/dist/es2017/core/stream/orchestrator/stream_orchestrator.d.ts.map +1 -1
- package/dist/es2017/core/stream/orchestrator/stream_orchestrator.js +40 -39
- package/dist/es2017/default_config.d.ts +5 -0
- package/dist/es2017/default_config.d.ts.map +1 -1
- package/dist/es2017/default_config.js +5 -0
- package/dist/es2017/main_thread/api/public_api.d.ts.map +1 -1
- package/dist/es2017/main_thread/api/public_api.js +20 -13
- package/dist/es2017/main_thread/decrypt/content_decryptor.d.ts.map +1 -1
- package/dist/es2017/main_thread/decrypt/content_decryptor.js +4 -1
- package/dist/es2017/main_thread/decrypt/session_events_listener.js +1 -1
- package/dist/es2017/main_thread/decrypt/set_server_certificate.d.ts +2 -0
- package/dist/es2017/main_thread/decrypt/set_server_certificate.d.ts.map +1 -1
- package/dist/es2017/main_thread/decrypt/set_server_certificate.js +4 -0
- package/dist/es2017/main_thread/init/media_source_content_initializer.d.ts +0 -8
- package/dist/es2017/main_thread/init/media_source_content_initializer.d.ts.map +1 -1
- package/dist/es2017/main_thread/init/media_source_content_initializer.js +58 -50
- package/dist/es2017/main_thread/init/utils/stream_events_emitter/stream_events_emitter.d.ts +35 -5
- package/dist/es2017/main_thread/init/utils/stream_events_emitter/stream_events_emitter.d.ts.map +1 -1
- package/dist/es2017/main_thread/init/utils/stream_events_emitter/stream_events_emitter.js +60 -19
- package/dist/es2017/main_thread/render_thumbnail.d.ts.map +1 -1
- package/dist/es2017/main_thread/render_thumbnail.js +4 -0
- package/dist/es2017/main_thread/tracks_store/media_element_tracks_store.d.ts.map +1 -1
- package/dist/es2017/main_thread/tracks_store/media_element_tracks_store.js +1 -0
- package/dist/es2017/main_thread/tracks_store/tracks_store.d.ts +1 -1
- package/dist/es2017/main_thread/tracks_store/tracks_store.js +1 -1
- package/dist/{commonjs/parsers/containers/isobmff/take_pssh_out.d.ts → es2017/parsers/containers/isobmff/extract_pssh.d.ts} +6 -4
- package/dist/es2017/parsers/containers/isobmff/extract_pssh.d.ts.map +1 -0
- package/dist/es2017/parsers/containers/isobmff/{take_pssh_out.js → extract_pssh.js} +21 -16
- package/dist/es2017/parsers/containers/isobmff/index.d.ts +2 -2
- package/dist/es2017/parsers/containers/isobmff/index.d.ts.map +1 -1
- package/dist/es2017/parsers/containers/isobmff/index.js +2 -2
- package/dist/es2017/playback_observer/core_playback_observer.d.ts +4 -4
- package/dist/es2017/playback_observer/core_playback_observer.d.ts.map +1 -1
- package/dist/es2017/playback_observer/media_element_playback_observer.d.ts +1 -2
- package/dist/es2017/playback_observer/media_element_playback_observer.d.ts.map +1 -1
- package/dist/es2017/transports/dash/segment_parser.js +2 -2
- package/dist/es2017/transports/local/segment_parser.js +2 -2
- package/dist/es2017/utils/test-utils.d.ts +30 -0
- package/dist/es2017/utils/test-utils.d.ts.map +1 -0
- package/dist/es2017/utils/test-utils.js +36 -0
- package/dist/mpd-parser.wasm +0 -0
- package/dist/worker.js +6 -6
- package/package.json +4 -2
- package/src/README.md +7 -7
- package/src/__GENERATED_CODE/embedded_dash_wasm.ts +1 -1
- package/src/__GENERATED_CODE/embedded_worker.ts +1 -1
- package/src/compat/__tests__/can_patch_out_pssh.test.ts +40 -0
- package/src/compat/can_patch_out_pssh.ts +53 -0
- package/src/compat/env_detector.ts +4 -0
- package/src/core/README.md +1 -1
- package/src/core/adaptive/README.md +3 -3
- package/src/core/adaptive/__tests__/adaptive_representation_selector.test.ts +181 -110
- package/src/core/adaptive/__tests__/guess_based_chooser.test.ts +229 -123
- package/src/core/adaptive/__tests__/mocks.ts +100 -0
- package/src/core/adaptive/__tests__/network_analyzer.test.ts +152 -59
- package/src/core/adaptive/network_analyzer.ts +4 -4
- package/src/core/adaptive/utils/__tests__/filter_by_bitrate.test.ts +11 -19
- package/src/core/adaptive/utils/__tests__/filter_by_resolution.test.ts +12 -12
- package/src/core/adaptive/utils/__tests__/last_estimate_storage.test.ts +25 -12
- package/src/core/adaptive/utils/__tests__/pending_requests_store.test.ts +13 -9
- package/src/core/adaptive/utils/__tests__/representation_score_calculator.test.ts +11 -11
- package/src/core/adaptive/utils/__tests__/select_optimal_representation.test.ts +13 -23
- package/src/core/adaptive/utils/representation_score_calculator.ts +2 -2
- package/src/core/cmcd/__tests__/cmcd_data_builder.test.ts +60 -15
- package/src/core/cmcd/cmcd_data_builder.ts +9 -3
- package/src/core/entry/README.md +2 -2
- package/src/core/entry/__tests__/core_text_displayer_interface.test.ts +20 -0
- package/src/core/entry/content_preparer.ts +2 -5
- package/src/core/entry/core_entry.ts +6 -2
- package/src/core/entry/core_text_displayer_interface.ts +3 -3
- package/src/core/fetchers/manifest/__tests__/manifest_fetcher.test.ts +52 -3
- package/src/core/fetchers/manifest/manifest_fetcher.ts +12 -0
- package/src/core/fetchers/thumbnails/__tests__/thumbnail_fetcher.test.ts +70 -0
- package/src/core/fetchers/thumbnails/thumbnail_fetcher.ts +1 -1
- package/src/core/fetchers/utils/schedule_request.ts +5 -3
- package/src/core/segment_sinks/__tests__/garbage_collector.test.ts +434 -0
- package/src/core/segment_sinks/__tests__/mocks.ts +49 -0
- package/src/core/segment_sinks/garbage_collector.ts +0 -3
- package/src/core/segment_sinks/implementations/text/__tests__/text_segment_sink.test.ts +177 -0
- package/src/core/segment_sinks/implementations/text/text_segment_sink.ts +2 -2
- package/src/core/segment_sinks/inventory/__tests__/buffered_history.test.ts +215 -0
- package/src/core/segment_sinks/inventory/__tests__/segment_inventory.test.ts +448 -0
- package/src/core/stream/adaptation/__tests__/adaptation_stream.test.ts +973 -0
- package/src/core/stream/adaptation/__tests__/get_representations_switch_strategy.test.ts +283 -374
- package/src/core/stream/adaptation/adaptation_stream.ts +6 -8
- package/src/core/stream/orchestrator/README.md +4 -4
- package/src/core/stream/orchestrator/__tests__/stream_orchestrator.test.ts +707 -0
- package/src/core/stream/orchestrator/stream_orchestrator.ts +41 -46
- package/src/core/stream/period/utils/__tests__/get_adaptation_switch_strategy.test.ts +290 -220
- package/src/core/stream/representation/__tests__/encryption_data_notifier.test.ts +93 -63
- package/src/core/stream/representation/utils/__tests__/append_segment_to_buffer.test.ts +106 -63
- package/src/core/stream/representation/utils/__tests__/check_for_discontinuity.test.ts +179 -204
- package/src/core/stream/representation/utils/__tests__/get_segment_priority.test.ts +7 -7
- package/src/core/stream/representation/utils/__tests__/push_init_segment.test.ts +103 -60
- package/src/core/stream/representation/utils/__tests__/push_media_segment.test.ts +231 -165
- package/src/default_config.ts +6 -0
- package/src/experimental/README.md +1 -1
- package/src/features/README.md +3 -3
- package/src/main_thread/api/README.md +6 -7
- package/src/main_thread/api/public_api.ts +16 -10
- package/src/main_thread/decrypt/README.md +4 -4
- package/src/main_thread/decrypt/__tests__/__global__/content_decryptor.test.ts +135 -0
- package/src/main_thread/decrypt/__tests__/__global__/get_license.test.ts +70 -0
- package/src/main_thread/decrypt/__tests__/__global__/server_certificate.test.ts +44 -0
- package/src/main_thread/decrypt/__tests__/__global__/utils.ts +2 -2
- package/src/main_thread/decrypt/content_decryptor.ts +6 -1
- package/src/main_thread/decrypt/session_events_listener.ts +1 -1
- package/src/main_thread/decrypt/set_server_certificate.ts +5 -0
- package/src/main_thread/init/media_source_content_initializer.ts +69 -55
- package/src/main_thread/init/utils/__tests__/stream_events_emitter.test.ts +175 -0
- package/src/main_thread/init/utils/stream_events_emitter/stream_events_emitter.ts +90 -26
- package/src/main_thread/render_thumbnail.ts +4 -0
- package/src/main_thread/tracks_store/README.md +12 -0
- package/src/main_thread/tracks_store/__tests__/media_element_tracks_store.test.ts +25 -18
- package/src/main_thread/tracks_store/media_element_tracks_store.ts +1 -0
- package/src/main_thread/tracks_store/tracks_store.ts +1 -1
- package/src/manifest/classes/__tests__/mocks.ts +202 -0
- package/src/parsers/containers/isobmff/__tests__/extract_pssh.test.ts +199 -0
- package/src/parsers/containers/isobmff/{take_pssh_out.ts → extract_pssh.ts} +21 -17
- package/src/parsers/containers/isobmff/index.ts +2 -2
- package/src/parsers/manifest/dash/wasm-parser/README.md +9 -9
- package/src/playback_observer/__tests__/mocks.ts +152 -0
- package/src/playback_observer/core_playback_observer.ts +4 -4
- package/src/playback_observer/media_element_playback_observer.ts +1 -1
- package/src/tools/README.md +2 -2
- package/src/transports/README.md +5 -5
- package/src/transports/dash/segment_parser.ts +2 -2
- package/src/transports/local/segment_parser.ts +2 -2
- package/src/transports/metaplaylist/README.md +4 -4
- package/src/utils/README.md +3 -3
- package/src/utils/test-utils.ts +50 -0
- package/dist/commonjs/core/entry/synchronize_sinks_on_observation.d.ts +0 -11
- package/dist/commonjs/core/entry/synchronize_sinks_on_observation.d.ts.map +0 -1
- package/dist/commonjs/core/entry/synchronize_sinks_on_observation.js +0 -20
- package/dist/commonjs/parsers/containers/isobmff/take_pssh_out.d.ts.map +0 -1
- package/dist/es2017/core/entry/synchronize_sinks_on_observation.d.ts +0 -11
- package/dist/es2017/core/entry/synchronize_sinks_on_observation.d.ts.map +0 -1
- package/dist/es2017/core/entry/synchronize_sinks_on_observation.js +0 -17
- package/dist/es2017/parsers/containers/isobmff/take_pssh_out.d.ts.map +0 -1
- package/src/core/adaptive/utils/__tests__/bandwith_estimator.test.ts +0 -117
- package/src/core/entry/synchronize_sinks_on_observation.ts +0 -22
|
@@ -1,27 +1,34 @@
|
|
|
1
|
+
import type { Mock } from "vitest";
|
|
1
2
|
import { describe, it, expect, vi, beforeEach } from "vitest";
|
|
2
|
-
import
|
|
3
|
+
import {
|
|
4
|
+
type IRepresentationProtectionData,
|
|
5
|
+
type Representation,
|
|
6
|
+
} from "../../../../manifest/classes";
|
|
7
|
+
import { DummyRepresentation } from "../../../../manifest/classes/__tests__/mocks";
|
|
3
8
|
import type { IProtectionDataInfo } from "../../../../transports";
|
|
4
9
|
import EncryptionDataNotifier from "../encryption_data_notifier";
|
|
5
10
|
|
|
6
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
7
|
-
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
8
|
-
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
9
|
-
|
|
10
|
-
vi.mock("../../../../manifest/classes", () => ({
|
|
11
|
-
Representation: vi.fn(),
|
|
12
|
-
}));
|
|
13
|
-
|
|
14
11
|
describe("EncryptionDataNotifier", () => {
|
|
15
|
-
let
|
|
16
|
-
|
|
12
|
+
let mockNotify: (contentProtections: IRepresentationProtectionData[]) => void;
|
|
13
|
+
|
|
14
|
+
let dummyRepresentation: Representation;
|
|
15
|
+
let mockGetEncryptionData: Mock<typeof dummyRepresentation.getEncryptionData>;
|
|
16
|
+
let mockGetAllEncryptionData: Mock<typeof dummyRepresentation.getAllEncryptionData>;
|
|
17
|
+
let mockAddProtectionData: Mock<typeof dummyRepresentation.addProtectionData>;
|
|
17
18
|
|
|
18
19
|
beforeEach(() => {
|
|
19
20
|
mockNotify = vi.fn();
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
|
|
22
|
+
dummyRepresentation = new DummyRepresentation();
|
|
23
|
+
mockGetEncryptionData = vi
|
|
24
|
+
.spyOn(dummyRepresentation, "getEncryptionData")
|
|
25
|
+
.mockReturnValue([]);
|
|
26
|
+
mockGetAllEncryptionData = vi
|
|
27
|
+
.spyOn(dummyRepresentation, "getAllEncryptionData")
|
|
28
|
+
.mockReturnValue([]);
|
|
29
|
+
mockAddProtectionData = vi
|
|
30
|
+
.spyOn(dummyRepresentation, "addProtectionData")
|
|
31
|
+
.mockReturnValue(false);
|
|
25
32
|
});
|
|
26
33
|
|
|
27
34
|
describe("constructor - early notification", () => {
|
|
@@ -38,16 +45,13 @@ describe("EncryptionDataNotifier", () => {
|
|
|
38
45
|
type: "cenc",
|
|
39
46
|
},
|
|
40
47
|
];
|
|
41
|
-
|
|
42
|
-
mockRepresentation.getEncryptionData.mockReturnValue(mockEncryptionData);
|
|
43
|
-
|
|
48
|
+
mockGetEncryptionData.mockReturnValue(mockEncryptionData);
|
|
44
49
|
new EncryptionDataNotifier({
|
|
45
50
|
drmSystemId: "edef8ba979d64acea3c827dcd51d21ed",
|
|
46
|
-
representation:
|
|
51
|
+
representation: dummyRepresentation,
|
|
47
52
|
notify: mockNotify,
|
|
48
53
|
});
|
|
49
|
-
|
|
50
|
-
expect(mockRepresentation.getEncryptionData).toHaveBeenCalledWith(
|
|
54
|
+
expect(mockGetEncryptionData).toHaveBeenCalledWith(
|
|
51
55
|
"edef8ba979d64acea3c827dcd51d21ed",
|
|
52
56
|
);
|
|
53
57
|
expect(mockNotify).toHaveBeenCalledWith(mockEncryptionData);
|
|
@@ -67,16 +71,15 @@ describe("EncryptionDataNotifier", () => {
|
|
|
67
71
|
type: "cenc",
|
|
68
72
|
},
|
|
69
73
|
];
|
|
70
|
-
|
|
71
|
-
mockRepresentation.getEncryptionData.mockReturnValue(mockEncryptionData);
|
|
74
|
+
mockGetEncryptionData.mockReturnValue(mockEncryptionData);
|
|
72
75
|
|
|
73
76
|
new EncryptionDataNotifier({
|
|
74
77
|
drmSystemId: "edef8ba979d64acea3c827dcd51d21ed",
|
|
75
|
-
representation:
|
|
78
|
+
representation: dummyRepresentation,
|
|
76
79
|
notify: mockNotify,
|
|
77
80
|
});
|
|
78
81
|
|
|
79
|
-
expect(
|
|
82
|
+
expect(mockGetEncryptionData).toHaveBeenCalledWith(
|
|
80
83
|
"edef8ba979d64acea3c827dcd51d21ed",
|
|
81
84
|
);
|
|
82
85
|
expect(mockNotify).not.toHaveBeenCalled();
|
|
@@ -106,11 +109,13 @@ describe("EncryptionDataNotifier", () => {
|
|
|
106
109
|
},
|
|
107
110
|
];
|
|
108
111
|
|
|
109
|
-
|
|
112
|
+
vi.spyOn(dummyRepresentation, "getEncryptionData").mockReturnValue(
|
|
113
|
+
mockEncryptionData,
|
|
114
|
+
);
|
|
110
115
|
|
|
111
116
|
new EncryptionDataNotifier({
|
|
112
117
|
drmSystemId: "edef8ba979d64acea3c827dcd51d21ed",
|
|
113
|
-
representation:
|
|
118
|
+
representation: dummyRepresentation,
|
|
114
119
|
notify: mockNotify,
|
|
115
120
|
});
|
|
116
121
|
|
|
@@ -120,7 +125,7 @@ describe("EncryptionDataNotifier", () => {
|
|
|
120
125
|
it("should NOT send notification when encryption data array is empty", () => {
|
|
121
126
|
new EncryptionDataNotifier({
|
|
122
127
|
drmSystemId: "edef8ba979d64acea3c827dcd51d21ed",
|
|
123
|
-
representation:
|
|
128
|
+
representation: dummyRepresentation,
|
|
124
129
|
notify: mockNotify,
|
|
125
130
|
});
|
|
126
131
|
|
|
@@ -130,11 +135,11 @@ describe("EncryptionDataNotifier", () => {
|
|
|
130
135
|
it("should NOT send notification when drmSystemId is undefined", () => {
|
|
131
136
|
new EncryptionDataNotifier({
|
|
132
137
|
drmSystemId: undefined,
|
|
133
|
-
representation:
|
|
138
|
+
representation: dummyRepresentation,
|
|
134
139
|
notify: mockNotify,
|
|
135
140
|
});
|
|
136
141
|
|
|
137
|
-
expect(
|
|
142
|
+
expect(mockGetEncryptionData).not.toHaveBeenCalled();
|
|
138
143
|
expect(mockNotify).not.toHaveBeenCalled();
|
|
139
144
|
});
|
|
140
145
|
|
|
@@ -152,11 +157,13 @@ describe("EncryptionDataNotifier", () => {
|
|
|
152
157
|
},
|
|
153
158
|
];
|
|
154
159
|
|
|
155
|
-
|
|
160
|
+
vi.spyOn(dummyRepresentation, "getEncryptionData").mockReturnValue(
|
|
161
|
+
mockEncryptionData,
|
|
162
|
+
);
|
|
156
163
|
|
|
157
164
|
new EncryptionDataNotifier({
|
|
158
165
|
drmSystemId: "edef8ba979d64acea3c827dcd51d21ed",
|
|
159
|
-
representation:
|
|
166
|
+
representation: dummyRepresentation,
|
|
160
167
|
notify: mockNotify,
|
|
161
168
|
});
|
|
162
169
|
|
|
@@ -168,7 +175,7 @@ describe("EncryptionDataNotifier", () => {
|
|
|
168
175
|
it("should add protection data to representation and send notification", () => {
|
|
169
176
|
const notifier = new EncryptionDataNotifier({
|
|
170
177
|
drmSystemId: undefined,
|
|
171
|
-
representation:
|
|
178
|
+
representation: dummyRepresentation,
|
|
172
179
|
notify: mockNotify,
|
|
173
180
|
});
|
|
174
181
|
|
|
@@ -197,11 +204,12 @@ describe("EncryptionDataNotifier", () => {
|
|
|
197
204
|
type: "cenc",
|
|
198
205
|
},
|
|
199
206
|
];
|
|
200
|
-
|
|
207
|
+
mockGetAllEncryptionData.mockReturnValue(allEncryptionData);
|
|
208
|
+
mockAddProtectionData.mockReturnValue(true);
|
|
201
209
|
|
|
202
210
|
notifier.onNewProtectionData(protectionData);
|
|
203
211
|
|
|
204
|
-
expect(
|
|
212
|
+
expect(mockAddProtectionData).toHaveBeenCalledWith(
|
|
205
213
|
"cenc",
|
|
206
214
|
new Uint8Array([1, 2, 3]),
|
|
207
215
|
[
|
|
@@ -211,14 +219,14 @@ describe("EncryptionDataNotifier", () => {
|
|
|
211
219
|
},
|
|
212
220
|
],
|
|
213
221
|
);
|
|
214
|
-
expect(
|
|
222
|
+
expect(mockGetAllEncryptionData).toHaveBeenCalled();
|
|
215
223
|
expect(mockNotify).toHaveBeenCalledWith(allEncryptionData);
|
|
216
224
|
});
|
|
217
225
|
|
|
218
226
|
it("should add multiple protection data items to representation", () => {
|
|
219
227
|
const notifier = new EncryptionDataNotifier({
|
|
220
228
|
drmSystemId: undefined,
|
|
221
|
-
representation:
|
|
229
|
+
representation: dummyRepresentation,
|
|
222
230
|
notify: mockNotify,
|
|
223
231
|
});
|
|
224
232
|
|
|
@@ -258,12 +266,15 @@ describe("EncryptionDataNotifier", () => {
|
|
|
258
266
|
},
|
|
259
267
|
];
|
|
260
268
|
|
|
261
|
-
|
|
269
|
+
vi.spyOn(dummyRepresentation, "getAllEncryptionData").mockReturnValue(
|
|
270
|
+
allEncryptionData,
|
|
271
|
+
);
|
|
272
|
+
mockAddProtectionData.mockReturnValue(true);
|
|
262
273
|
|
|
263
274
|
notifier.onNewProtectionData(protectionData);
|
|
264
275
|
|
|
265
|
-
expect(
|
|
266
|
-
expect(
|
|
276
|
+
expect(mockAddProtectionData).toHaveBeenCalledTimes(2);
|
|
277
|
+
expect(mockAddProtectionData).toHaveBeenNthCalledWith(
|
|
267
278
|
1,
|
|
268
279
|
"cenc",
|
|
269
280
|
new Uint8Array([1, 2, 3]),
|
|
@@ -274,7 +285,7 @@ describe("EncryptionDataNotifier", () => {
|
|
|
274
285
|
},
|
|
275
286
|
],
|
|
276
287
|
);
|
|
277
|
-
expect(
|
|
288
|
+
expect(mockAddProtectionData).toHaveBeenNthCalledWith(
|
|
278
289
|
2,
|
|
279
290
|
"cenc",
|
|
280
291
|
new Uint8Array([7, 8, 9]),
|
|
@@ -291,10 +302,13 @@ describe("EncryptionDataNotifier", () => {
|
|
|
291
302
|
it("should NOT send notification if no encryption data is available after adding", () => {
|
|
292
303
|
const notifier = new EncryptionDataNotifier({
|
|
293
304
|
drmSystemId: undefined,
|
|
294
|
-
representation:
|
|
305
|
+
representation: dummyRepresentation,
|
|
295
306
|
notify: mockNotify,
|
|
296
307
|
});
|
|
297
308
|
|
|
309
|
+
mockGetAllEncryptionData.mockReturnValue([]);
|
|
310
|
+
mockAddProtectionData.mockReturnValue(true);
|
|
311
|
+
|
|
298
312
|
const protectionData: IProtectionDataInfo[] = [
|
|
299
313
|
{
|
|
300
314
|
initDataType: "cenc",
|
|
@@ -309,20 +323,21 @@ describe("EncryptionDataNotifier", () => {
|
|
|
309
323
|
];
|
|
310
324
|
notifier.onNewProtectionData(protectionData);
|
|
311
325
|
|
|
312
|
-
expect(
|
|
313
|
-
expect(
|
|
326
|
+
expect(mockAddProtectionData).toHaveBeenCalled();
|
|
327
|
+
expect(mockGetAllEncryptionData).toHaveBeenCalled();
|
|
314
328
|
expect(mockNotify).not.toHaveBeenCalled();
|
|
315
329
|
});
|
|
316
330
|
|
|
317
331
|
it("should handle empty protection data array", () => {
|
|
318
332
|
const notifier = new EncryptionDataNotifier({
|
|
319
333
|
drmSystemId: undefined,
|
|
320
|
-
representation:
|
|
334
|
+
representation: dummyRepresentation,
|
|
321
335
|
notify: mockNotify,
|
|
322
336
|
});
|
|
337
|
+
mockAddProtectionData.mockReturnValue(true);
|
|
323
338
|
notifier.onNewProtectionData([]);
|
|
324
|
-
expect(
|
|
325
|
-
expect(
|
|
339
|
+
expect(mockAddProtectionData).not.toHaveBeenCalled();
|
|
340
|
+
expect(mockGetAllEncryptionData).toHaveBeenCalled();
|
|
326
341
|
expect(mockNotify).not.toHaveBeenCalled();
|
|
327
342
|
});
|
|
328
343
|
});
|
|
@@ -341,11 +356,13 @@ describe("EncryptionDataNotifier", () => {
|
|
|
341
356
|
type: "cenc",
|
|
342
357
|
},
|
|
343
358
|
];
|
|
344
|
-
|
|
359
|
+
vi.spyOn(dummyRepresentation, "getEncryptionData").mockReturnValue(
|
|
360
|
+
mockEncryptionData,
|
|
361
|
+
);
|
|
345
362
|
|
|
346
363
|
const notifier = new EncryptionDataNotifier({
|
|
347
364
|
drmSystemId: "edef8ba979d64acea3c827dcd51d21ed",
|
|
348
|
-
representation:
|
|
365
|
+
representation: dummyRepresentation,
|
|
349
366
|
notify: mockNotify,
|
|
350
367
|
});
|
|
351
368
|
|
|
@@ -366,27 +383,32 @@ describe("EncryptionDataNotifier", () => {
|
|
|
366
383
|
},
|
|
367
384
|
];
|
|
368
385
|
|
|
369
|
-
|
|
386
|
+
vi.spyOn(dummyRepresentation, "getAllEncryptionData").mockReturnValue([
|
|
370
387
|
...mockEncryptionData,
|
|
371
388
|
{
|
|
372
389
|
keyIds: [new Uint8Array([8, 7, 6, 5])],
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
390
|
+
values: [
|
|
391
|
+
{
|
|
392
|
+
systemId: "edef8ba979d64acea3c827dcd51d21ed",
|
|
393
|
+
data: new Uint8Array([7, 8, 9]),
|
|
394
|
+
},
|
|
395
|
+
],
|
|
396
|
+
type: "cenc",
|
|
376
397
|
},
|
|
377
398
|
]);
|
|
399
|
+
mockAddProtectionData.mockReturnValue(true);
|
|
378
400
|
|
|
379
401
|
notifier.onNewProtectionData(protectionData);
|
|
380
402
|
|
|
381
403
|
// Should still be called only once
|
|
382
404
|
expect(mockNotify).toHaveBeenCalledTimes(1);
|
|
383
|
-
expect(
|
|
405
|
+
expect(mockAddProtectionData).toHaveBeenCalled();
|
|
384
406
|
});
|
|
385
407
|
|
|
386
408
|
it("should NOT send notification again on subsequent onNewProtectionData calls", () => {
|
|
387
409
|
const notifier = new EncryptionDataNotifier({
|
|
388
410
|
drmSystemId: undefined,
|
|
389
|
-
representation:
|
|
411
|
+
representation: dummyRepresentation,
|
|
390
412
|
notify: mockNotify,
|
|
391
413
|
});
|
|
392
414
|
|
|
@@ -414,7 +436,9 @@ describe("EncryptionDataNotifier", () => {
|
|
|
414
436
|
],
|
|
415
437
|
},
|
|
416
438
|
];
|
|
417
|
-
|
|
439
|
+
vi.spyOn(dummyRepresentation, "getAllEncryptionData").mockReturnValue(
|
|
440
|
+
allEncryptionData,
|
|
441
|
+
);
|
|
418
442
|
|
|
419
443
|
// First call should trigger notification
|
|
420
444
|
notifier.onNewProtectionData(protectionData1);
|
|
@@ -433,10 +457,11 @@ describe("EncryptionDataNotifier", () => {
|
|
|
433
457
|
],
|
|
434
458
|
},
|
|
435
459
|
];
|
|
460
|
+
mockAddProtectionData.mockReturnValue(true);
|
|
436
461
|
|
|
437
462
|
notifier.onNewProtectionData(protectionData2);
|
|
438
463
|
expect(mockNotify).toHaveBeenCalledTimes(1);
|
|
439
|
-
expect(
|
|
464
|
+
expect(mockAddProtectionData).toHaveBeenCalledTimes(2);
|
|
440
465
|
});
|
|
441
466
|
});
|
|
442
467
|
|
|
@@ -465,11 +490,13 @@ describe("EncryptionDataNotifier", () => {
|
|
|
465
490
|
},
|
|
466
491
|
];
|
|
467
492
|
|
|
468
|
-
|
|
493
|
+
vi.spyOn(dummyRepresentation, "getEncryptionData").mockReturnValue(
|
|
494
|
+
mockEncryptionData,
|
|
495
|
+
);
|
|
469
496
|
|
|
470
497
|
new EncryptionDataNotifier({
|
|
471
498
|
drmSystemId: "edef8ba979d64acea3c827dcd51d21ed",
|
|
472
|
-
representation:
|
|
499
|
+
representation: dummyRepresentation,
|
|
473
500
|
notify: mockNotify,
|
|
474
501
|
});
|
|
475
502
|
|
|
@@ -490,11 +517,13 @@ describe("EncryptionDataNotifier", () => {
|
|
|
490
517
|
},
|
|
491
518
|
];
|
|
492
519
|
|
|
493
|
-
|
|
520
|
+
vi.spyOn(dummyRepresentation, "getEncryptionData").mockReturnValue(
|
|
521
|
+
mockEncryptionData,
|
|
522
|
+
);
|
|
494
523
|
|
|
495
524
|
const notifier = new EncryptionDataNotifier({
|
|
496
525
|
drmSystemId: "edef8ba979d64acea3c827dcd51d21ed",
|
|
497
|
-
representation:
|
|
526
|
+
representation: dummyRepresentation,
|
|
498
527
|
notify: mockNotify,
|
|
499
528
|
});
|
|
500
529
|
|
|
@@ -512,11 +541,12 @@ describe("EncryptionDataNotifier", () => {
|
|
|
512
541
|
],
|
|
513
542
|
},
|
|
514
543
|
];
|
|
544
|
+
mockAddProtectionData.mockReturnValue(true);
|
|
515
545
|
|
|
516
546
|
notifier.onNewProtectionData(protectionData);
|
|
517
547
|
|
|
518
548
|
// Data should still be added even though notification won't be sent again
|
|
519
|
-
expect(
|
|
549
|
+
expect(mockAddProtectionData).toHaveBeenCalledWith(
|
|
520
550
|
"cenc",
|
|
521
551
|
new Uint8Array([7, 8, 9]),
|
|
522
552
|
[
|