4 <video controls
></video>
6 <p>Test that setting src to an invalid url triggers load(), which sets networkState
7 to NETWORK_NO_SOURCE. Setting src to a valid url should then trigger the loading
8 events and end up with networkState
>= NETWORK_LOADING.
11 <script src=media-file.js
></script>
12 <script src=video-test.js
></script>
14 function testNetworkState(expected
, endit
, op
)
16 testExpected("video.networkState", expected
, op
);
21 waitForEvent("loadstart");
22 waitForEvent("loadedmetadata");
23 waitForEvent("loadeddata");
24 waitForEvent("canplay");
25 waitForEventAndFail("play");
26 waitForEventAndFail("playing");
27 waitForEvent("canplaythrough", function () { testNetworkState(HTMLMediaElement
.NETWORK_IDLE
, true, '>=' ); } );
29 function waitUntilNotLoading()
31 if (video
.networkState
== HTMLMediaElement
.NETWORK_LOADING
) {
32 setTimeout(waitUntilNotLoading
, 100);
36 testNetworkState(HTMLMediaElement
.NETWORK_NO_SOURCE
);
39 // now set a valid url
40 var mediaFile
= findMediaFile("video", "content/test");
41 disableFullTestDetailsPrinting();
42 runSilently("video.src = '" + mediaFile
+ "'");
43 enableFullTestDetailsPrinting();
46 // first set the src to a bogus url, it should attempt a load
48 testNetworkState(HTMLMediaElement
.NETWORK_EMPTY
);
49 run("video.src = 'bogus/movie.mpg'");
51 setTimeout(waitUntilNotLoading
, 100);