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 + }; + } + }); }) })