import { useEffect, useRef, useState } from "react"; import { Download, Link2, Lock, PlayCircle } from "lucide-react"; // Standalone, login-free video page for a shared /watch/ link. Rendered OUTSIDE the app // tree (no auth, no providers) — like the /privacy and /terms pages. Uses plain fetch and a tiny // self-contained i18n dict (the public viewer has no app language preference). // Advertise the playing video to the OS via the Media Session API: lock-screen / control-center // metadata + play/pause handlers. This is also what lets a browser's own "background playback" // feature keep the audio going when the page is backgrounded — it's exactly how youtube.com stays // playing in the background on Brave iOS. We deliberately do NOT route the audio through the Web // Audio API: `createMediaElementSource` pulls the element out of the normal media pipeline that the // background feature (and iOS) hooks into, and iOS then suspends the AudioContext on background — // which STOPPED playback instead of keeping it alive (measured on iPad Brave). A plain