78 lines
2.8 KiB
HTML
78 lines
2.8 KiB
HTML
<html lang="en">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
<title><video> and <source> error test</title>
|
|
<script src=media-file.js></script>
|
|
<script src=video-test.js></script>
|
|
|
|
<script>
|
|
|
|
var sources = [];
|
|
|
|
function loadeddata()
|
|
{
|
|
consoleWrite("");
|
|
testExpected("relativeURL(video.currentSrc)", findMediaFile("video", "content/test"));
|
|
testExpected("video.error", null);
|
|
consoleWrite("");
|
|
endTest();
|
|
}
|
|
|
|
function errorEvent(evt)
|
|
{
|
|
var ndx;
|
|
for (ndx = 0; ndx < sources.length; ndx++) {
|
|
if (sources[ndx] == evt.target)
|
|
break;
|
|
}
|
|
|
|
if (sources[ndx] == evt.target)
|
|
logResult(true, "EVENT(error) from <source id='<em>" + evt.target.id + "</em>' src='<em>" + relativeURL(evt.target.src) + "</em>'>");
|
|
else
|
|
logResult(false, "EVENT(error) from " + evt.target);
|
|
|
|
testExpected("video.error", null);
|
|
consoleWrite("");
|
|
}
|
|
|
|
function start()
|
|
{
|
|
findMediaElement();
|
|
|
|
sources = document.getElementsByTagName('source');
|
|
|
|
document.addEventListener("error", errorEvent, true);
|
|
waitForEvent("loadstart");
|
|
waitForEvent("waiting");
|
|
waitForEvent("ratechange");
|
|
waitForEvent("durationchange");
|
|
waitForEvent("pause");
|
|
waitForEvent("play");
|
|
waitForEvent("playing");
|
|
|
|
waitForEvent('loadeddata', loadeddata);
|
|
}
|
|
</script>
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<video 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=missing-file src=content/error2.mpeg type=video/mpeg>
|
|
<source id=format-error src="content/unsupported_track.mov">
|
|
<source id=supported-format-mp4 src=content/test.mp4 type="video/mp4; codecs="avc1.4D400C"">
|
|
<source id=supported-format-ogv src=content/test.ogv type="video/ogg">
|
|
</video>
|
|
|
|
<p>1. Test that errors fired while evaluating/loading <source> elements are fired at the
|
|
<source> and not at the <video> element.
|
|
<br>2. Verifiy that an 'error' event fired while processing/loading a <source> element
|
|
does not set the media element's 'error' attribute.</p>
|
|
|
|
<script>start()</script>
|
|
</body>
|
|
</html>
|