tor-browser

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

video-replay-after-audio-end.html (1065B)


      1 <html class="reftest-wait">
      2 <head>
      3  <title> Bug 1242774 : video crashed if pause and play again after audio track ends </title>
      4 </head>
      5 <body>
      6 <script type="text/javascript">
      7 function assert(value, msg) {
      8  if (!value) {
      9    dump("### Error : " + msg + "\n");
     10  }
     11 }
     12 
     13 var AUDIO_END_TIME = 4.5;
     14 var video = document.createElement('video');
     15 video.src = "video-crash.webm";
     16 video.play();
     17 
     18 video.ontimeupdate = function () {
     19  assert(AUDIO_END_TIME < video.duration,
     20         "AUDIO_END_TIME should be smaller than the duration!");
     21 
     22  if (video.currentTime > AUDIO_END_TIME) {
     23    dump("### Pause video during silent part.\n");
     24    video.ontimeupdate = null;
     25    video.pause();
     26  }
     27 
     28  video.onpause = function () {
     29    video.onpause = null;
     30    setTimeout(function() {
     31      dump("### Re-play after pausing during silent part.\n");
     32      video.play();
     33      video.onended = function () {
     34        video.onended = null;
     35        dump("### Video is ended.\n");
     36        document.documentElement.removeAttribute("class");
     37      }
     38    }, 1000);
     39  }
     40 }
     41 </script>
     42 </body>
     43 </html>