"use client"; import { CrosshairIcon, SquareIcon } from "lucide-react"; import { ControlButton, usePlayer } from "./PlayerProvider"; import { LocalFilePicker } from "./LocalFilePicker"; import { LocalClipPanel } from "./LocalClipPanel"; import { formatOffset } from "../lib/localFileClock"; // THE VISITOR'S OWN COPY, IN THE MODAL (lane missing-source, slice 2). // - No copy, source still public: the plain "Play your own copy" control and // its one-sentence promise. (A source no longer public has the same control // in the player slot's panel, so nothing shows here.) // - A copy playing: its name, the offset, the four nudges, "This line is // playing now" (the next cue click sets the offset) and Stop, which gives // the focus back to the "Play your own copy" control in its place; and // "Clip my copy" (LocalClipPanel), which cuts the marked clip from it. // // Nothing in this file may reach the network or storage (the offset is written // by the provider through lib/localFileClock.ts); LocalFilePicker.test.ts // reads this source too. const NUDGES: ReadonlyArray<{ delta: number; label: string; title: string }> = [ { delta: -1, label: "−1 s", title: "Offset −1 second" }, { delta: -0.1, label: "−0.1 s", title: "Offset −0.1 second" }, { delta: 0.1, label: "+0.1 s", title: "Offset +0.1 second" }, { delta: 1, label: "+1 s", title: "Offset +1 second" }, ]; // ControlButton shows `icon ?? char` before its label; a nudge's label is its // whole face. const NO_ICON = ; export function LocalFileBar() { const { data, sourceGone, sourceStatePending, localFile, localSyncArmed, openLocalFile, stopLocalFile, takeLocalPickerFocus, nudgeLocalOffset, armLocalSync, } = usePlayer(); if (!localFile) { // Not before the record and its fresh state are here (the state decides // where the control goes), and not for a source no longer public: the // panel holds it. if (!data || sourceStatePending || sourceGone) return null; return (
Click the line you hear now (Esc cancels).
)} {localFile.error && (This browser cannot play that file.
)}