UNPKG

tav-media

Version:

Cross platform media editing framework

100 lines (99 loc) 2.74 kB
import { MediaClip } from './clips/tav-media-clip'; import { TAVSurface } from './engine/tav-surface'; import { TAVVideoReader } from './engine/tav-video-reader'; import { ScaleMode } from './types/types'; import { EventManager } from './utils/event-manager'; /** * TAVMediaView is a view that can play a TAVMedia Clip. * @category Engine */ export declare class TAVMediaView { /** * Make a TAVMediaView from a canvas and MediaClip. * @param canvasOrSelector HTMLCanvasElement or canvas selector * @param media The root media clip to play * @returns A TAVMediaView instance */ static MakeFromHtmlCanvas(canvasOrSelector: HTMLCanvasElement | string, media?: MediaClip): TAVMediaView; /** * Subscribes events. */ events: EventManager<"progress">; /** * Set scale mode to surface. */ scaleMode: ScaleMode; private root; private lastNativeRoot?; private surface; private videoReader; private audioReader; private _frameRate; private lastFrame; private isPlaying; private startTime; private progress; private renderTask; private offset; /** * Get the duration of the media. */ get duration(): number; /** * Get the frame rate. */ get frameRate(): number; /** * Set the frame rate to render. * @param frameRate Frame rate * @returns void */ setFrameRate(frameRate?: number): void; /** * Get the TAVSurface in use. * @returns The surface. */ getSurface(): TAVSurface; /** * Get current TAVVideoReader. * @returns Current TAVVideoReader */ getVideoReader(): TAVVideoReader; /** * Set a new surface to render to. * @param surface The new surface * @returns void */ setSurface(surface: TAVSurface): Promise<void>; /** * Set the media clip to play. * @param media The media clip to play * @returns void */ setMedia(media: MediaClip): Promise<void>; /** * Continue to play. */ play(): Promise<void>; /** * Pause the playback. * @returns void */ pause(): Promise<void>; /** * Set the progress of the playback. * @param progress Current progress, in microsecond, 1s = 1000000us */ seek(progress: number): Promise<void>; /** * Get the current progress of the playback. * @returns The current progress, in microsecond, 1s = 1000000us */ getProgress(): number; protected render(force?: boolean): Promise<void>; protected requestRender(force?: boolean): void; private resetProgress; private pauseMediaReaders; private resumeMediaReaders; private getOffset; }