import type { TwinStreamConnection, TwinStreamSink } from '../twin-fetch.js'; import { type Amf0Value } from './amf0.js'; /** What the session asks of its caller. */ export type RtmpPublisher = { /** `connect`: the application the publisher names, and its command object; a string refuses it, with that reason */ connect(app: string, command: Record): string | undefined; /** `publish`: whether the stream may be published, or RTMP's refusal (its code and description) */ publish(ask: { app: string; name: string; type?: string; tcUrl?: string; flashVer?: string; }): Promise<{ code: string; description: string; } | undefined>; /** `@setDataFrame` / `onMetaData`, as published */ metadata(meta: Record): void | Promise; /** an FLV audio or video tag's body, at its RTMP timestamp (milliseconds); an `RtmpRefusal` thrown ends the publish */ audio(timestamp: number, payload: Uint8Array): void | Promise; video(timestamp: number, payload: Uint8Array): void | Promise; /** the publish ended (`FCUnpublish`, `closeStream`, `deleteStream`, the connection ended while publishing, or a * refusal of what was published) */ unpublish(): void | Promise; }; /** What a publisher's media can draw mid-publish: its `onStatus` error, then the publish ended and the connection closed. */ export declare class RtmpRefusal extends Error { readonly code: string; constructor(code: string, description: string); } /** One publisher's connection: its bytes in, the server's answers out through the sink. */ export declare function rtmpSession(sink: TwinStreamSink, publisher: RtmpPublisher, log?: (line: string) => void): TwinStreamConnection & { backlog(): number; };