import { useCallback, useEffect, useRef, useState } from "react"; import { fileUrl, listSubtitles, openExternal, resolveStream, savePlayback } from "../api"; import type { FeedItem } from "../types"; import { compactViews, relativeTime } from "./format"; import PlayerControls from "./PlayerControls"; import { BTN, Spinner } from "./ui"; interface Props { item: FeedItem; /** Local file when downloaded; null means resolve and stream it instead. */ path: string | null; onClose: () => void; onDelete: () => void; onPrev?: () => void; onNext?: () => void; /** Present only while streaming, so the video can be saved from here. */ onDownload?: () => void; downloading?: boolean; /** Max height for streaming, or null to let the player adapt. */ maxHeight: number | null; /** Preferred subtitle language, or "off". */ subLang: string; /** Persists a subtitle choice made from the transport bar. */ onSubLang: (l: string) => void; /** Position in the current feed, for the "3 of 180" readout. */ index: number; total: number; /** False in window fullscreen, where there are no traffic lights to clear. */ titleBarInset: boolean; } /** * Releases a