forked from WebKit/WebKit-http
-
Notifications
You must be signed in to change notification settings - Fork 0
/
video-source-error-no-candidate.html
61 lines (47 loc) · 2.01 KB
/
video-source-error-no-candidate.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
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><video> and <source> error test</title>
<script src=video-test.js></script>
<script>
var sources = [];
var errorCount = 0;
var expectedErrorCount = 5;
function errorEvent(evt)
{
consoleWrite("");
var ndx;
for (ndx = 0; ndx < sources.length; ndx++) {
if (sources[ndx] == evt.target)
break;
}
var src = sources[ndx].getAttribute('src') == null ? "null" : "'" + relativeURL(evt.target.src) + "'";
if (sources[ndx] == evt.target)
logResult(true, "EVENT(error) from <source id='<em>" + evt.target.id + "</em>' src=<em>" + src + "</em>>");
else
logResult(false, "EVENT(error) from " + evt.target);
testExpected("video.error", null);
if (++errorCount == expectedErrorCount) {
consoleWrite("");
setTimeout(endTest, 200);
}
}
function start()
{
document.addEventListener("error", errorEvent, true);
sources = document.getElementsByTagName('source');
findMediaElement();
}
</script>
</head>
<body>
<video onloadstart="start()" controls>
<source id=missing-src type="video/blahblah">
<source id=bogus-type src=content/test.mp4 type="video/blahblah">
<source id=unsupported-media-query src=content/test.mp4 media=print>
<source id=empty-src src="" type="video/mp4">
<source id=no-extension-no-type src=nonexistent>
</video>
<p>Test that 'error' events are fired from <source> element when it can not be used.</p>
</body>
</html>