summaryrefslogtreecommitdiffstats
path: root/dom/media/test/can_play_type_webm.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /dom/media/test/can_play_type_webm.js
parentInitial commit. (diff)
downloadthunderbird-upstream.tar.xz
thunderbird-upstream.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/media/test/can_play_type_webm.js')
-rw-r--r--dom/media/test/can_play_type_webm.js39
1 files changed, 39 insertions, 0 deletions
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"', "");
+}