matrix-react-sdk
Version:
SDK for matrix.org using React
48 lines (47 loc) • 1.84 kB
TypeScript
import { MatrixClient } from "matrix-js-sdk/src/matrix";
import { EncryptedFile } from "matrix-js-sdk/src/types";
import { SimpleObservable } from "matrix-widget-api";
import { IDestroyable } from "../utils/IDestroyable";
import { Playback } from "./Playback";
import { IRecordingUpdate, VoiceRecording } from "./VoiceRecording";
export interface IUpload {
mxc?: string;
encrypted?: EncryptedFile;
}
/**
* This class can be used to record a single voice message.
*/
export declare class VoiceMessageRecording implements IDestroyable {
private matrixClient;
private voiceRecording;
private lastUpload?;
private buffer;
private playback?;
constructor(matrixClient: MatrixClient, voiceRecording: VoiceRecording);
start(): Promise<void>;
stop(): Promise<Uint8Array>;
on(event: string | symbol, listener: (...args: any[]) => void): this;
off(event: string | symbol, listener: (...args: any[]) => void): this;
emit(event: string, ...args: any[]): boolean;
get hasRecording(): boolean;
get isRecording(): boolean;
/**
* Gets a playback instance for this voice recording. Note that the playback will not
* have been prepared fully, meaning the `prepare()` function needs to be called on it.
*
* The same playback instance is returned each time.
*
* @returns {Playback} The playback instance.
*/
getPlayback(): Playback;
upload(inRoomId: string): Promise<IUpload>;
get durationSeconds(): number;
get contentType(): string;
get contentLength(): number;
get liveData(): SimpleObservable<IRecordingUpdate>;
get isSupported(): boolean;
destroy(): void;
private onDataAvailable;
private get audioBuffer();
}
export declare const createVoiceMessageRecording: (matrixClient: MatrixClient) => VoiceMessageRecording;