4 <title>load() and the <source> element</title>
5 <script src=video-test.js></script>
6 <script src=media-file.js></script>
11 function canplaythrough()
13 testExpected("stripExtension(relativeURL(video.currentSrc))", relativeURL(stripExtension(sources[1])));
18 consoleWrite("<br>+++ Calling load().");
27 function addSource(type, name)
29 var source = document.createElement('source');
30 source.src = findMediaFile(type, name);
31 sources.push(source.src);
32 source.type = mimeTypeForExtension(source.src.split('.').pop());
33 video.appendChild(source);
38 video = mediaElement = document.getElementsByTagName('video')[0];
40 consoleWrite("+++ Test initial networkState.");
41 testExpected("video.networkState", HTMLMediaElement.prototype.NETWORK_EMPTY, "==");
43 // Add an invalid url to the first source so we test getting an error event
44 // each time resource selection runs.
45 addSource("video", "content/bogus");
46 addSource("video", "content/test");
47 addSource("audio", "content/test");
49 consoleWrite("<br>+++ Add <source> elements to trigger loading, test networkState.");
50 testExpected("video.networkState", HTMLMediaElement.prototype.NETWORK_NO_SOURCE, "==");
52 waitForEvent("canplaythrough", canplaythrough);
53 waitForEvent("error");
57 <body onload="setup()">
58 <video controls width=300 ></video>
59 <p>Test that the resource selection algorithm is restarted when load() is called, and that all <source> elements are reconsidered.</p>