blob: 2790f59be76f1b9135b64c232f40cce20d20c0a6 [file] [log] [blame]
<script src="../../../resources/js-test-pre.js"></script>
<script src="../resources/media-controls-loader.js" type="text/javascript"></script>
<body>
<style type="text/css" media="screen">
video, #host {
position: absolute;
top: 0;
left: 0;
}
video {
width: 800px;
height: 240px;
}
</style>
<video src="../../content/test.mp4" controls autoplay></video>
<div id="host"></div>
<script type="text/javascript">
window.jsTestIsAsync = true;
description("Testing the <code>PipSupport</code> behavior.");
if (window.internals)
window.internals.settings.setAllowsPictureInPictureMediaPlayback(true);
const container = document.querySelector("div#host");
const media = document.querySelector("video");
const mediaController = createControls(container, media, null);
media.addEventListener("loadedmetadata", () => {
shouldBeTrue("mediaController.controls.pipButton.enabled");
media.src = "";
});
media.addEventListener("error", () => {
shouldBeFalse("mediaController.controls.pipButton.enabled");
debug("");
container.remove();
media.remove();
finishJSTest();
});
</script>
<script src="../../../resources/js-test-post.js"></script>
</body>