|
|
|
@ -1,4 +1,10 @@
|
|
|
|
|
<script is:inline>
|
|
|
|
|
---
|
|
|
|
|
const {
|
|
|
|
|
PlayerName
|
|
|
|
|
} = Astro.props
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
<script define:vars={{PlayerName}}>
|
|
|
|
|
/**
|
|
|
|
|
* @licstart The following is the entire license notice for the
|
|
|
|
|
* JavaScript code in this page.
|
|
|
|
@ -24,9 +30,9 @@
|
|
|
|
|
* for the JavaScript code in this page.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
var VideoContainer = document.querySelector('.video-container')
|
|
|
|
|
var VideoControls = document.querySelector('.video-controls')
|
|
|
|
|
var Player = document.querySelector('video')
|
|
|
|
|
var VideoContainer = document.querySelector('#zorn-player-' + PlayerName)
|
|
|
|
|
var VideoControls = document.querySelector('#zorn-player-' + PlayerName + ' .video-controls')
|
|
|
|
|
var Player = document.querySelector('#zorn-player-' + PlayerName + ' video')
|
|
|
|
|
|
|
|
|
|
// Icons
|
|
|
|
|
var play_solid_default = '<?xml version="1.0" encoding="UTF-8"?><svg width="24px" height="24px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" color="#ffffff" stroke-width="1.5"><path d="M6.90588 4.53682C6.50592 4.2998 6 4.58808 6 5.05299V18.947C6 19.4119 6.50592 19.7002 6.90588 19.4632L18.629 12.5162C19.0211 12.2838 19.0211 11.7162 18.629 11.4838L6.90588 4.53682Z" fill="#ffffff" stroke="#ffffff" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path></svg>';
|
|
|
|
@ -41,35 +47,35 @@ var ExitFullscreenIcon = exit_fullscreen_solid_default
|
|
|
|
|
|
|
|
|
|
// Fullscreen
|
|
|
|
|
function Fullscreen() {
|
|
|
|
|
const Button_Fullscreen = document.getElementById("vc-fullscreen");
|
|
|
|
|
const Button_Fullscreen = document.querySelector("#zorn-player-" + PlayerName + " #vc-fullscreen");
|
|
|
|
|
function Toggle_Fullscreen() {
|
|
|
|
|
if (document.fullscreenElement) {
|
|
|
|
|
document.querySelector('.vc-top').style.opacity = '0'
|
|
|
|
|
document.querySelector('.video-controls').style.background = 'linear-gradient(0deg, rgba(0,0,0,0.7523460067620799) 0%, rgba(0,0,0,0) 15%, rgba(0,0,0,0) 94%, rgba(0,0,0,0) 100%)'
|
|
|
|
|
document.querySelector('.video-container .video-controls, .video-container video').style.borderRadius = '12px'
|
|
|
|
|
document.querySelector('.video-container .video-controls').style.bottom = '4px'
|
|
|
|
|
document.querySelector('.video-container .video-controls').style.height = 'calc(100% - 28px)'
|
|
|
|
|
document.querySelector('#zorn-player-' + PlayerName + ' .vc-top').style.opacity = '0'
|
|
|
|
|
document.querySelector('#zorn-player-' + PlayerName + ' .video-controls').style.background = 'linear-gradient(0deg, rgba(0,0,0,0.7523460067620799) 0%, rgba(0,0,0,0) 15%, rgba(0,0,0,0) 94%, rgba(0,0,0,0) 100%)'
|
|
|
|
|
document.querySelector('#zorn-player-' + PlayerName + ' .video-container .video-controls, .video-container video').style.borderRadius = '12px'
|
|
|
|
|
document.querySelector('#zorn-player-' + PlayerName + ' .video-container .video-controls').style.bottom = '4px'
|
|
|
|
|
document.querySelector('#zorn-player-' + PlayerName + ' .video-container .video-controls').style.height = 'calc(100% - 28px)'
|
|
|
|
|
document.exitFullscreen();
|
|
|
|
|
} else if (document.webkitFullscreenElement) {
|
|
|
|
|
document.querySelector('.vc-top').style.opacity = '0'
|
|
|
|
|
document.querySelector('.video-controls').style.background = 'linear-gradient(0deg, rgba(0,0,0,0.7523460067620799) 0%, rgba(0,0,0,0) 15%, rgba(0,0,0,0) 94%, rgba(0,0,0,0) 100%)'
|
|
|
|
|
document.querySelector('.video-container .video-controls, .video-container video').style.borderRadius = '12px'
|
|
|
|
|
document.querySelector('.video-container .video-controls').style.bottom = '4px'
|
|
|
|
|
document.querySelector('.video-container .video-controls').style.height = 'calc(100% - 28px)'
|
|
|
|
|
document.querySelector('#zorn-player-' + PlayerName + ' .vc-top').style.opacity = '0'
|
|
|
|
|
document.querySelector('#zorn-player-' + PlayerName + ' .video-controls').style.background = 'linear-gradient(0deg, rgba(0,0,0,0.7523460067620799) 0%, rgba(0,0,0,0) 15%, rgba(0,0,0,0) 94%, rgba(0,0,0,0) 100%)'
|
|
|
|
|
document.querySelector('#zorn-player-' + PlayerName + ' .video-container .video-controls, .video-container video').style.borderRadius = '12px'
|
|
|
|
|
document.querySelector('#zorn-player-' + PlayerName + ' .video-container .video-controls').style.bottom = '4px'
|
|
|
|
|
document.querySelector('#zorn-player-' + PlayerName + ' .video-container .video-controls').style.height = 'calc(100% - 28px)'
|
|
|
|
|
document.webkitExitFullscreen();
|
|
|
|
|
} else if (VideoContainer.webkitRequestFullscreen) {
|
|
|
|
|
document.querySelector('.vc-top').style.opacity = '1'
|
|
|
|
|
document.querySelector('.video-controls').style.background = 'linear-gradient(0deg, rgba(0, 0, 0, 0.753) 0%, rgba(0, 0, 0, 0) 15%, rgba(0, 0, 0, 0) 91%, rgba(0, 0, 0, 1) 100%)'
|
|
|
|
|
document.querySelector('.video-container .video-controls, .video-container video').style.borderRadius = '0'
|
|
|
|
|
document.querySelector('.video-container .video-controls').style.bottom = '0px'
|
|
|
|
|
document.querySelector('.video-container .video-controls').style.height = '100%'
|
|
|
|
|
document.querySelector('#zorn-player-' + PlayerName + ' .vc-top').style.opacity = '1'
|
|
|
|
|
document.querySelector('#zorn-player-' + PlayerName + ' .video-controls').style.background = 'linear-gradient(0deg, rgba(0, 0, 0, 0.753) 0%, rgba(0, 0, 0, 0) 15%, rgba(0, 0, 0, 0) 91%, rgba(0, 0, 0, 1) 100%)'
|
|
|
|
|
document.querySelector('#zorn-player-' + PlayerName + ' .video-container .video-controls, .video-container video').style.borderRadius = '0'
|
|
|
|
|
document.querySelector('#zorn-player-' + PlayerName + ' .video-container .video-controls').style.bottom = '0px'
|
|
|
|
|
document.querySelector('#zorn-player-' + PlayerName + ' .video-container .video-controls').style.height = '100%'
|
|
|
|
|
VideoContainer.webkitRequestFullscreen();
|
|
|
|
|
} else {
|
|
|
|
|
document.querySelector('.vc-top').style.opacity = '1'
|
|
|
|
|
document.querySelector('.video-controls').style.background = 'linear-gradient(0deg, rgba(0, 0, 0, 0.753) 0%, rgba(0, 0, 0, 0) 15%, rgba(0, 0, 0, 0) 91%, rgba(0, 0, 0, 1) 100%)'
|
|
|
|
|
document.querySelector('.video-container .video-controls, .video-container video').style.borderRadius = '0'
|
|
|
|
|
document.querySelector('.video-container .video-controls').style.bottom = '0px'
|
|
|
|
|
document.querySelector('.video-container .video-controls').style.height = '100%'
|
|
|
|
|
document.querySelector('#zorn-player-' + PlayerName + ' .vc-top').style.opacity = '1'
|
|
|
|
|
document.querySelector('#zorn-player-' + PlayerName + ' .video-controls').style.background = 'linear-gradient(0deg, rgba(0, 0, 0, 0.753) 0%, rgba(0, 0, 0, 0) 15%, rgba(0, 0, 0, 0) 91%, rgba(0, 0, 0, 1) 100%)'
|
|
|
|
|
document.querySelector('#zorn-player-' + PlayerName + ' .video-container .video-controls, .video-container video').style.borderRadius = '0'
|
|
|
|
|
document.querySelector('#zorn-player-' + PlayerName + ' .video-container .video-controls').style.bottom = '0px'
|
|
|
|
|
document.querySelector('#zorn-player-' + PlayerName + ' .video-container .video-controls').style.height = '100%'
|
|
|
|
|
VideoContainer.requestFullscreen();
|
|
|
|
|
}
|
|
|
|
|
Update_FullscreenButton()
|
|
|
|
@ -90,20 +96,9 @@ function Fullscreen() {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function Update_PlayPauseButton() {
|
|
|
|
|
if (Player.paused) {
|
|
|
|
|
Button_PlayPause.setAttribute("data-title", "Play (K)");
|
|
|
|
|
Button_PlayPause.innerHTML = `${PlayIcon}`;
|
|
|
|
|
} else {
|
|
|
|
|
Button_PlayPause.setAttribute("data-title", "Pause (K)");
|
|
|
|
|
Button_PlayPause.innerHTML = `${PauseIcon}`;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Play/Pause
|
|
|
|
|
function PlayPause() {
|
|
|
|
|
const Button_PlayPause = document.querySelector(".video-controls #vc-playpause");
|
|
|
|
|
const Button_PlayPause = document.querySelector("#zorn-player-" + PlayerName + " .video-controls #vc-playpause");
|
|
|
|
|
Button_PlayPause.addEventListener("click", Toggle_PlayPause);
|
|
|
|
|
Player.addEventListener("click", Toggle_PlayPause);
|
|
|
|
|
Player.addEventListener("play", Update_PlayPauseButton);
|
|
|
|
@ -128,8 +123,8 @@ function PlayPause() {
|
|
|
|
|
|
|
|
|
|
// Skip Around
|
|
|
|
|
function SkipAround() {
|
|
|
|
|
const Button_SkipBack = document.querySelector(".video-controls #vc-backwards");
|
|
|
|
|
const Button_SkipForth = document.querySelector(".video-controls #vc-forwards");
|
|
|
|
|
const Button_SkipBack = document.querySelector("#zorn-player-" + PlayerName + " .video-controls #vc-backwards");
|
|
|
|
|
const Button_SkipForth = document.querySelector("#zorn-player-" + PlayerName + " .video-controls #vc-forwards");
|
|
|
|
|
Button_SkipBack.addEventListener("click", Toggle_SkipBack);
|
|
|
|
|
Button_SkipForth.addEventListener("click", Toggle_SkipForth);
|
|
|
|
|
function Toggle_SkipBack() {
|
|
|
|
@ -149,11 +144,11 @@ function AutoToggleControls() {
|
|
|
|
|
if (Player.paused) {
|
|
|
|
|
return;
|
|
|
|
|
} else {
|
|
|
|
|
document.querySelector(".video-controls").classList.add("hide");
|
|
|
|
|
document.querySelector("#zorn-player-" + PlayerName + " .video-controls").classList.add("hide");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function Show_Controls2() {
|
|
|
|
|
document.querySelector(".video-controls").classList.remove("hide");
|
|
|
|
|
document.querySelector("#zorn-player-" + PlayerName + " .video-controls").classList.remove("hide");
|
|
|
|
|
}
|
|
|
|
|
VideoControls.addEventListener("mouseenter", Show_Controls2);
|
|
|
|
|
VideoControls.addEventListener("mouseleave", Hide_Controls2);
|
|
|
|
@ -249,21 +244,21 @@ function KeyboardShortcuts(events) {
|
|
|
|
|
// If Media Ends, fade main controls and show a "Replay" button
|
|
|
|
|
function PlayAgain() {
|
|
|
|
|
Player.onended = (event) => {
|
|
|
|
|
document.querySelector('.vc-start').style.opacity = '0'
|
|
|
|
|
document.querySelector('.vc-start').style.pointerEvents = 'none'
|
|
|
|
|
document.querySelector('.vc-center').style.opacity = '0'
|
|
|
|
|
document.querySelector('.vc-center').style.pointerEvents = 'none'
|
|
|
|
|
document.querySelector('#vc-playagain').style.display = 'inherit'
|
|
|
|
|
document.querySelector("#zorn-player-" + PlayerName + " .vc-start").style.opacity = '0'
|
|
|
|
|
document.querySelector("#zorn-player-" + PlayerName + " .vc-start").style.pointerEvents = 'none'
|
|
|
|
|
document.querySelector("#zorn-player-" + PlayerName + " .vc-center").style.opacity = '0'
|
|
|
|
|
document.querySelector("#zorn-player-" + PlayerName + " .vc-center").style.pointerEvents = 'none'
|
|
|
|
|
document.querySelector("#zorn-player-" + PlayerName + " #vc-playagain").style.display = 'inherit'
|
|
|
|
|
}
|
|
|
|
|
document.querySelector('#vc-playagain').onclick = PlayItAgain
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function PlayItAgain() {
|
|
|
|
|
document.querySelector('.vc-start').style.opacity = '1'
|
|
|
|
|
document.querySelector('.vc-start').style.pointerEvents = 'all'
|
|
|
|
|
document.querySelector('.vc-center').style.opacity = '1'
|
|
|
|
|
document.querySelector('.vc-center').style.pointerEvents = 'all'
|
|
|
|
|
document.querySelector('#vc-playagain').style.display = 'none'
|
|
|
|
|
document.querySelector("#zorn-player-" + PlayerName + " .vc-start").style.opacity = '1'
|
|
|
|
|
document.querySelector("#zorn-player-" + PlayerName + " .vc-start").style.pointerEvents = 'all'
|
|
|
|
|
document.querySelector("#zorn-player-" + PlayerName + " .vc-center").style.opacity = '1'
|
|
|
|
|
document.querySelector("#zorn-player-" + PlayerName + " .vc-center").style.pointerEvents = 'all'
|
|
|
|
|
document.querySelector("#zorn-player-" + PlayerName + " #vc-playagain").style.display = 'none'
|
|
|
|
|
|
|
|
|
|
Player.pause();
|
|
|
|
|
Player.currentTime = '0';
|
|
|
|
|