metro-agent
Version:
Metro Agent
33 lines (32 loc) • 1.01 kB
TypeScript
interface RecorderOptions {
wsUrl: string;
sampleRate?: number;
onMessage?: (data: any) => void;
onError?: (error: any) => void;
onProcess?: (buffer: any, powerLevel: number, bufferDuration: number, bufferSampleRate: number, newBufferIdx: number, asyncEnd: any) => void;
}
export declare class RecorderCore {
wsUrl: string;
sampleRate: number;
private socketTask;
private rec;
private readyState;
private reconnectTimeout;
private bitRate;
private recStatus;
private isNotAllow;
onMessage: (data: any) => void;
onError: (error: any) => void;
onProcess: (buffer: any, powerLevel: number, bufferDuration: number, bufferSampleRate: number, newBufferIdx: number, asyncEnd: any) => void;
constructor(options: RecorderOptions);
init(): void;
private bindEvents;
start(): Promise<{
success: boolean;
}>;
private open;
close(): void;
private reconnect;
send(sampleBuf: string | ArrayBuffer): void;
}
export {};