import { useCallback, useMemo, useState } from "react"; import { useTranslation } from "react-i18next"; import { useQueryClient } from "@tanstack/react-query"; import Modal from "./ui/Modal"; import { api, type DownloadJob } from "../lib/api"; import { qk } from "../lib/queryKeys"; import { jobTitle } from "./downloadTitle"; import { exposeVideoToBackgroundPlay } from "../lib/browserBackgroundPlay"; import { useMediaLogRef } from "../lib/mediaLog"; import { useMediaSession } from "../lib/mediaSession"; import { useMediaKeys } from "../lib/mediaKeys"; import { keptPosition, useResume } from "../lib/resume"; import RemoteImage from "./ui/RemoteImage"; // In-app player for a completed library item. We do NOT reuse PlayerModal (a cross-origin // YouTube IFrame shell) or PlexPlayer (a Plex HLS/session shell): both are bound to their own domain // APIs and can't point at a local file. Instead we reuse the shared a11y shell (`Modal`: focus-trap, // ESC/back-to-close, scroll-lock, layer-stack, portal) and stream the local file into a NATIVE //