feat: auto-hide player controls in fullscreen
This commit is contained in:
@@ -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) => {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user