tor-browser

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

track-remove-insert-ready-state.html (1307B)


      1 <!DOCTYPE html>
      2 <title>Attaching a media element again to the document, having a child track that failed loading doesn't block video from playing</title>
      3 <script src="/common/media.js"></script>
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <video>
      7    <track src="resources/no-webvtt.vtt" kind="captions" default>
      8 </video>
      9 <script>
     10  async_test(function(t) {
     11    var video = document.querySelector('video');
     12    video.src = getVideoURI('/media/test');
     13    video.oncanplaythrough = t.step_func(canplaythrough);
     14 
     15    function canplaythrough() {
     16      video.oncanplaythrough = null;
     17      var track = document.querySelector('track');
     18 
     19      // Track should have error as ready state.
     20      assert_equals(track.readyState, HTMLTrackElement.ERROR);
     21 
     22      // Remove the video element from body.
     23      document.body.removeChild(video);
     24 
     25      // Reset the video src attribute to re-trigger resource selection for tracks.
     26      video.src = getVideoURI('/media/test');
     27 
     28      // Append the video element back to the body.
     29      document.body.appendChild(video);
     30 
     31      assert_equals(track.readyState, HTMLTrackElement.ERROR);
     32 
     33      video.onplaying = t.step_func_done();
     34      video.play();
     35      // The video should start playing.
     36    }
     37  });
     38 </script>