tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

fragmented-mp4-end.html (1290B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <title>Fragmented MP4 Play to End</title>
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <body>
      7  <video id="video"
      8         src="/media-source/mp4/test-v-128k-320x240-24fps-8kfr.mp4"
      9         type="video/mp4; codecs=avc1.64000D"
     10         controls
     11  </video>
     12 </body>
     13 <script>
     14 // Test that a fragmented mp4 can be played until the end without error.
     15 promise_test(async t => {
     16  const type = video.getAttribute('type');
     17  const canPlay = video.canPlayType(type);
     18  // https://html.spec.whatwg.org/multipage/media.html#dom-navigator-canplaytype
     19  // must return "probably" if the user agent is confident that the type
     20  // represents a media resource that it can render if used in with this audio
     21  // or video element;
     22  assert_implements_optional(
     23    canPlay == 'probably',
     24    `Test needs canPlayType('${type}') == 'probably'; got '${canPlay}'.`);
     25 
     26  video.watcher = new EventWatcher(t, video,
     27                                   ['error', 'seeked', 'playing', 'ended']);
     28  // Shorten test.
     29  video.currentTime = 1.9;
     30  await video.watcher.wait_for('seeked');
     31 
     32  await Promise.all([
     33    video.play(),
     34    video.watcher.wait_for(['playing','ended']),
     35  ]);
     36 }, 'fragmented-mp4-end');
     37 </script>