diff options
Diffstat (limited to 'dom/media/mediasession/test/file_media_session.html')
-rw-r--r-- | dom/media/mediasession/test/file_media_session.html | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/dom/media/mediasession/test/file_media_session.html b/dom/media/mediasession/test/file_media_session.html new file mode 100644 index 0000000000..b6680fb46b --- /dev/null +++ b/dom/media/mediasession/test/file_media_session.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<html> +<head> + <title>Media Session and non-autoplay media</title> +</head> +<body> +<video id="testVideo" src="gizmo.mp4" loop></video> +<h1 id="result"></h1> +<script type="text/javascript"> + +const MediaSessionActions = [ + "play", + "pause", + "seekbackward", + "seekforward", + "previoustrack", + "nexttrack", + "stop", +]; + +for (const action of MediaSessionActions) { + navigator.mediaSession.setActionHandler(action, () => { + // eslint-disable-next-line no-unsanitized/property + document.getElementById("result").innerHTML = action; + document.getElementById("result").dispatchEvent(new CustomEvent("actionChanged")); + }); +} + +</script> +</body> +</html> |