| <!-- This is a test html file for video test. --> |
| <html> |
| <body> |
| <video id='testvideo' controls autoplay muted name='media'> |
| <source src=''> |
| </video> |
| </body> |
| |
| <script type="text/javascript"> |
| var seeks = 0; |
| var max_seeks = 100; |
| var testvideo = document.getElementById('testvideo'); |
| |
| function loadSourceAndRunSeekTest(video, seek_event) { |
| testvideo.src = video; |
| testvideo.play(); |
| |
| // Random seek forward and backward until reaching max seeks. |
| // The next seek can be right after the current seek begins or completes by |
| // using either 'seeking' or 'seeked' event. |
| seeks = 0; |
| testvideo.addEventListener(seek_event, function() { |
| seeks++; if (seeks < max_seeks) randomSeek(); }); |
| |
| // Start the first seek only after the video is ready. |
| testvideo.addEventListener("loadeddata", function() { randomSeek(); }); |
| } |
| |
| function randomSeek() { |
| testvideo.currentTime = Math.random() * testvideo.duration; |
| } |
| |
| function getSeekTestStatus() { |
| if (seeks == max_seeks) |
| return 'pass' |
| |
| return testvideo.currentTime + '/' + testvideo.duration + '/' + seeks; |
| } |
| </script> |
| </html> |