| <script src="../../../../resources/js-test-pre.js"></script> |
| <script src="../../resources/media-controls-loader.js" type="text/javascript"></script> |
| <script src="../../resources/media-controls-utils.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" autoplay controls></video> |
| <div id="host"></div> |
| <script type="text/javascript"> |
| |
| window.jsTestIsAsync = true; |
| |
| description("Testing the <code>PlacardSupport</code> behavior when entering picture-in-picture."); |
| |
| const container = document.querySelector("div#host"); |
| const media = document.querySelector("video"); |
| const mediaController = createControls(container, media, null); |
| |
| media.addEventListener("webkitpresentationmodechanged", () => { |
| if (media.webkitPresentationMode == "picture-in-picture") { |
| shouldBeTrue("mediaController.controls.showsPlacard"); |
| shouldBeTrue("mediaController.controls.children.includes(mediaController.controls.pipPlacard)"); |
| media.webkitSetPresentationMode("inline"); |
| } else { |
| shouldBeFalse("mediaController.controls.showsPlacard"); |
| shouldBeFalse("mediaController.controls.children.includes(mediaController.controls.pipPlacard)"); |
| container.remove(); |
| media.remove(); |
| finishMediaControlsTest(); |
| } |
| }); |
| |
| scheduler.frameDidFire = function() { |
| if (media.paused) |
| return; |
| |
| if (pressOnElement(mediaController.controls.pipButton.element)) |
| scheduler.frameDidFire = null; |
| }; |
| |
| </script> |
| <script src="../../../../resources/js-test-post.js"></script> |
| </body> |