38 lines
1.1 KiB
HTML
38 lines
1.1 KiB
HTML
<html>
|
|
<head>
|
|
<script src=media-file.js></script>
|
|
<script src=video-test.js></script>
|
|
<script>
|
|
window.addEventListener('load', async event => {
|
|
if (!window.internals) {
|
|
failTest('This test requires window.internals.');
|
|
return;
|
|
}
|
|
|
|
findMediaElement();
|
|
|
|
run('internals.setMediaElementRestrictions(video, "RequirePageVisibilityToPlayAudio")');
|
|
run('video.src = findMediaFile("video", "content/test")');
|
|
await waitFor(video, 'canplaythrough');
|
|
|
|
run('internals.setPageVisibility(false)');
|
|
run('promise = video.play()');
|
|
await shouldReject(promise);
|
|
|
|
run('internals.setPageVisibility(true)');
|
|
run('promise = video.play()');
|
|
await shouldResolve(promise);
|
|
|
|
run('internals.setPageVisibility(false)');
|
|
await waitFor(video, 'pause');
|
|
|
|
endTest();
|
|
});
|
|
</script>
|
|
</head>
|
|
|
|
<body>
|
|
<video controls loop></video>
|
|
</body>
|
|
</html>
|