fix: hide cursor during fullscreen playback

This commit is contained in:
kuekhaoyang
2026-07-08 22:12:34 +08:00
parent f2667d42de
commit dedf496761
4 changed files with 82 additions and 1 deletions
+9
View File
@@ -13,6 +13,7 @@ import { Icons } from '@/components/ui/Icon';
import type { M3UChannel } from '@/lib/utils/m3u-parser';
import type { IPTVSource } from '@/lib/store/iptv-store';
import { settingsStore, DEFAULT_SEEK_STEP_SECONDS } from '@/lib/store/settings-store';
import { shouldHidePlayerCursor } from '@/lib/player/cursor-visibility';
const HLS_LIVE_CONFIG: Partial<Hls['config']> = {
enableWorker: true,
@@ -495,6 +496,13 @@ export function IPTVPlayer({ channel, onClose, channels, onChannelChange, channe
return Math.max(0, Math.min(100, (currentTime / duration) * 100));
}, [currentTime, duration, seekWindow]);
const shouldHideCursor = shouldHidePlayerCursor({
isFullscreen,
isPlaying,
showControls,
hasInteractiveOverlay: showSidebar || showVolumeSlider || Boolean(error),
});
const toggleFullscreen = async () => {
if (!containerRef.current) return;
if (document.fullscreenElement) {
@@ -781,6 +789,7 @@ export function IPTVPlayer({ channel, onClose, channels, onChannelChange, channe
<div
ref={containerRef}
className="fixed inset-0 z-[9999] bg-black flex"
style={{ cursor: shouldHideCursor ? 'none' : undefined }}
onMouseMove={resetControlsTimeout}
onClick={(e) => {
if ((e.target as HTMLElement).closest('[data-controls]') || (e.target as HTMLElement).closest('[data-sidebar]')) return;