@diffusionstudio/core-v4
Version:
2D motion graphics and video rendering engine
53 lines (52 loc) • 1.83 kB
TypeScript
import { WordGroup } from './group';
import { Language, GeneratorOptions } from './types';
import { Word } from './word';
import { Captions, MediaInput } from '../../types';
import { Serializer } from '../../services';
export declare class Transcript implements Serializer {
id: string;
language: Language;
groups: WordGroup[];
get text(): string;
get words(): Word[];
constructor(groups?: WordGroup[], language?: Language);
/**
* Iterate over all words in groups
*/
iter({ count, duration, length }: GeneratorOptions): Generator<WordGroup, void, unknown>;
/**
* This method will optimize the transcipt for display
*/
optimize(): this;
/**
* Convert the transcript into a SRT compatible
* string and downloadable blob
*/
toSRT(options?: GeneratorOptions): {
text: string;
blob: Blob;
};
toJSON(): Captions;
/**
* Create a new Transcript containing the
* first `{count}` words
* @param count Defines the number of words required
* @param startAtZero Defines if the first word should start at 0 milliseconds
* @returns A new Transcript instance
*/
slice(count: number, startAtZero?: boolean): Transcript;
/**
* Create a deep copy of the transcript
* @returns A new Transcript instance
*/
copy(): Transcript;
static fromJSON(data: Captions): Transcript;
/**
* Create a Transcript from an input medium of the form:
* `{ token: string; start: number; stop: number; }[][]`
* @param input The input medium, can be a URL, Blob, or an array of captions
* @returns A Transcript with processed captions
*/
static from(input: MediaInput | Captions): Promise<Transcript>;
fromJSON<K = {}>(obj: K extends string ? never : K): this;
}