UNPKG

media-stream-library

Version:

Media stream library for Node & the Web.

42 lines (41 loc) 1.38 kB
import { Sink } from '../component'; /** * Canvas component * * Draws an incoming stream of JPEG images onto a <canvas> element. * The RTP timestamps are used to schedule the drawing of the images. * An instance can be used as a 'clock' itself, e.g. with a scheduler. * * The following handlers can be set on a component instance: * - onCanplay: will be called when the first frame is ready and * the correct frame size has been set on the canvas. * At this point, the clock can be started by calling * `.play()` method on the component. * - onSync: will be called when the presentation time offset is * known, with the latter as argument (in UNIX milliseconds) */ export declare class CanvasSink extends Sink { onCanplay?: () => void; onSync?: (ntpPresentationTime: number) => void; private readonly _clock; private readonly _scheduler; private readonly _info; /** * @param el - The <canvas> element to draw incoming JPEG messages on. */ constructor(el: HTMLCanvasElement); /** * Retrieve the current presentation time (seconds) */ get currentTime(): number; /** * Pause the presentation. */ pause(): void; /** * Start the presentation. */ play(): void; get bitrate(): number; get framerate(): number; }