interface Options { onPlaying?: () => void; onPause?: () => void; onChunkEnd?: () => void; mimeType?: string; audio?: HTMLAudioElement; } /** * @typedef {{ * onPlaying?: () => void; * onPause?: () => void; * onChunkEnd?: () => void; * mimeType?: string; * audio?: HTMLAudioElement * }} Options */ declare class SpeechPlayer { /** @type { HTMLAudioElement } */ _audio: HTMLAudioElement; /** @type { MediaSource } */ mediaSource: MediaSource; /** @type { SourceBuffer } */ sourceBuffer: SourceBuffer; /** @type {() => void } */ initResolve: ((value: unknown) => void) | null; /** @type {Uint8Array[]} */ sourceBufferCache: Uint8Array[]; /** @type {boolean} */ destroyed: boolean; /** @type {boolean} */ mediaSourceOpened: boolean; /** @type {Options} */ options: Options; /** @type { AudioContext } */ audioContext: AudioContext; /** @type { number } */ nextStartTime: number; /** @type { Uint8Array } */ pendingBuffer: Uint8Array; /** @type { boolean } */ useAudioContext: boolean; get audio(): HTMLAudioElement; set audio(audio: HTMLAudioElement); /** * @param { Options } options */ constructor(options?: Options); static streamAsyncIterable(stream: ReadableStream): AsyncGenerator, void, unknown>; init(): Promise; sourceOpenHandle(): void; /** * Feed audio chunk data into player with SourceBuffer created from MediaSource * @param {Uint8Array} chunk */ feed(chunk: Uint8Array): void; processAudioContextQueue(): Promise; schedulePlayback(buffer: AudioBuffer): void; /** * Feed audio chunk just with Fetch response and deal automaticlly. * @param {Response} response */ feedWithResponse(response: Response): Promise; play(): Promise; pause(): Promise; get paused(): boolean; get playing(): boolean; /** * Destroy speechPlayer instance, if want play again, need do init method again. */ destroy(): void; } export { SpeechPlayer };