feat: auto-hide player controls in fullscreen

This commit is contained in:
2026-05-08 09:45:57 +02:00
parent 334b05c6e0
commit af38636759
3 changed files with 25 additions and 1 deletions

View File

@@ -118,6 +118,7 @@ const initPlayer = (): void => {
let completionSent = false
let completionAttempts = 0
let playerControlsTimeout: number | undefined
let isFullscreen = false
let isScrubbing = false
let lastKnownVolume = 1
let pendingSeekTime: number | null = null
@@ -1310,6 +1311,12 @@ const initPlayer = (): void => {
updateSkipButton(video.currentTime)
})
document.addEventListener('fullscreenchange', () => {
isFullscreen = !!document.fullscreenElement
container.classList.toggle('fullscreen', isFullscreen)
if (isFullscreen) showControls()
})
container.addEventListener('mousemove', showControls)
document.addEventListener('keydown', (event) => {

View File

@@ -113,3 +113,20 @@ body {
scrollbar-color: rgba(255, 255, 255, 0.2) rgba(255, 255, 255, 0.05);
}
}
.show-controls [data-video-overlay] {
opacity: 1;
}
[data-video-player].fullscreen:not(.show-controls) [data-video-overlay] {
opacity: 0 !important;
pointer-events: none;
}
[data-video-player].fullscreen:not(.show-controls) {
cursor: none;
}
[data-video-player].fullscreen:not(.show-controls) video {
cursor: none;
}