3 <title>Test of 'played' attribute
</title>
4 <script src=media-file.js
></script>
5 <script src=video-test.js
></script>
6 <script src=video-played.js
></script>
13 JumpBackAndPlayToNewRange
,
14 JumpAndExtendRangeStart
,
15 JumpAndExtendRangeEnd
,
18 // NOTE: Detailed results are not printed for this test because time values are different from machine
19 // to machine and run to run. Commenting out the following line turns on detailed logging back on, which
20 // can be useful for debugging test failure.
21 disableFullTestDetailsPrinting();
23 function PlayWithNoRanges()
25 consoleWrite("<br><b><em>Test playing when there are no ranges</em></b>");
27 timeRangeCount
= currentTimeRange
= 0;
28 willPauseInExistingRange
= false;
29 willExtendAnExistingRange
= false;
31 startPlayingInNewRange();
34 function JumpAndPlayFwd()
36 consoleWrite("<br><b><em>Test jumping forward into a new range and play</em></b>");
38 var newTime
= video
.duration
- 1.0;
39 runSilently("video.currentTime = " + (newTime
.toFixed(2)));
42 willPauseInExistingRange
= false;
43 willExtendAnExistingRange
= false;
45 startPlayingInNewRange();
48 function JumpBackAndPlayToNewRange()
50 consoleWrite("<br><b><em>Test jumping backwards into a new range and play, should insert new range</em></b>");
53 runSilently("video.currentTime = " + newTime
);
56 willPauseInExistingRange
= false;
57 willExtendAnExistingRange
= false;
59 startPlayingInNewRange();
62 function JumpAndExtendRangeStart()
64 consoleWrite("<br><b><em>Test playing into an existing range, should extend range start</em></b>");
67 var newTime
= (video
.played
.start(currentTimeRange
) - 0.05).toFixed(2);
68 runSilently("video.currentTime = " + newTime
);
70 expectedStartTimes
[currentTimeRange
] = newTime
;
71 willPauseInExistingRange
= true;
72 willExtendAnExistingRange
= true;
76 function JumpAndExtendRangeEnd()
78 consoleWrite("<br><b><em>Test jumping into an existing range and play beyond end, should extend range end</em></b>");
82 var newTime
= (video
.played
.end(currentTimeRange
) - 0.05).toFixed(2);
83 runSilently("video.currentTime = " + newTime
);
85 willPauseInExistingRange
= false;
86 willExtendAnExistingRange
= true;
93 <body onload=
"videoPlayedMain()">
95 <video controls
></video>
96 <p>Test of the media element 'played' attribute, ranges part
1.
</p>