UNPKG

media-stream-library

Version:

Media stream library for Node & the Web.

40 lines (39 loc) 1.43 kB
import { AuthConfig } from '../components/auth'; import { RtspConfig } from '../components/rtsp-session'; import { WSConfig } from '../components/ws-source/openwebsocket'; import { RtspMjpegPipeline } from './rtsp-mjpeg-pipeline'; export interface Html5CanvasConfig { ws?: WSConfig; rtsp?: RtspConfig; mediaElement: HTMLCanvasElement; auth?: AuthConfig; } /** * Html5CanvasPipeline * * A pipeline that connects to an RTSP server over a WebSocket connection and * can process JPEG RTP data to produce an motion JPEG data stream that is sent * to a HTML canvas element. * * Handlers that can be set on the pipeline: * - all handlers inherited from the RtspMjpegPipeline * - `onSync`: called when the NTP time of the first frame is known, with the * timestamp as argument (the timestamp is UNIX milliseconds) * - `onServerClose`: called when the WebSocket server closes the connection * (only then, not when the connection is closed in a different way) */ export declare class Html5CanvasPipeline extends RtspMjpegPipeline { onCanplay?: () => void; onSync?: (ntpPresentationTime: number) => void; onServerClose?: () => void; ready: Promise<void>; private _src?; private readonly _sink; constructor(config: Html5CanvasConfig); close(): void; get currentTime(): number; play(): void; pause(): void; get bitrate(): number; get framerate(): number; }