58 lines
1.7 KiB
HTML
58 lines
1.7 KiB
HTML
<html>
|
|
<head>
|
|
<script src=media-file.js></script>
|
|
<script src=video-test.js></script>
|
|
<script>
|
|
var state = 0;
|
|
|
|
function playing()
|
|
{
|
|
run("internals.beginMediaSessionInterruption('System')");;
|
|
setTimeout(checkState, 100);
|
|
}
|
|
|
|
function checkState()
|
|
{
|
|
consoleWrite("<br>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()
|
|
{
|
|
state = "interrupted";
|
|
run("video.play()");
|
|
consoleWrite("");
|
|
}
|
|
|
|
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 playback is paused by an interruption, and that ending the interruption does automatically resume playback.</p>
|
|
</body>
|
|
</html>
|