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

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

mercurial