mirror of
https://github.com/classilla/tenfourfox.git
synced 2024-09-10 11:54:40 +00:00
149 lines
4.6 KiB
HTML
149 lines
4.6 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<!--
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=799315
|
|
-->
|
|
<head>
|
|
<title>Test for MP4 and MP3 support</title>
|
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
|
<script type="text/javascript" src="manifest.js"></script>
|
|
</head>
|
|
<body>
|
|
<p id="display"></p>
|
|
<div id="content" style="display: none">
|
|
</div>
|
|
|
|
<video id="v"></video>
|
|
|
|
<pre id="test">
|
|
<script>
|
|
|
|
function check_mp4(v, enabled) {
|
|
function check(type, expected) {
|
|
var ex = enabled ? expected : "";
|
|
is(v.canPlayType(type), ex, type + "='" + ex + "'");
|
|
}
|
|
|
|
check("video/mp4", "maybe");
|
|
check("video/x-m4v", "maybe");
|
|
check("audio/mp4", "maybe");
|
|
check("audio/x-m4a", "maybe");
|
|
|
|
// Not the MIME type that other browsers respond to, so we won't either.
|
|
check("audio/m4a", "");
|
|
check("video/m4v", "");
|
|
|
|
check("audio/aac", "maybe");
|
|
check("audio/aacp", "maybe");
|
|
|
|
// H.264 Constrained Baseline Profile Level 3.0, AAC-LC
|
|
check("video/mp4; codecs=\"avc1.42E01E, mp4a.40.2\"", "probably");
|
|
|
|
// H.264 Constrained Baseline Profile Level 3.0, mp3
|
|
check("video/mp4; codecs=\"avc1.42E01E, mp3\"", "probably");
|
|
|
|
check("video/mp4; codecs=\"avc1.42001E, mp4a.40.2\"", "probably");
|
|
check("video/mp4; codecs=\"avc1.58A01E, mp4a.40.2\"", "probably");
|
|
|
|
// H.264 Main Profile Level 3.0, AAC-LC
|
|
check("video/mp4; codecs=\"avc1.4D401E, mp4a.40.2\"", "probably");
|
|
// H.264 Main Profile Level 3.1, AAC-LC
|
|
check("video/mp4; codecs=\"avc1.4D401F, mp4a.40.2\"", "probably");
|
|
// H.264 Main Profile Level 4.0, AAC-LC
|
|
check("video/mp4; codecs=\"avc1.4D4028, mp4a.40.2\"", "probably");
|
|
// H.264 High Profile Level 3.0, AAC-LC
|
|
check("video/mp4; codecs=\"avc1.64001E, mp4a.40.2\"", "probably");
|
|
// H.264 High Profile Level 3.1, AAC-LC
|
|
check("video/mp4; codecs=\"avc1.64001F, mp4a.40.2\"", "probably");
|
|
|
|
check("video/mp4; codecs=\"avc1.42E01E\"", "probably");
|
|
check("video/mp4; codecs=\"avc1.42001E\"", "probably");
|
|
check("video/mp4; codecs=\"avc1.58A01E\"", "probably");
|
|
check("video/mp4; codecs=\"avc1.4D401E\"", "probably");
|
|
check("video/mp4; codecs=\"avc1.64001F\"", "probably");
|
|
|
|
// AAC-LC
|
|
check("audio/mp4; codecs=\"mp4a.40.2\"", "probably");
|
|
check("audio/mp4; codecs=mp4a.40.2", "probably");
|
|
check("audio/x-m4a; codecs=\"mp4a.40.2\"", "probably");
|
|
check("audio/x-m4a; codecs=mp4a.40.2", "probably");
|
|
|
|
check("audio/mp4; codecs=\"mp4a.40.2,\"", ""); // Invalid codecs string
|
|
|
|
// HE-AAC v1
|
|
check("audio/mp4; codecs=\"mp4a.40.5\"", "probably");
|
|
check("audio/mp4; codecs=mp4a.40.5", "probably");
|
|
check("audio/x-m4a; codecs=\"mp4a.40.5\"", "probably");
|
|
check("audio/x-m4a; codecs=mp4a.40.5", "probably");
|
|
|
|
}
|
|
|
|
function check_mp3(v, enabled) {
|
|
function check(type, expected) {
|
|
var ex = enabled ? expected : "";
|
|
is(v.canPlayType(type), ex, type + "='" + ex + "'");
|
|
}
|
|
|
|
check("audio/mpeg", "maybe");
|
|
check("audio/mp3", "maybe");
|
|
|
|
check("audio/mpeg; codecs=\"mp3\"", "probably");
|
|
check("audio/mpeg; codecs=mp3", "probably");
|
|
|
|
check("audio/mp3; codecs=\"mp3\"", "probably");
|
|
check("audio/mp3; codecs=mp3", "probably");
|
|
}
|
|
|
|
function IsWindowsVistaOrLater() {
|
|
var re = /Windows NT (\d+\.\d)/;
|
|
var winver = navigator.userAgent.match(re);
|
|
return winver && winver.length == 2 && parseFloat(winver[1]) >= 6.0;
|
|
}
|
|
|
|
function IsMacOSSnowLeopardOrLater() {
|
|
var re = /Mac OS X (\d+)\.(\d+)/;
|
|
var ver = navigator.userAgent.match(re);
|
|
if (!ver || ver.length != 3) {
|
|
return false;
|
|
}
|
|
var major = ver[1] | 0;
|
|
var minor = ver[2] | 0;
|
|
return major == 10 && minor >= 6;
|
|
}
|
|
|
|
function getPref(name) {
|
|
var pref = false;
|
|
try {
|
|
pref = SpecialPowers.getBoolPref(name);
|
|
} catch(ex) { }
|
|
return pref;
|
|
}
|
|
|
|
function IsJellyBeanOrLater() {
|
|
return androidVersion >= 16;
|
|
}
|
|
|
|
var haveMp4 = (getPref("media.wmf.enabled") && IsWindowsVistaOrLater()) ||
|
|
IsMacOSSnowLeopardOrLater() ||
|
|
IsJellyBeanOrLater() ||
|
|
getPref("media.omx.enabled") ||
|
|
getPref("media.gstreamer.enabled") ||
|
|
getPref("media.ffmpeg.enabled");
|
|
|
|
check_mp4(document.getElementById('v'), haveMp4);
|
|
|
|
var haveMp3 = getPref("media.directshow.enabled") ||
|
|
(getPref("media.wmf.enabled") && IsWindowsVistaOrLater()) ||
|
|
(IsJellyBeanOrLater() && getPref("media.android-media-codec.enabled")) ||
|
|
getPref("media.gstreamer.enabled") ||
|
|
getPref("media.ffmpeg.enabled") ||
|
|
getPref("media.apple.mp3.enabled");
|
|
check_mp3(document.getElementById('v'), haveMp3);
|
|
|
|
mediaTestCleanup();
|
|
</script>
|
|
</pre>
|
|
</body>
|
|
</html>
|