blob: 5c69ab01d12476cc6a90b08773f02a10503a97e6 [file] [edit]
<html>
<head>
<script src=media-file.js></script>
<script src=video-test.js></script>
<script>
var state = 0;
function checkState()
{
consoleWrite("100ms timer fired...");
testExpected("video.paused", true);
state = "resuming";
run("internals.endMediaSessionInterruption('MayResumePlaying')");
}
function playing()
{
if (state != "resuming")
{
consoleWrite("");
failTest("<b>Playback started during interruption.</b>");
return;
}
consoleWrite("");
endTest();
}
function canplaythrough()
{
consoleWrite("");
run("video.play()");
setTimeout(checkState, 100);
}
function start()
{
if (!window.internals) {
failTest('This test requires window.internals.');
return;
}
run("internals.beginMediaSessionInterruption()");;
run("video = document.createElement('video')");
run("document.body.appendChild(video)");
waitForEvent('canplaythrough', canplaythrough);
waitForEvent('playing', playing);
video.src = findMediaFile("video", "content/test");
state = "interrupted";
}
</script>
</head>
<body onload="start()">
<p>Test a &lt;video&gt; element crated during interruption behaves correctly.</p>
</body>
</html>