• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<!DOCTYPE html>
2<html>
3  <head>
4    <title>HTML 5 Change H.264 Video Test</title>
5    <script>
6      var changeVideoInterval;
7      var changeVideoCounter = 0;
8
9      function changeVideo() {
10        try {
11          if (changeVideoCounter == 40) {
12            alert('40 video changes done. Test over');
13            window.clearInterval(changeVideoInterval);
14            return;
15          }
16          var video = document.getElementById('video');
17          video.pause();
18          video.src = 'bear-1280x720.mp4?counter=' +
19              changeVideoCounter.toString();
20          ++changeVideoCounter;
21          video.play();
22          video.currentTime = 1;
23        }
24
25        catch (e) {
26        }
27      }
28
29      function onLoad() {
30        var video = document.getElementById('video');
31        video.play();
32        video.currentTime = 1;
33        changeVideoInterval = setInterval(changeVideo, 200);
34      }
35    </script>
36  </head>
37
38  <body onload='onLoad();'> <b> This test tests the case where in H.264 H/W
39   decoded videos are added and removed a number of times from the page,
40   while they are playing. <br> This should not cause the browser to hang.
41   <div id='videoDiv'>
42     <video id='video' width=320 height=240 src='bear-1280x720.mp4'
43       controls='controls'>
44     </video>
45   </div>
46  </body>
47</html>
48