From 6bf0a5cb5034a7e684dcc3500e841785237ce2dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 19:32:43 +0200 Subject: Adding upstream version 1:115.7.0. Signed-off-by: Daniel Baumann --- dom/media/test/can_play_type_webm.js | 39 ++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 dom/media/test/can_play_type_webm.js (limited to 'dom/media/test/can_play_type_webm.js') diff --git a/dom/media/test/can_play_type_webm.js b/dom/media/test/can_play_type_webm.js new file mode 100644 index 0000000000..315a8ef3d9 --- /dev/null +++ b/dom/media/test/can_play_type_webm.js @@ -0,0 +1,39 @@ +async function check_webm(v, enabled) { + function check(type, expected) { + is( + v.canPlayType(type), + enabled ? expected : "", + type + "='" + expected + "'" + ); + } + + // WebM types + check("video/webm", "maybe"); + check("audio/webm", "maybe"); + + var video = ["vp8", "vp8.0", "vp9", "vp9.0"]; + var audio = ["vorbis", "opus"]; + + audio.forEach(function (acodec) { + check("audio/webm; codecs=" + acodec, "probably"); + check("video/webm; codecs=" + acodec, "probably"); + }); + video.forEach(function (vcodec) { + check("video/webm; codecs=" + vcodec, "probably"); + audio.forEach(function (acodec) { + check('video/webm; codecs="' + vcodec + ", " + acodec + '"', "probably"); + check('video/webm; codecs="' + acodec + ", " + vcodec + '"', "probably"); + }); + }); + + // Unsupported WebM codecs + check("video/webm; codecs=xyz", ""); + check("video/webm; codecs=xyz,vorbis", ""); + check("video/webm; codecs=vorbis,xyz", ""); + + await SpecialPowers.pushPrefEnv({ set: [["media.av1.enabled", true]] }); + check('video/webm; codecs="av1"', "probably"); + + await SpecialPowers.pushPrefEnv({ set: [["media.av1.enabled", false]] }); + check('video/webm; codecs="av1"', ""); +} -- cgit v1.2.3