blob: 59f12740945f0d5123128a1609b3bc4e919bc633 [file] [log] [blame]
<script src="../../../resources/js-test-pre.js"></script>
<script src="../resources/media-controls-loader.js" type="text/javascript"></script>
<body>
<video src="../../content/test.mp4" style="width: 320px; height: 240px;" controls></video>
<div id="shadow"></div>
<script type="text/javascript">
window.jsTestIsAsync = true;
description("Testing the <code>PlaybackSupport</code> behavior by using the media API.");
const shadowRoot = document.querySelector("div#shadow").attachShadow({ mode: "open" });
const media = document.querySelector("video");
const mediaController = createControls(shadowRoot, media, null);
shouldBeFalse("mediaController.controls.playPauseButton.playing");
media.addEventListener("play", function() {
debug("");
debug("Media is playing");
shouldBeTrue("mediaController.controls.playPauseButton.playing");
media.pause();
});
media.addEventListener("pause", function() {
debug("");
debug("Media is paused");
shouldBeFalse("mediaController.controls.playPauseButton.playing");
debug("");
shadowRoot.host.remove();
media.remove();
finishJSTest();
});
media.play().catch(function(){});
</script>
<script src="../../../resources/js-test-post.js"></script>
</body>