3 <script src=../../media-resources/media-file.js
></script>
4 <script src=../../media-resources/video-test.js
></script>
6 function testCommonAttributes(seekingExpected
)
8 testExpected('video.seeking', seekingExpected
, '==');
9 testExpected('video.ended', false, '==');
10 testExpected('video.currentTime == (video.duration / 2)', true, '==');
11 testExpected('video.paused', false, '==');
18 waitForEventAndFail('ended');
20 waitForEvent('durationchange');
21 waitForEvent('loadedmetadata');
22 waitForEventOnce('loadeddata', function ()
24 waitForEvent('seeking', function ()
26 testCommonAttributes(true);
27 waitForEventOnce('timeupdate', function()
29 testCommonAttributes(false);
33 waitForEvent('seeked', function ()
35 testCommonAttributes(false);
39 // Seek to half the duration of the media
40 testExpected('video.currentTime < video.duration', true, '==');
41 testExpected('video.ended', false, '==');
42 testExpected('video.seeking', false, '==');
43 testExpected('video.paused', false, '==');
44 consoleWrite('Starting seek to middle by setting video.currentTime to video.duration / 2');
45 video
.currentTime
= video
.duration
/ 2;
46 testCommonAttributes(true);
47 testExpected('video.currentTime < video.duration', true, '==');
48 testExpected('video.currentTime > 0', true, '==');
51 var mediaFile
= findMediaFile('video', 'resources/test');
52 video
.src
= '/' + mediaFile
;
57 <body onload=
"start()">
59 <p>Test event dispatches and attribute changes for seek to middle
</p>