summaryrefslogtreecommitdiffstats
path: root/dom/media/test/can_play_type_webm.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /dom/media/test/can_play_type_webm.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/media/test/can_play_type_webm.js')
-rw-r--r--dom/media/test/can_play_type_webm.js54
1 files changed, 54 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 000000000..eeb79b278
--- /dev/null
+++ b/dom/media/test/can_play_type_webm.js
@@ -0,0 +1,54 @@
+function check_webm(v, enabled) {
+ function check(type, expected) {
+ is(v.canPlayType(type), enabled ? expected : "", type);
+ }
+
+ // WebM types
+ check("video/webm", "maybe");
+ check("audio/webm", "maybe");
+
+ var video = ['vp8', 'vp8.0', 'vp9', 'vp9.0'];
+ var audio = ['vorbis', 'opus'];
+ // Check for FxOS case.
+ // Since we want to use OMX webm HW acceleration to speed up vp8 decoding,
+ // we enabled it after Android version 16(JB) as MOZ_OMX_WEBM_DECODER
+ // defined in moz.build. More information is on Bug 986381.
+ // Currently OMX (KK included) webm decoders can only support vp8 and vorbis,
+ // so only vp8 and vorbis will be tested when OMX webm decoder is enabled.
+ if (navigator.userAgent.indexOf("Mobile") != -1 &&
+ navigator.userAgent.indexOf("Android") == -1) {
+ // See nsSystemInfo.cpp, the getProperty('version') and
+ // getProperty('sdk_version') are different.
+ var androidSDKVer = SpecialPowers.Cc['@mozilla.org/system-info;1']
+ .getService(SpecialPowers.Ci.nsIPropertyBag2)
+ .getProperty('sdk_version');
+ info("android version:"+androidSDKVer);
+
+ // Since from Android KK, vp9 sw decoder is supported.
+ if (androidSDKVer > 18) {
+ video = ['vp8', 'vp8.0', 'vp9', 'vp9.0'];
+ audio = ['vorbis'];
+ } else if (androidSDKVer > 15) {
+ video = ['vp8', 'vp8.0'];
+ audio = ['vorbis'];
+ }
+
+ }
+
+ 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", "");
+}