content/media/test/test_aspectratio_mp4.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/media/test/test_aspectratio_mp4.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,52 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=975978
     1.8 +-->
     1.9 +
    1.10 +<head>
    1.11 +  <title>Media test: default video size</title>
    1.12 +  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.13 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    1.14 +</head>
    1.15 +<body>
    1.16 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=975978">Mozilla Bug 975978</a>
    1.17 +
    1.18 +<pre id="test">
    1.19 +<script class="testbody" type="text/javascript">
    1.20 +
    1.21 +function IsWindows7OrLater() {
    1.22 +  var re = /Windows NT (\d.\d)/;
    1.23 +  var winver = navigator.userAgent.match(re);
    1.24 +  return winver && winver.length == 2 && parseFloat(winver[1]) >= 6.1;
    1.25 +}
    1.26 +
    1.27 +SimpleTest.waitForExplicitFinish();
    1.28 +
    1.29 +// MP4 video with display size is difference to decode frame size.
    1.30 +// The display size is recorded in TrackHeaderBox 'tkhd' of this mp4 video.
    1.31 +var resource =
    1.32 +  { name:"pixel_aspect_ratio.mp4", type:"video/mp4", width:525, height:288 };
    1.33 +
    1.34 +var v = document.createElement("video");
    1.35 +v.onloadedmetadata = function() {
    1.36 +  is(v.videoWidth, resource.width, "Intrinsic width should match video width");
    1.37 +  is(v.videoHeight, resource.height, "Intrinsic height should match video height");
    1.38 +  SimpleTest.finish();
    1.39 +}
    1.40 +v.addEventListener("error", function(ev) {
    1.41 +  if (v.readyState < v.HAVE_METADATA) {
    1.42 +    info("Video element returns with readyState " + v.readyState + " error.code " + v.error.code);
    1.43 +    todo(false, "This platform doesn't support to retrieve MP4 metadata.");
    1.44 +    SimpleTest.finish();
    1.45 +  }
    1.46 +}, false);
    1.47 +
    1.48 +v.src = resource.name;
    1.49 +v.preload = "auto";
    1.50 +
    1.51 +document.body.appendChild(v);
    1.52 +</script>
    1.53 +</pre>
    1.54 +</body>
    1.55 +</html>

mercurial