@diffusionstudio/core-v4
Version:
2D motion graphics and video rendering engine
74 lines (73 loc) • 3.82 kB
TypeScript
import { WriteStreamCallback } from './buffer';
import { Composition } from '../composition';
import { EncoderConfig } from './interfaces';
import { EncoderEvents } from './types';
declare const Encoder_base: {
new (...args: any[]): {
_handlers: {
'*'?: {
[x: string]: (event: import('../mixins/event/types').EmittedEvent<any, any>) => void;
} | undefined;
error?: {
[x: string]: (event: import('../mixins/event/types').EmittedEvent<Error, any>) => void;
} | undefined;
render?: {
[x: string]: (event: import('../mixins/event/types').EmittedEvent<{
progress: number;
total: number;
remaining: Date;
}, any>) => void;
} | undefined;
};
on<T extends "*" | "error" | "render">(eventType: T, callback: (event: import('../mixins/event/types').EmittedEvent<import('../mixins/event/types').BaseEvents<EncoderEvents>[T], /*elided*/ any>) => void): string;
off(id?: string | "*", ...ids: string[]): void;
emit<T extends "*" | "error" | "render">(eventType: T, detail: import('../mixins/event/types').BaseEvents<EncoderEvents>[T]): void;
bubble(target: {
_handlers: {
'*'?: {
[x: string]: (event: import('../mixins/event/types').EmittedEvent<any, any>) => void;
} | undefined;
error?: {
[x: string]: (event: import('../mixins/event/types').EmittedEvent<Error, any>) => void;
} | undefined;
render?: {
[x: string]: (event: import('../mixins/event/types').EmittedEvent<{
progress: number;
total: number;
remaining: Date;
}, any>) => void;
} | undefined;
};
on<T extends "*" | "error" | "render">(eventType: T, callback: (event: import('../mixins/event/types').EmittedEvent<import('../mixins/event/types').BaseEvents<EncoderEvents>[T], /*elided*/ any>) => void): string;
off(id?: string | "*", ...ids: string[]): void;
emit<T extends "*" | "error" | "render">(eventType: T, detail: import('../mixins/event/types').BaseEvents<EncoderEvents>[T]): void;
bubble(target: /*elided*/ any): string;
resolve(eventType: "*" | "error" | "render"): (resolve: (value: unknown) => void, reject: (reason?: any) => void) => void;
}): string;
resolve(eventType: "*" | "error" | "render"): (resolve: (value: unknown) => void, reject: (reason?: any) => void) => void;
};
};
export declare class Encoder extends Encoder_base {
private composition;
private config;
/**
* Create a new audio and video encoder and multiplex the result
* using a mp4 container
* @param composition The composition to render
* @param config Configure the output
* @example
* ```
* const blob = await new Encoder(composition).render();
* ```
*/
constructor(composition: Composition, config?: EncoderConfig);
/**
* Export the specified composition
* @throws DOMException if the export has been aborted
*/
render(target?: WriteStreamCallback | FileSystemFileHandle | WritableStream | string, signal?: AbortSignal): Promise<undefined | Blob>;
audioCodecs(): Promise<("opus" | "aac" | "mp3" | "vorbis" | "flac" | "pcm-s16" | "pcm-s16be" | "pcm-s24" | "pcm-s24be" | "pcm-s32" | "pcm-s32be" | "pcm-f32" | "pcm-f32be" | "pcm-f64" | "pcm-f64be" | "pcm-u8" | "pcm-s8" | "ulaw" | "alaw")[]>;
videoCodecs(): Promise<("avc" | "hevc" | "vp9" | "av1" | "vp8")[]>;
private log;
}
export {};