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>
14 ResetToAnEmptyVideoSource
17 // NOTE: Result details are not printed for this test because time values are different from machine
18 // to machine and run to run. Commenting out the following line turns on detailed logging back on, which
19 // can be useful for debugging test failure.
20 disableFullTestDetailsPrinting();
22 function PlayWithNoRanges()
24 consoleWrite("<br><b><em>Test playing when there are no ranges</em></b>");
26 timeRangeCount
= currentTimeRange
= 0;
27 willPauseInExistingRange
= false;
28 willExtendAnExistingRange
= false;
30 startPlayingInNewRange();
33 function ResetToAVideoSource()
35 consoleWrite("<br><b><em>Test to reset to non empty video source</em></b>");
37 timeRangeCount
= currentTimeRange
= 0;
38 expectedStartTimes
= new Array();
39 expectedEndTimes
= new Array();
41 willPauseInExistingRange
= false;
42 willExtendAnExistingRange
= false;
44 var mediaFile
= findMediaFile("video", "content/test");
45 runSilently("video.src = \"" + mediaFile
+ "\"");
47 waitForEventOnce("canplay", canplay
);
48 run("video.load()"); // Triggers canplay()
51 function JumpAndPlayFwd()
53 consoleWrite("<br><b><em>Test jumping forward into a new range and play</em></b>");
55 var newTime
= video
.duration
- 0.5;
56 runSilently("video.currentTime = " + (newTime
.toFixed(2)));
58 willPauseInExistingRange
= false;
59 willExtendAnExistingRange
= false;
62 startPlayingInNewRange();
65 function ResetToAnEmptyVideoSource()
67 consoleWrite("<br><b><em>Test to reset to an empty video source</em></b>");
69 willPauseInExistingRange
= false;
70 willExtendAnExistingRange
= false;
71 timeRangeCount
= currentTimeRange
= 0;
73 expectedStartTimes
= new Array();
74 expectedEndTimes
= new Array();
76 run("video.src = \"\"");
77 waitForEvent("loadstart", function () { testRanges(); nextTest(); });
78 run("video.load()"); // Triggers loadstart()
83 <body onload=
"videoPlayedMain()">
85 <video controls
></video>
86 <p>Test of the media element 'played' attribute
</p>