<!DOCTYPE HTML>
<title>Test that setting the srcObject attribute overrides the src attribute and if the srcObject is set to null, media is reloaded from the src attribute.</title>
<video autoplay></video>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="./w3c-media-utils.js"></script>
<script>
async_test(test => {
var video = document.querySelector("video");
assert_idl_attribute(video, "srcObject");
assert_equals(video.srcObject, null);
video.src = getVideoURI("test");
navigator.webkitGetUserMedia(
{video:true},
test.step_func(stream => {
video.onplaying = test.step_func(playingSrcObject);
video.srcObject = stream;
}),
test.unreached_func("Did not get mediastream"));
function playingSrcObject()
{
assert_not_equals(video.srcObject, null);
assert_class_string(video.srcObject, "MediaStream");
assert_equals(video.currentSrc, "");
video.onplaying = test.step_func_done(playingFileAfterSrcObjectRemoved);
video.srcObject = null;
}
function playingFileAfterSrcObjectRemoved()
{
assert_equals(video.srcObject, null);
assert_equals(video.currentSrc, video.src);
}
});
</script>