forked from WebKit/WebKit-http
-
Notifications
You must be signed in to change notification settings - Fork 0
/
video-played-ranges-1.html
99 lines (75 loc) · 3.43 KB
/
video-played-ranges-1.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<html>
<head>
<title>Test of 'played' attribute</title>
<script src=media-file.js></script>
<script src=video-test.js></script>
<script src=video-played.js></script>
<script>
var testFunctions =
[
PlayWithNoRanges,
JumpAndPlayFwd,
JumpBackAndPlayToNewRange,
JumpAndExtendRangeStart,
JumpAndExtendRangeEnd,
];
// NOTE: Detailed results are not printed for this test because time values are different from machine
// to machine and run to run. Commenting out the following line turns on detailed logging back on, which
// can be useful for debugging test failure.
disableFullTestDetailsPrinting();
function PlayWithNoRanges()
{
consoleWrite("<br><b><em>Test playing when there are no ranges</em></b>");
timeRangeCount = currentTimeRange = 0;
willPauseInExistingRange = false;
willExtendAnExistingRange = false;
startPlayingInNewRange();
}
function JumpAndPlayFwd()
{
consoleWrite("<br><b><em>Test jumping forward into a new range and play</em></b>");
var newTime = video.duration - 1.0;
runSilently("video.currentTime = " + (newTime.toFixed(2)));
currentTimeRange = 1;
willPauseInExistingRange = false;
willExtendAnExistingRange = false;
startPlayingInNewRange();
}
function JumpBackAndPlayToNewRange()
{
consoleWrite("<br><b><em>Test jumping backwards into a new range and play, should insert new range</em></b>");
var newTime = 3.00;
runSilently("video.currentTime = " + newTime);
currentTimeRange = 1;
willPauseInExistingRange = false;
willExtendAnExistingRange = false;
startPlayingInNewRange();
}
function JumpAndExtendRangeStart()
{
consoleWrite("<br><b><em>Test playing into an existing range, should extend range start</em></b>");
currentTimeRange = 1;
var newTime = (video.played.start(currentTimeRange) - 0.05).toFixed(2);
runSilently("video.currentTime = " + newTime);
expectedStartTimes[currentTimeRange] = newTime;
willPauseInExistingRange = true;
willExtendAnExistingRange = true;
startPlaying();
}
function JumpAndExtendRangeEnd()
{
consoleWrite("<br><b><em>Test jumping into an existing range and play beyond end, should extend range end</em></b>");
currentTimeRange = 1;
var newTime = (video.played.end(currentTimeRange) - 0.05).toFixed(2);
runSilently("video.currentTime = " + newTime);
willPauseInExistingRange = false;
willExtendAnExistingRange = true;
playForMillisecs(30);
}
</script>
</head>
<body onload="videoPlayedMain()">
<video controls></video>
<p>Test of the media element 'played' attribute, ranges part 1.</p>
</body>
</html>