blob: 59dcdf626bafcf373411f32c526bb0f9d7c57e1e [file] [log] [blame]
<html>
<head>
<script src=media-file.js></script>
<script src=video-test.js></script>
<script>
var playCount = 0;
var playThroughCount = 0;
var videos = [];
function logEvent(evt)
{
consoleWrite("EVENT(" + evt.type + ")");
}
function playing(evt)
{
logEvent(evt);
consoleWrite("");
switch (++playCount)
{
case 1:
consoleWrite("** Starting the second video, the first one should pause.");
run("videos[1].play()");
setTimeout(endTest, 100);
break;
case 2:
testExpected("videos[0].paused", true);
testExpected("videos[1].paused", false);
consoleWrite("");
endTest();
break;
}
}
function canplaythrough(evt)
{
logEvent(evt);
if (++playThroughCount < 2)
return;
consoleWrite("<br>** Play first video...");
run("videos[0].play()");
}
function start()
{
if (!window.internals) {
failTest('This test requires window.internals.');
return;
}
videos = document.getElementsByTagName('video');
for (var i = 0; i < videos.length; ++i) {
video = videos[i];
video.addEventListener("canplaythrough", canplaythrough);
video.addEventListener('playing', playing);
video.src = findMediaFile("video", "content/test");
}
run("internals.setMediaSessionRestrictions('videoaudio', 'ConcurrentPlaybackNotPermitted')");
consoleWrite("");
}
</script>
</head>
<body onload="start()">
<video controls id="one"></video>
<video controls id="two"></video>
<p>Test play() when concurrent playback not allowed.</p>
</body>
</html>