3 <meta http-equiv=
"Content-Type" content=
"text/html; charset=utf-8">
4 <title>remote
<video
> with local
<source
></title>
10 var testEnded
= false;
14 consoleWrite("<br>END OF TEST");
16 if (window
.testRunner
)
17 testRunner
.notifyDone();
21 consoleWrite("FAIL: timed out");
22 if (window
.testRunner
)
23 testRunner
.notifyDone();
28 if (!console
&& document
.body
) {
29 console
= document
.createElement('div');
30 document
.body
.appendChild(console
);
35 function consoleWrite(text
)
39 logConsole().innerHTML
+= text
+ "<br>";
42 function logEvent(evt
)
44 consoleWrite("EVENT(" + evt
.type
+ ")");
47 function logResult(msg
, success
)
50 consoleWrite("<span style='color:green'>SUCCESS: " + msg
+ "</span>");
52 consoleWrite("<span style='color:red'>FAIL: " + msg
+ "</span>");
59 logResult("failed trying to load " + video
.currentSrc
, false);
63 var localMovie
= "file:///tmp/LayoutTests/media/content/test.mp4";
64 var remoteUrl
= "http://localhost:8000/resources/test";
66 function loadedmetadata(evt
)
68 var src
= video
.currentSrc
;
69 var localFile
= localMovie
.substring(localMovie
.lastIndexOf("/")+1, localMovie
.length
)
70 var remoteFile
= remoteUrl
.substring(remoteUrl
.lastIndexOf("/")+1, remoteUrl
.length
)
73 if (src
.indexOf(localFile
) > 0)
74 logResult("local movie loaded", false);
75 else if (src
.indexOf(remoteFile
) > 0)
76 logResult("remote movie loaded, local movie failed to load", true);
80 if (window
.testRunner
)
82 localMovie
= testRunner
.pathToLocalResource(localMovie
);
83 testRunner
.dumpAsText();
84 testRunner
.waitUntilDone();
86 setTimeout(hanged
, 10000);
90 video
= document
.getElementById("vid");
92 video
.addEventListener("error", error
);
93 video
.addEventListener('loadedmetadata', loadedmetadata
);
95 // Create two <source> children, the first with a local url and the second
96 // with a remote url. The element should load the second.
97 var src1
= document
.createElement("source");
98 src1
.setAttribute("src", localMovie
);
100 if (video
.canPlayType("video/mp4"))
102 else if (video
.canPlayType("video/ogg"))
105 logResult("Missing test movie for this platform???", false);
109 var src2
= document
.createElement("source");
110 src2
.setAttribute("src", remoteUrl
);
112 video
.appendChild(src1
);
113 video
.appendChild(src2
);
119 <body onLoad=
"test()">
121 <video id='vid' controls
></video>
123 <p>Test that a remote video element will not use a local
<source
>, and will
124 use another remote
<source
></p>
126 <p>This test only behaves correctly in DRT
</p>