blob: 30a0829d28f87a61c872175d187261791a8c5e76 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<title>audio-playback-restriction</title>
<script src=media-file.js></script>
<script src=video-test.js></script>
<script>
function runTest()
{
video = document.getElementsByTagName('audio')[0];
if (window.internals)
run('internals.setMediaElementRestrictions(video, "RequireUserGestureForAudioRateChange")');
waitForEventAndFail('error');
waitForEvent('canplaythrough', canplaythrough);
run("video.src = findMediaFile('audio', 'content/test')");
}
function canplaythrough()
{
run("handlePromise(video.play())");
testExpected('video.paused', true);
runWithKeyDown(playWithKeyDown);
}
function playWithKeyDown()
{
consoleWrite('Running with keyDown.');
run("video.play()");
testExpected('video.paused', false);
endTest();
}
</script>
</head>
<body onload="runTest()">
<p>Test that, when RequireUserGestureForAudioRateChange is set, starting playback of an audio file requires a user gesture.</p>
<audio controls autoplay></audio>
</body>
</html>