blob: ea5a1884ca2b2d5865b7f4b83ec3026ac6b9ca48 [file] [log] [blame]
<html>
<head>
<script src=media-file.js></script>
<script src=video-test.js></script>
<script>
var state = 0;
function playing()
{
if (state == "resuming")
failTest("<b>Playback started after interruption.</b>");
else
failTest("<b>Playback started during interruption.</b>");
}
function checkState()
{
consoleWrite("100ms timer fired...");
testExpected("video.paused", true);
switch (state) {
case "interrupted":
state = "resuming";
setTimeout(checkState, 100);
run("internals.endMediaSessionInterruption('')");
break;
case "resuming":
consoleWrite("");
endTest();
break;
}
}
function canplaythrough()
{
consoleWrite("");
run("internals.beginMediaSessionInterruption()");;
state = "interrupted";
run("video.play()");
setTimeout(checkState, 100);
}
function start()
{
if (!window.internals) {
failTest('This test requires window.internals.');
return;
}
findMediaElement();
waitForEvent('canplaythrough', canplaythrough);
waitForEvent('playing', playing);
video.src = findMediaFile("video", "content/test");
}
</script>
</head>
<body onload="start()">
<video controls ></video>
<p>Test that play() during interruption does nothing, ending interruption does not allow playback to resume.</p>
</body>
</html>