From 46e9cd5c9a3cab356da1ee9a425e90247b19731e Mon Sep 17 00:00:00 2001 From: Paul Berberian Date: Mon, 12 Aug 2024 20:17:30 +0200 Subject: [PATCH] Add requestMediaKeySytemAccess-specific tests --- src/utils/are_codecs_compatible.ts | 6 +- .../drm_requestMediaKeySystemAccess.js | 760 +++++++++++++++++- vitest.config.mjs | 4 +- 3 files changed, 761 insertions(+), 9 deletions(-) diff --git a/src/utils/are_codecs_compatible.ts b/src/utils/are_codecs_compatible.ts index fd9959a675..e58aa39ce4 100644 --- a/src/utils/are_codecs_compatible.ts +++ b/src/utils/are_codecs_compatible.ts @@ -35,7 +35,11 @@ function areCodecsCompatible(a: string, b: string): boolean { if (codecsA === "" || codecsB === "") { return false; } - if (codecsA.split(".")[0] !== codecsB.split(".")[0]) { + let initialPartA = codecsA.split(".")[0]; + initialPartA = initialPartA === "hev1" ? "hvc1" : initialPartA; + let initialPartB = codecsB.split(".")[0]; + initialPartB = initialPartB === "hev1" ? "hvc1" : initialPartB; + if (initialPartA !== initialPartB) { return false; } return true; diff --git a/tests/integration/scenarios/drm_requestMediaKeySystemAccess.js b/tests/integration/scenarios/drm_requestMediaKeySystemAccess.js index 7e68fbefcc..c609a7272a 100644 --- a/tests/integration/scenarios/drm_requestMediaKeySystemAccess.js +++ b/tests/integration/scenarios/drm_requestMediaKeySystemAccess.js @@ -3,16 +3,13 @@ import { manifestInfos } from "../../contents/DASH_DRM_static_SegmentTemplate"; import DummyMediaElement from "../../../dist/es2017/experimental/tools/DummyMediaElement"; import RxPlayer from "../../../dist/es2017"; import waitForPlayerState, { - waitForLoadedStateAfterLoadVideo, // waitForLoadedStateAfterLoadVideo, + waitForLoadedStateAfterLoadVideo, } from "../../utils/waitForPlayerState"; +import sleep from "../../utils/sleep"; import { lockLowestBitrates } from "../../utils/bitrates"; import { generateGetLicenseForFakeLicense } from "../utils/drm_utils"; -// import sleep from "../../utils/sleep"; -// const textDecoder = new TextDecoder(); -// const textEncoder = new TextEncoder(); - -describe("DRM: Basic use cases", function () { +describe("DRM: requestMediaKeySystemAcces use cases", function () { const { url, transport } = manifestInfos; let player; const oldMediaSourceSupported = MediaSource.isTypeSupported; @@ -27,7 +24,7 @@ describe("DRM: Basic use cases", function () { player?.dispose(); }); - it("should trigger error if no key system provided is supported", async function () { + it("should trigger error if none of the key system provided is supported", async function () { dummy = new DummyMediaElement({ drmOptions: { requestMediaKeySystemAccessConfig: { @@ -68,6 +65,140 @@ describe("DRM: Basic use cases", function () { expect(error.type).to.equal("ENCRYPTED_MEDIA_ERROR"); }); + it('should ask for the following keySystems if just "playready" is set', async () => { + let checkNumber = 0; + let keySystemCheckError = null; + dummy = new DummyMediaElement({ + drmOptions: { + requestMediaKeySystemAccessConfig: { + isKeySystemSupported: (keySystem) => { + // NOTE: this method should always return `false` for the test to pass + try { + switch (checkNumber++) { + case 0: + case 1: + expect(keySystem).toEqual("com.microsoft.playready.recommendation"); + break; + case 2: + case 3: + expect(keySystem).toEqual("com.microsoft.playready"); + break; + case 4: + case 5: + expect(keySystem).toEqual("com.chromecast.playready"); + break; + case 6: + case 7: + expect(keySystem).toEqual("com.youtube.playready"); + break; + default: + throw new Error("Too many playready checks"); + } + } catch (e) { + keySystemCheckError = e; + return true; + } + return false; + }, + }, + }, + }); + player = new RxPlayer({ videoElement: dummy }); + lockLowestBitrates(player); + player.loadVideo({ + url, + transport, + autoPlay: false, + textTrackMode: "html", + textTrackElement: document.createElement("div"), + keySystems: [ + { + type: "playready", + getLicense: generateGetLicenseForFakeLicense({ + expectedkeyids: [], + askedKeyIds: [], + }), + }, + ], + }); + try { + await waitForPlayerState(player, "STOPPED", ["LOADING"]); + } catch (err) { + if (keySystemCheckError !== null) { + throw keySystemCheckError; + } else if (player.getError() !== null) { + throw player.getError(); + } + throw err; + } + const error = player.getError(); + expect(error).not.toBeNull(); + expect(error.code).to.equal("INCOMPATIBLE_KEYSYSTEMS"); + expect(error.name).to.equal("EncryptedMediaError"); + expect(error.type).to.equal("ENCRYPTED_MEDIA_ERROR"); + }); + + it('should ask for the following keySystems if just "widevine" is set', async () => { + let checkNumber = 0; + let keySystemCheckError = null; + dummy = new DummyMediaElement({ + drmOptions: { + requestMediaKeySystemAccessConfig: { + isKeySystemSupported: (keySystem) => { + // NOTE: this method should always return `false` for the test to pass + try { + switch (checkNumber++) { + case 0: + case 1: + expect(keySystem).toEqual("com.widevine.alpha"); + break; + default: + throw new Error("Too many widevine checks"); + } + } catch (e) { + keySystemCheckError = e; + return true; + } + return false; + }, + }, + }, + }); + player = new RxPlayer({ videoElement: dummy }); + lockLowestBitrates(player); + player.loadVideo({ + url, + transport, + autoPlay: false, + textTrackMode: "html", + textTrackElement: document.createElement("div"), + keySystems: [ + { + type: "widevine", + getLicense: generateGetLicenseForFakeLicense({ + expectedkeyids: [], + askedKeyIds: [], + }), + }, + ], + }); + try { + await waitForPlayerState(player, "STOPPED", ["LOADING"]); + } catch (err) { + if (keySystemCheckError !== null) { + throw keySystemCheckError; + } else if (player.getError() !== null) { + throw player.getError(); + } + throw err; + } + const error = player.getError(); + expect(error).not.toBeNull(); + expect(error.code).to.equal("INCOMPATIBLE_KEYSYSTEMS"); + expect(error.name).to.equal("EncryptedMediaError"); + expect(error.type).to.equal("ENCRYPTED_MEDIA_ERROR"); + }); + it("should load the content with a supported key system", async function () { dummy = new DummyMediaElement({ drmOptions: { @@ -169,5 +300,620 @@ describe("DRM: Basic use cases", function () { const ksConfig = player.getKeySystemConfiguration(); expect(ksConfig).not.toBeNull(); expect(ksConfig.keySystem).toEqual("com.widevine.alpha"); + expect(ksConfig.configuration.videoCapabilities).toEqual(undefined); + expect(ksConfig.configuration.audioCapabilities).toEqual(undefined); + }); + + it("should ask for the right robustnesses when a widevine keySystem is set", async () => { + for (const keySystem of ["widevine", "com.widevine.alpha"]) { + let checkNumber = 0; + let keySystemCheckError = null; + dummy = new DummyMediaElement({ + drmOptions: { + requestMediaKeySystemAccessConfig: { + getMediaKeySystemConfiguration: (keySystem, configs) => { + // NOTE: this method should always return `false` for the test to pass + try { + switch (checkNumber++) { + case 0: + expect(keySystem).toEqual("com.widevine.alpha"); + expect(configs).toHaveLength(1); + expect(configs[0].videoCapabilities).not.toHaveLength(0); + expect(configs[0].audioCapabilities).not.toHaveLength(0); + for (const prop of ["audioCapabilities", "videoCapabilities"]) { + let previousRobustness; + for (const capability of configs[0][prop]) { + const robustness = capability.robustness; + if (previousRobustness === null) { + expect(robustness).toEqual("HW_SECURE_ALL"); + } else if (previousRobustness === "HW_SECURE_ALL") { + if (robustness !== "HW_SECURE_ALL") { + expect(robustness).toEqual("HW_SECURE_DECODE"); + } + } else if (previousRobustness === "HW_SECURE_DECODE") { + if (robustness !== "HW_SECURE_DECODE") { + expect(robustness).toEqual("HW_SECURE_CRYPTO"); + } + } else if (previousRobustness === "HW_SECURE_CRYPTO") { + if (robustness !== "HW_SECURE_CRYPTO") { + expect(robustness).toEqual("SW_SECURE_DECODE"); + } + } else if (previousRobustness === "SW_SECURE_DECODE") { + if (robustness !== "SW_SECURE_DECODE") { + expect(robustness).toEqual("SW_SECURE_CRYPTO"); + } + } else if (previousRobustness === "SW_SECURE_CRYPTO") { + if (robustness !== "SW_SECURE_CRYPTO") { + throw new Error("Unexpected robustness: " + robustness); + } + } + previousRobustness = robustness; + } + if (previousRobustness === null) { + throw new Error("No robustness communicated"); + } else if (previousRobustness !== "SW_SECURE_CRYPTO") { + throw new Error("Robustness in improper order"); + } + } + break; + case 1: + expect(keySystem).toEqual("com.widevine.alpha"); + expect(configs).toHaveLength(1); + expect(configs[0].videoCapabilities).toBeUndefined(); + expect(configs[0].audioCapabilities).toBeUndefined(); + break; + default: + throw new Error("Too many widevine checks"); + } + } catch (e) { + keySystemCheckError = e; + } + return null; + }, + }, + }, + }); + player = new RxPlayer({ videoElement: dummy }); + lockLowestBitrates(player); + player.loadVideo({ + url, + transport, + autoPlay: false, + textTrackMode: "html", + textTrackElement: document.createElement("div"), + keySystems: [ + { + type: keySystem, + getLicense: generateGetLicenseForFakeLicense({ + expectedkeyids: [], + askedKeyIds: [], + }), + }, + ], + }); + try { + await waitForPlayerState(player, "STOPPED", ["LOADING"]); + } catch (err) { + if (keySystemCheckError !== null) { + throw keySystemCheckError; + } else if (player.getError() !== null) { + throw player.getError(); + } + throw err; + } + const error = player.getError(); + expect(error).not.toBeNull(); + expect(error.code).to.equal("INCOMPATIBLE_KEYSYSTEMS"); + expect(error.name).to.equal("EncryptedMediaError"); + expect(error.type).to.equal("ENCRYPTED_MEDIA_ERROR"); + expect(keySystemCheckError).to.equal(null); + player.dispose(); + await sleep(10); + expect(checkNumber).toEqual(2); + } + }); + + it("should ask for the right robustnesses when a com.microsoft.playready.recommendation keySystem is set", async () => { + let checkNumber = 0; + let keySystemCheckError = null; + dummy = new DummyMediaElement({ + drmOptions: { + requestMediaKeySystemAccessConfig: { + getMediaKeySystemConfiguration: (keySystem, configs) => { + // NOTE: this method should always return `false` for the test to pass + try { + switch (checkNumber++) { + case 0: + expect(keySystem).toEqual("com.microsoft.playready.recommendation"); + expect(configs).toHaveLength(1); + expect(configs[0].videoCapabilities).not.toHaveLength(0); + expect(configs[0].audioCapabilities).not.toHaveLength(0); + for (const prop of ["audioCapabilities", "videoCapabilities"]) { + let previousRobustness; + for (const capability of configs[0][prop]) { + const robustness = capability.robustness; + if (previousRobustness === null) { + expect(robustness).toEqual("3000"); + } else if (previousRobustness === "3000") { + if (robustness !== "3000") { + expect(robustness).toEqual("2000"); + } + } + previousRobustness = robustness; + } + if (previousRobustness === null) { + throw new Error("No robustness communicated"); + } else if (previousRobustness !== "2000") { + throw new Error("Robustness in improper order"); + } + } + break; + case 1: + expect(keySystem).toEqual("com.microsoft.playready.recommendation"); + expect(configs).toHaveLength(1); + expect(configs[0].videoCapabilities).toBeUndefined(); + expect(configs[0].audioCapabilities).toBeUndefined(); + break; + default: + throw new Error("Too many widevine checks"); + } + } catch (e) { + keySystemCheckError = e; + } + return null; + }, + }, + }, + }); + player = new RxPlayer({ videoElement: dummy }); + lockLowestBitrates(player); + player.loadVideo({ + url, + transport, + autoPlay: false, + textTrackMode: "html", + textTrackElement: document.createElement("div"), + keySystems: [ + { + type: "com.microsoft.playready.recommendation", + getLicense: generateGetLicenseForFakeLicense({ + expectedkeyids: [], + askedKeyIds: [], + }), + }, + ], + }); + try { + await waitForPlayerState(player, "STOPPED", ["LOADING"]); + } catch (err) { + if (keySystemCheckError !== null) { + throw keySystemCheckError; + } else if (player.getError() !== null) { + throw player.getError(); + } + throw err; + } + const error = player.getError(); + expect(error).not.toBeNull(); + expect(error.code).to.equal("INCOMPATIBLE_KEYSYSTEMS"); + expect(error.name).to.equal("EncryptedMediaError"); + expect(error.type).to.equal("ENCRYPTED_MEDIA_ERROR"); + expect(keySystemCheckError).to.equal(null); + expect(checkNumber).toEqual(2); + player.dispose(); + }); + + it("should only ask for the right robustnesses with a specific key system when a playready keySystem is set", async () => { + let checkNumber = 0; + let keySystemCheckError = null; + dummy = new DummyMediaElement({ + drmOptions: { + requestMediaKeySystemAccessConfig: { + getMediaKeySystemConfiguration: (keySystem, configs) => { + // NOTE: this method should always return `false` for the test to pass + try { + switch (checkNumber++) { + case 0: + expect(keySystem).toEqual("com.microsoft.playready.recommendation"); + expect(configs).toHaveLength(1); + expect(configs[0].videoCapabilities).not.toHaveLength(0); + expect(configs[0].audioCapabilities).not.toHaveLength(0); + for (const prop of ["audioCapabilities", "videoCapabilities"]) { + let previousRobustness; + for (const capability of configs[0][prop]) { + const robustness = capability.robustness; + if (previousRobustness === null) { + expect(robustness).toEqual("3000"); + } else if (previousRobustness === "3000") { + if (robustness !== "3000") { + expect(robustness).toEqual("2000"); + } + } + previousRobustness = robustness; + } + if (previousRobustness === null) { + throw new Error("No robustness communicated"); + } else if (previousRobustness !== "2000") { + throw new Error("Robustness in improper order"); + } + } + break; + case 1: + expect(keySystem).toEqual("com.microsoft.playready.recommendation"); + expect(configs).toHaveLength(1); + expect(configs[0].videoCapabilities).toBeUndefined(); + expect(configs[0].audioCapabilities).toBeUndefined(); + break; + case 2: + case 4: + case 6: + expect(configs).toHaveLength(1); + expect(configs[0].videoCapabilities).not.toHaveLength(0); + expect(configs[0].audioCapabilities).not.toHaveLength(0); + expect(configs[0].videoCapabilities).not.toBeUndefined(); + expect(configs[0].audioCapabilities).not.toBeUndefined(); + for (const prop of ["audioCapabilities", "videoCapabilities"]) { + for (const capability of configs[0][prop]) { + expect(capability.robustness).toEqual(undefined); + } + } + break; + case 3: + case 5: + case 7: + expect(configs).toHaveLength(1); + expect(configs[0].videoCapabilities).toBeUndefined(); + expect(configs[0].audioCapabilities).toBeUndefined(); + break; + } + } catch (e) { + keySystemCheckError = e; + } + return null; + }, + }, + }, + }); + player = new RxPlayer({ videoElement: dummy }); + lockLowestBitrates(player); + player.loadVideo({ + url, + transport, + autoPlay: false, + textTrackMode: "html", + textTrackElement: document.createElement("div"), + keySystems: [ + { + type: "playready", + getLicense: generateGetLicenseForFakeLicense({ + expectedkeyids: [], + askedKeyIds: [], + }), + }, + ], + }); + try { + await waitForPlayerState(player, "STOPPED", ["LOADING"]); + } catch (err) { + if (keySystemCheckError !== null) { + throw keySystemCheckError; + } else if (player.getError() !== null) { + throw player.getError(); + } + throw err; + } + const error = player.getError(); + expect(error).not.toBeNull(); + expect(error.code).to.equal("INCOMPATIBLE_KEYSYSTEMS"); + expect(error.name).to.equal("EncryptedMediaError"); + expect(error.type).to.equal("ENCRYPTED_MEDIA_ERROR"); + expect(keySystemCheckError).to.equal(null); + expect(checkNumber).toEqual(8); + player.dispose(); + }); + + it("should not ask for any robustnesses when other playready keySystems are set", async () => { + for (const keySystem of [ + "com.microsoft.playready", + "com.playready.hardware", + "com.playready.software", + "com.chromecast.playready", + "com.youtube.playready", + ]) { + let checkNumber = 0; + let keySystemCheckError = null; + dummy = new DummyMediaElement({ + drmOptions: { + requestMediaKeySystemAccessConfig: { + getMediaKeySystemConfiguration: (keySystem, configs) => { + // NOTE: this method should always return `false` for the test to pass + try { + switch (checkNumber++) { + case 0: + expect(configs).toHaveLength(1); + expect(configs[0].videoCapabilities).not.toHaveLength(0); + expect(configs[0].audioCapabilities).not.toHaveLength(0); + expect(configs[0].videoCapabilities).not.toBeUndefined(); + expect(configs[0].audioCapabilities).not.toBeUndefined(); + for (const prop of ["audioCapabilities", "videoCapabilities"]) { + for (const capability of configs[0][prop]) { + expect(capability.robustness).toEqual(undefined); + } + } + break; + case 1: + expect(configs).toHaveLength(1); + expect(configs[0].videoCapabilities).toBeUndefined(); + expect(configs[0].audioCapabilities).toBeUndefined(); + break; + } + } catch (e) { + keySystemCheckError = e; + } + return null; + }, + }, + }, + }); + player = new RxPlayer({ videoElement: dummy }); + lockLowestBitrates(player); + player.loadVideo({ + url, + transport, + autoPlay: false, + textTrackMode: "html", + textTrackElement: document.createElement("div"), + keySystems: [ + { + type: keySystem, + getLicense: generateGetLicenseForFakeLicense({ + expectedkeyids: [], + askedKeyIds: [], + }), + }, + ], + }); + try { + await waitForPlayerState(player, "STOPPED", ["LOADING"]); + } catch (err) { + if (keySystemCheckError !== null) { + throw keySystemCheckError; + } else if (player.getError() !== null) { + throw player.getError(); + } + throw err; + } + const error = player.getError(); + expect(error).not.toBeNull(); + expect(error.code).to.equal("INCOMPATIBLE_KEYSYSTEMS"); + expect(error.name).to.equal("EncryptedMediaError"); + expect(error.type).to.equal("ENCRYPTED_MEDIA_ERROR"); + expect(keySystemCheckError).to.equal(null); + player.dispose(); + await sleep(10); + expect(checkNumber).toEqual(2); + } + }); + + it("should not play hevc if not anounced as supported", async function () { + dummy = new DummyMediaElement({ + drmOptions: { + requestMediaKeySystemAccessConfig: { + isKeySystemSupported: (keySystem) => keySystem === "com.widevine.alpha", + getMediaKeySystemConfiguration: (_keySystem, configs) => { + for (const config of configs) { + if ( + !Array.isArray(config.videoCapabilities) || + config.videoCapabilities === undefined + ) { + return config; + } + const filtered = config.videoCapabilities.filter((v) => { + return ( + v.contentType === undefined || + (v.contentType.indexOf("hev") === -1 && + v.contentType.indexOf("hvc") === -1) + ); + }); + if (filtered.length !== 0) { + return { + ...config, + videoCapabilities: filtered, + }; + } + } + return null; + }, + }, + }, + }); + player = new RxPlayer({ videoElement: dummy }); + lockLowestBitrates(player); + const expectedKeyIds = [ + "80399bf58a2140148053e27e748e98c1", + "80399bf58a2140148053e27e748e98c0", + "585f233f307246f19fa46dc22c66a014", + ]; + const askedKeyIds = []; + player.loadVideo({ + url, + transport, + autoPlay: false, + textTrackMode: "html", + textTrackElement: document.createElement("div"), + keySystems: [ + { + type: "com.microsoft.playready", + getLicense: () => { + throw new Error("Wrong key system"); + }, + }, + { + type: "com.widevine.alpha", + getLicense: generateGetLicenseForFakeLicense({ + expectedKeyIds, + askedKeyIds, + }), + }, + ], + }); + try { + await waitForLoadedStateAfterLoadVideo(player); + } catch (err) { + if (player.getError() !== null) { + throw player.getError(); + } + throw err; + } + expect(player.getError()).toBeNull(); + expect(askedKeyIds).toContain("80399bf58a2140148053e27e748e98c0"); + const availableVideoTracks = player.getAvailableVideoTracks(); + expect(availableVideoTracks).toHaveLength(1); + expect( + availableVideoTracks[0].representations.every( + (r) => r.codec !== undefined && r.codec.indexOf("avc1") === 0, + ), + ).toBeTruthy(); + }); + + it("should not play avc if not anounced as supported", async function () { + dummy = new DummyMediaElement({ + drmOptions: { + requestMediaKeySystemAccessConfig: { + isKeySystemSupported: (keySystem) => keySystem === "com.widevine.alpha", + getMediaKeySystemConfiguration: (_keySystem, configs) => { + for (const config of configs) { + if ( + !Array.isArray(config.videoCapabilities) || + config.videoCapabilities === undefined + ) { + return config; + } + const filtered = config.videoCapabilities.filter((v) => { + return v.contentType === undefined || v.contentType.indexOf("avc") === -1; + }); + if (filtered.length !== 0) { + return { + ...config, + videoCapabilities: filtered, + }; + } + } + return null; + }, + }, + }, + }); + player = new RxPlayer({ videoElement: dummy }); + lockLowestBitrates(player); + const expectedKeyIds = [ + "80399bf58a2140148053e27e748e98c1", + "80399bf58a2140148053e27e748e98c0", + "585f233f307246f19fa46dc22c66a014", + ]; + const askedKeyIds = []; + player.loadVideo({ + url, + transport, + autoPlay: false, + textTrackMode: "html", + textTrackElement: document.createElement("div"), + keySystems: [ + { + type: "com.microsoft.playready", + getLicense: () => { + throw new Error("Wrong key system"); + }, + }, + { + type: "com.widevine.alpha", + getLicense: generateGetLicenseForFakeLicense({ + expectedKeyIds, + askedKeyIds, + }), + }, + ], + }); + try { + await waitForLoadedStateAfterLoadVideo(player); + } catch (err) { + if (player.getError() !== null) { + throw player.getError(); + } + throw err; + } + expect(player.getError()).toBeNull(); + expect(askedKeyIds).not.toContain("80399bf58a2140148053e27e748e98c0"); + const availableVideoTracks = player.getAvailableVideoTracks(); + expect(availableVideoTracks).toHaveLength(1); + expect( + availableVideoTracks[0].representations.every( + (r) => r.codec !== undefined && r.codec.indexOf("hev1") === 0, + ), + ).toBeTruthy(); + }); + + it("should have both avc and hevc if both are anounced as supported", async function () { + dummy = new DummyMediaElement({ + drmOptions: { + requestMediaKeySystemAccessConfig: { + isKeySystemSupported: (keySystem) => keySystem === "com.widevine.alpha", + getMediaKeySystemConfiguration: (_keySystem, configs) => { + return configs[0]; + }, + }, + }, + }); + player = new RxPlayer({ videoElement: dummy }); + lockLowestBitrates(player); + const expectedKeyIds = [ + "80399bf58a2140148053e27e748e98c1", + "80399bf58a2140148053e27e748e98c0", + "585f233f307246f19fa46dc22c66a014", + ]; + const askedKeyIds = []; + player.loadVideo({ + url, + transport, + autoPlay: false, + textTrackMode: "html", + textTrackElement: document.createElement("div"), + keySystems: [ + { + type: "com.microsoft.playready", + getLicense: () => { + throw new Error("Wrong key system"); + }, + }, + { + type: "com.widevine.alpha", + getLicense: generateGetLicenseForFakeLicense({ + expectedKeyIds, + askedKeyIds, + }), + }, + ], + }); + try { + await waitForLoadedStateAfterLoadVideo(player); + } catch (err) { + if (player.getError() !== null) { + throw player.getError(); + } + throw err; + } + expect(player.getError()).toBeNull(); + const availableVideoTracks = player.getAvailableVideoTracks(); + expect(availableVideoTracks).toHaveLength(2); + expect( + availableVideoTracks[0].representations.every( + (r) => r.codec !== undefined && r.codec.indexOf("hev1") === 0, + ), + ).toBeTruthy(); + expect( + availableVideoTracks[1].representations.every( + (r) => r.codec !== undefined && r.codec.indexOf("avc1") === 0, + ), + ).toBeTruthy(); }); }); diff --git a/vitest.config.mjs b/vitest.config.mjs index 2ba88024ee..2314832449 100644 --- a/vitest.config.mjs +++ b/vitest.config.mjs @@ -26,6 +26,7 @@ function getBrowserConfig(browser) { name: "chrome", provider: "webdriverio", headless: true, + screenshotFailures: false, providerOptions: { capabilities: { "goog:chromeOptions": { @@ -45,6 +46,7 @@ function getBrowserConfig(browser) { name: "firefox", provider: "webdriverio", headless: true, + screenshotFailures: false, providerOptions: { capabilities: { "moz:firefoxOptions": { @@ -90,7 +92,7 @@ export default defineConfig({ watch: false, globals: false, reporters: "dot", - include: ["tests/**/drm_requestMediaKeySystemAccess.[jt]s?(x)"], + include: ["tests/**/*.[jt]s?(x)"], globalSetup: "tests/contents/server.mjs", browser: getBrowserConfig(process.env.BROWSER_CONFIG), },