Partager via


UtteranceProgressListener.OnAudioAvailable(String, Byte[]) Method

Definition

This is called when a chunk of audio is ready for consumption.

[Android.Runtime.Register("onAudioAvailable", "(Ljava/lang/String;[B)V", "GetOnAudioAvailable_Ljava_lang_String_arrayBHandler", ApiSince=24)]
public virtual void OnAudioAvailable (string? utteranceId, byte[]? audio);
[<Android.Runtime.Register("onAudioAvailable", "(Ljava/lang/String;[B)V", "GetOnAudioAvailable_Ljava_lang_String_arrayBHandler", ApiSince=24)>]
abstract member OnAudioAvailable : string * byte[] -> unit
override this.OnAudioAvailable : string * byte[] -> unit

Parameters

utteranceId
String

The utterance ID of the utterance.

audio
Byte[]

A chunk of audio; the format can be known by listening to #onBeginSynthesis(String, int, int, int).

Attributes

Remarks

This is called when a chunk of audio is ready for consumption.

The audio parameter is a copy of what will be synthesized to the speakers (when synthesis was initiated with a TextToSpeech#speak call) or written to the file system (for TextToSpeech#synthesizeToFile). The audio bytes are delivered in one or more chunks; if #onDone or #onError is called all chunks have been received.

The audio received here may not be played for some time depending on buffer sizes and the amount of items on the synthesis queue.

Java documentation for android.speech.tts.UtteranceProgressListener.onAudioAvailable(java.lang.String, byte[]).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to