SpeakerHandler class
SpeakerHandler handles the streaming and conversion of text into audio files. It is responsible for processing text chunks, generating audio for sentences, and managing the playback of these audio files using a specified audio player.
Constructors
- SpeakerHandler({SimpleAudioPlayer playerFactory(File file)?, void onPlay(String sentence, File file)?, String? onSentenceCompleted(String)?, String? voice, Duration? maxSentenceDelay})
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasPendingSpeaches → bool
-
no setter
- isSpeaking ↔ bool
-
getter/setter pair
- maxSentenceDelay → Duration
-
Maximum delay between processing two consecutive sentences.
final
- onPlay ↔ void Function(String sentence, File file)?
-
Callback executed when a sentence is played. Provides the sentence and its audio file.
getter/setter pair
- onSentenceCompleted ↔ String? Function(String)?
-
Called whenever a new sentence is recognized.
getter/setter pair
- player ↔ SimpleAudioPlayer?
-
getter/setter pair
- playerFactory → SimpleAudioPlayer Function(File file)
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- voice → String
-
The voice parameter used for text-to-speech conversion.
final
Methods
-
dispose(
) → void -
getVolumeStream(
) → Stream< double> -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
process(
String chunk) → Future< void> -
speakSentences(
) → void -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
fromLocalStorage(
{String? onSentenceCompleted(String)?, void onPlay(String sentence, File file)?}) → Future< SpeakerHandler>