@100mslive/hms-video-store
Version:
@100mslive Core SDK which abstracts the complexities of webRTC while providing a reactive store for data management with a unidirectional data flow
40 lines (39 loc) • 1.4 kB
TypeScript
import { TypedEventEmitter } from '../utils/typed-event-emitter';
/**
* This class handles video playlist management
* - An video element, canvas and audio context which processes audio from video element is created
* in the constructor
* It handles playback in the following steps
* - set's the url on the video element created in the constructor
* - oncanplaythrough event of the video element
* - resume the audio context if it is suspended
* - set width/height on canvas
* - captureStream on canvas element if not already captured
* - play the video element
* - on video element is played, it is drawn to canvas
* - Get audio track from the audio context manager
* - add audioTrack to canvas stream
* - The audio and video tracks are passed to playlist manager to publish
*/
export declare class PlaylistVideoManager extends TypedEventEmitter<{
ended: null;
progress: Event;
}> {
private readonly TAG;
private videoElement;
private canvasContext;
private canvas;
private timer;
private tracks;
private audioContextManager;
private DEFAUL_FPS;
private seeked;
play(url: string): Promise<MediaStreamTrack[]>;
getTracks(): string[];
getElement(): HTMLVideoElement;
stop(): void;
private clearCanvasAndTracks;
private drawImage;
private getVideoElement;
private createCanvas;
}