From 8696b9c0f6901824834a64bc016433c4c6bf6bd0 Mon Sep 17 00:00:00 2001 From: Sebastiaan de Schaetzen Date: Tue, 17 Jun 2025 09:28:53 +0200 Subject: [PATCH] Implement play button functionality for video playback in fullscreen --- static/index.html | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/static/index.html b/static/index.html index 10c0e15..8c43c04 100644 --- a/static/index.html +++ b/static/index.html @@ -100,6 +100,33 @@ // Hide loader and show videos hideLoader(); + + $("#play-button").click(function() { + if (currentVideo && currentVideo.url) { + let videoElement = $("").attr("src", currentVideo.url).appendTo("body")[0]; + if (videoElement.requestFullscreen) { + videoElement.requestFullscreen(); + } else if (videoElement.mozRequestFullScreen) { /* Firefox */ + videoElement.mozRequestFullScreen(); + } else if (videoElement.webkitRequestFullscreen) { /* Chrome, Safari & Opera */ + videoElement.webkitRequestFullscreen(); + } else if (videoElement.msRequestFullscreen) { /* IE/Edge */ + videoElement.msRequestFullscreen(); + } + videoElement.onended = function() { + if (document.exitFullscreen) { + document.exitFullscreen(); + } else if (document.mozCancelFullScreen) { /* Firefox */ + document.mozCancelFullScreen(); + } else if (document.webkitExitFullscreen) { /* Chrome, Safari and Opera */ + document.webkitExitFullscreen(); + } else if (document.msExitFullscreen) { /* IE/Edge */ + document.msExitFullscreen(); + } + $(videoElement).remove(); // Remove video element when playback ends + }; + } + }); }) })