import "./media_player.css"; import type * as React from "react"; import { useRender } from "@base-ui/react/use-render"; import { type StyleProps } from "./style_props"; /** * Why a source would not play. * * The media element's own `MediaError` is nearly useless on its own: a 401, a * 404 and a genuinely unplayable codec all surface as code 4 * (`SRC_NOT_SUPPORTED`). The STATUS is what separates "the session lapsed" from * "this file is broken", so the player resolves it before reporting. */ export interface MediaLoadFailure { /** HTTP status of the source, or null when it could not be determined. */ status: number | null; /** `MediaError.code` — 1 aborted, 2 network, 3 decode, 4 unsupported. */ code: number | null; } export interface MediaPlayerProps extends StyleProps { /** Already-served URL for the media — signing/auth is the host's problem. */ src: string; /** * Which element to render. Not inferred from the MIME type on purpose: a * screen recording carries both streams in one file, and the caller — not the * container format — decides whether this surface is showing a picture. */ kind: "audio" | "video"; /** Accessible name for the player. Required: an unlabelled one is a blank control. */ accessibilityLabel: string; /** * Called once when a source fails to load. The player already SHOWS the * failure; this is for the host to report it, because the kit carries no * analytics of its own. Omit it and no status probe is performed — the work * only happens when someone is listening. */ onError?: (failure: MediaLoadFailure) => void; testID?: string; ref?: React.Ref; render?: useRender.RenderProp; } /** * Playback surface for one audio or video source. * * Transport is the PLATFORM's, deliberately. A hand-rolled play/pause/scrub bar * would have to re-earn keyboard access, screen-reader semantics, volume, speed, * picture-in-picture, fullscreen, download and captions — all of which the * native element already does correctly, and which callers should NOT duplicate * with a control of their own. * * It FILLS its parent rather than carrying a size. A lightbox wants the video to * take the modal's height; a chat bubble wants a 16:9 box that does not resize * when metadata arrives. Those are the caller's boxes, and a `fill`/`compact` * prop to switch between them is the branching this codebase forbids — so the * caller composes the box and this draws inside it. */ export declare function MediaPlayer(props: MediaPlayerProps): React.ReactElement>;