diff --git a/src/components/ControlsLayer.tsx b/src/components/ControlsLayer.tsx index b0e8fd6..965bb6c 100644 --- a/src/components/ControlsLayer.tsx +++ b/src/components/ControlsLayer.tsx @@ -32,8 +32,8 @@ export const ControlsLayer: React.FC = ({ usePlayerContext() const [isPointerOver, setIsPointerOver] = useState(false) const [lastInteraction, setLastInteraction] = useState(0) - const hideTimeoutRef = useRef() - const containerRef = useRef(null) + const hideTimeoutRef = useRef(undefined) + const containerRef = useRef(null) const lastClickTimeRef = useRef(0) const isMenuOpen = uiState.settingsOpen || diff --git a/src/components/controls/VolumeControl.tsx b/src/components/controls/VolumeControl.tsx index ca90ef4..fbe3f3b 100644 --- a/src/components/controls/VolumeControl.tsx +++ b/src/components/controls/VolumeControl.tsx @@ -6,7 +6,7 @@ import './VolumeControl.css' export const VolumeControl: React.FC = () => { const { videoState, setVolume, toggleMute } = usePlayerContext() const [showSlider, setShowSlider] = useState(false) - const timeoutRef = useRef() + const timeoutRef = useRef(undefined) const handleMouseEnter = useCallback(() => { if (timeoutRef.current) { diff --git a/src/contexts/PlayerContext.tsx b/src/contexts/PlayerContext.tsx index aca9cb3..bdd6cec 100644 --- a/src/contexts/PlayerContext.tsx +++ b/src/contexts/PlayerContext.tsx @@ -33,8 +33,8 @@ export const PlayerProvider: React.FC = ({ initialMuted = false, initialPlaybackRate = 1, }) => { - const videoRef = useRef(null) - const containerRef = useRef(null) + const videoRef = useRef(null) + const containerRef = useRef(null) const [videoState, setVideoState] = useState({ playing: false, diff --git a/src/hooks/useTouchGestures.ts b/src/hooks/useTouchGestures.ts index 016d59a..0735b85 100644 --- a/src/hooks/useTouchGestures.ts +++ b/src/hooks/useTouchGestures.ts @@ -1,4 +1,4 @@ -import { useEffect, RefObject } from 'react' +import { useEffect, MutableRefObject } from 'react' import { usePlayerContext } from '../contexts/PlayerContext' interface TouchData { @@ -9,7 +9,7 @@ interface TouchData { tapCount: number } -export const useTouchGestures = (containerRef: RefObject) => { +export const useTouchGestures = (containerRef: MutableRefObject) => { const { videoState, togglePlay, seek, setVolume } = usePlayerContext() useEffect(() => { diff --git a/src/types/index.ts b/src/types/index.ts index e2d6170..395eff7 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -1,4 +1,4 @@ -import type { CSSProperties, RefObject } from 'react' +import type { CSSProperties, MutableRefObject } from 'react' export interface SubtitleTrack { src: string @@ -87,8 +87,8 @@ export interface PlayerContextValue { videoState: VideoState uiState: UIState settings: PlayerSettings - videoRef: RefObject - containerRef: RefObject + videoRef: MutableRefObject + containerRef: MutableRefObject // Video controls play: () => void @@ -109,7 +109,7 @@ export interface PlayerContextValue { toggleSettings: () => void // Settings - setQuality: (quality: VideoQuality) => void + setQuality: (quality: VideoQuality | null) => void setSubtitle: (subtitle: SubtitleTrack | null) => void setAudioTrack: (audioTrack: AudioTrack | null) => void } diff --git a/src/utils/hlsLoader.ts b/src/utils/hlsLoader.ts index 7ae93ef..32ca3d0 100644 --- a/src/utils/hlsLoader.ts +++ b/src/utils/hlsLoader.ts @@ -46,12 +46,12 @@ export const loadHls = async (): Promise => { // Try loading from npm package first const hlsModule = await import('hls.js') return hlsModule.default - } catch (npmError) { + } catch { try { // Fallback to CDN const Hls = await loadHlsFromCDN() return Hls - } catch (cdnError) { + } catch { throw new Error('Unable to load HLS.js library. HLS streaming is not available.') } } @@ -99,7 +99,7 @@ export const getHlsAudioTracks = (hls: any): AudioTrack[] => { }) return audioTracks - } catch (error) { + } catch { return [] } }