import { RefObject } from "react"; import type { CurrentBroadcastResponse } from "@/lib/types"; import { VideoPlayer } from "./video-player"; import { NoSignal } from "./no-signal"; import { calcOffsetSecs } from "@/hooks/use-tv"; import type { SubtitleTrack } from "./video-player"; interface TvBaseLayerProps { isLoadingChannels: boolean; hasChannels: boolean; broadcastError: unknown; isLoadingBroadcast: boolean; hasBroadcast: boolean; streamUrlError: unknown; streamError: boolean; videoEnded: boolean; streamUrl?: string | null; broadcast?: CurrentBroadcastResponse | null; activeSubtitleTrack: number; isMuted: boolean; showStats: boolean; videoRef: RefObject; onSubtitleTracksChange: (tracks: SubtitleTrack[]) => void; onStreamError: () => void; onEnded: () => void; onNeedsInteraction: () => void; onRetry: () => void; } export function TvBaseLayer({ isLoadingChannels, hasChannels, broadcastError, isLoadingBroadcast, hasBroadcast, streamUrlError, streamError, videoEnded, streamUrl, broadcast, activeSubtitleTrack, isMuted, showStats, videoRef, onSubtitleTracksChange, onStreamError, onEnded, onNeedsInteraction, onRetry, }: TvBaseLayerProps) { if (isLoadingChannels) { return ; } if (!hasChannels) { return ( ); } const broadcastErrMsg = (broadcastError as Error)?.message; if (broadcastErrMsg === "auth_required") { return ( ); } if ( broadcastErrMsg && broadcastError && (broadcastError as { status?: number }).status === 403 ) { return ( ); } if (isLoadingBroadcast) { return ; } if (!hasBroadcast) { return ( ); } const streamErrMsg = (streamUrlError as Error)?.message; if (streamErrMsg === "auth_required") { return ( ); } if ( streamUrlError && (streamUrlError as { status?: number }).status === 403 ) { return ; } if (streamError) { return ( ); } if (videoEnded) { return ; } if (streamUrl) { return ( ); } return ; }