content/media/test/test_aspectratio_mp4.html

Fri, 16 Jan 2015 04:50:19 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 04:50:19 +0100
branch
TOR_BUG_9701
changeset 13
44a2da4a2ab2
permissions
-rw-r--r--

Replace accessor implementation with direct member state manipulation, by
request https://trac.torproject.org/projects/tor/ticket/9701#comment:32

     1 <!DOCTYPE HTML>
     2 <html>
     3 <!--
     4 https://bugzilla.mozilla.org/show_bug.cgi?id=975978
     5 -->
     7 <head>
     8   <title>Media test: default video size</title>
     9   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    10   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    11 </head>
    12 <body>
    13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=975978">Mozilla Bug 975978</a>
    15 <pre id="test">
    16 <script class="testbody" type="text/javascript">
    18 function IsWindows7OrLater() {
    19   var re = /Windows NT (\d.\d)/;
    20   var winver = navigator.userAgent.match(re);
    21   return winver && winver.length == 2 && parseFloat(winver[1]) >= 6.1;
    22 }
    24 SimpleTest.waitForExplicitFinish();
    26 // MP4 video with display size is difference to decode frame size.
    27 // The display size is recorded in TrackHeaderBox 'tkhd' of this mp4 video.
    28 var resource =
    29   { name:"pixel_aspect_ratio.mp4", type:"video/mp4", width:525, height:288 };
    31 var v = document.createElement("video");
    32 v.onloadedmetadata = function() {
    33   is(v.videoWidth, resource.width, "Intrinsic width should match video width");
    34   is(v.videoHeight, resource.height, "Intrinsic height should match video height");
    35   SimpleTest.finish();
    36 }
    37 v.addEventListener("error", function(ev) {
    38   if (v.readyState < v.HAVE_METADATA) {
    39     info("Video element returns with readyState " + v.readyState + " error.code " + v.error.code);
    40     todo(false, "This platform doesn't support to retrieve MP4 metadata.");
    41     SimpleTest.finish();
    42   }
    43 }, false);
    45 v.src = resource.name;
    46 v.preload = "auto";
    48 document.body.appendChild(v);
    49 </script>
    50 </pre>
    51 </body>
    52 </html>

mercurial