Fix Fullscreen function and the ShowFullscreen option
This commit is contained in:
parent
17b8a60284
commit
112fda8612
|
@ -5,6 +5,8 @@ const {
|
|||
ShowBackAndForward,
|
||||
ShowFullscreen
|
||||
} = Astro.props
|
||||
|
||||
console.log('Controller: ' + ShowFullscreen)
|
||||
---
|
||||
|
||||
<script define:vars={{PlayerName, BigPlayButton, ShowBackAndForward, ShowFullscreen}}>
|
||||
|
@ -61,10 +63,9 @@ function Buffering() {
|
|||
|
||||
// Fullscreen
|
||||
function Fullscreen() {
|
||||
console.log('Hey')
|
||||
// Get Button
|
||||
if (ShowFullscreen === true) {
|
||||
var Button_Fullscreen = document.querySelector("#zorn-player-" + PlayerName + " #vc-fullscreen");
|
||||
}
|
||||
|
||||
// Create and Call Functions
|
||||
function Toggle_Fullscreen() {
|
||||
|
@ -84,19 +85,19 @@ function Fullscreen() {
|
|||
EnterFullscreen();
|
||||
VideoContainer.requestFullscreen()
|
||||
}
|
||||
if (ShowFullscreen === true) {Update_FullscreenButton()}
|
||||
Update_FullscreenButton()
|
||||
}
|
||||
function EnterFullscreen() {
|
||||
VideoContainer.classList.add('zorn-fullscreen');
|
||||
if (ShowFullscreen === true) {Update_FullscreenButton()}
|
||||
Update_FullscreenButton()
|
||||
}
|
||||
function ExitFullscreen() {
|
||||
VideoContainer.classList.remove('zorn-fullscreen');
|
||||
if (ShowFullscreen === true) {Update_FullscreenButton()}
|
||||
Update_FullscreenButton()
|
||||
}
|
||||
|
||||
// Event Listener
|
||||
if (ShowFullscreen === true) {Button_Fullscreen.onclick = Toggle_Fullscreen;}
|
||||
Button_Fullscreen.onclick = Toggle_Fullscreen;
|
||||
function Update_FullscreenButton() {
|
||||
if (document.fullscreenElement) {
|
||||
Button_Fullscreen.setAttribute("data-title", "Exit full screen (f)");
|
||||
|
@ -110,7 +111,7 @@ function Fullscreen() {
|
|||
// Gesture
|
||||
Player.addEventListener("dblclick", () => {
|
||||
Toggle_Fullscreen()
|
||||
if (ShowFullscreen === true) {Update_FullscreenButton()}
|
||||
Update_FullscreenButton()
|
||||
});
|
||||
|
||||
// Keyboard Shortcut
|
||||
|
@ -352,7 +353,7 @@ function PlayAgain() {
|
|||
// Init Functions
|
||||
AutoToggleControls()
|
||||
Buffering()
|
||||
Fullscreen()
|
||||
if (ShowFullscreen === true) {Fullscreen()}
|
||||
Gestures()
|
||||
KeyboardShortcuts()
|
||||
PlayPause()
|
||||
|
|
|
@ -17,7 +17,7 @@ const {
|
|||
ShowBackAndForward,
|
||||
ShowPlaybackRate,
|
||||
ShowPiP,
|
||||
ShowFullscreen,
|
||||
ShowFullscreen = true,
|
||||
BigPlayButton = false,
|
||||
|
||||
YouTube = false,
|
||||
|
@ -106,7 +106,7 @@ import './Styles/Iconoir.css'
|
|||
:
|
||||
null
|
||||
}
|
||||
<Controller PlayerName={PlayerName} BigPlayButton={BigPlayButton} ShowBackAndForward={ShowBackAndForward}/>
|
||||
<Controller PlayerName={PlayerName} BigPlayButton={BigPlayButton} ShowBackAndForward={ShowBackAndForward} ShowFullscreen={ShowFullscreen}/>
|
||||
<Seek PlayerName={PlayerName}/>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in a new issue