tor-browser

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

track-disabled-addcue.html (1075B)


      1 <!DOCTYPE html>
      2 <title>Adding cues to a disabled text track</title>
      3 <script src="/common/media.js"></script>
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <script>
      7 async_test(function(t) {
      8    var cueDuration = 0.1;
      9    var video = document.createElement("video");
     10    var track = video.addTextTrack("subtitles");
     11    track.mode = "disabled";
     12 
     13    for (var i = 0; i < 10; ++i) {
     14        var start = i * cueDuration;
     15        var end = start + cueDuration;
     16        track.addCue(new VTTCue(start, end, "Test Cue " + i));
     17    }
     18 
     19    // Waiting for 2 cue durations to elapse.
     20    video.ontimeupdate = t.step_func(function(event) {
     21        if (event.target.currentTime < (2 * cueDuration))
     22            return;
     23 
     24        // End test after at least 2 cueDurations to make sure the test
     25        // would have gone through the period where the first 2 cues would
     26        // have been rendered if the track was not disabled.
     27        t.done();
     28    });
     29 
     30    video.src = getVideoURI("/media/test");
     31    video.play();
     32 });
     33 </script>