mirror of
https://github.com/KuekHaoYang/KVideo.git
synced 2026-08-12 23:33:43 +08:00
fix: hide cursor during fullscreen playback
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user