SpeechToTextButton
A composable button that provides speech-to-text functionality.
When not recording, displays a microphone icon button. When recording, transforms into a circle with animated bars that respond to voice input.
The component automatically handles:
Audio permission requests
Starting and stopping speech recognition
Streaming recognized text chunks to the callback as they're detected
Animated visualization during recording
Parameters
The state holder for tracking recording status. Must be created with rememberSpeechToTextButtonState.
Modifier to be applied to the root container
Callback invoked when microphone permission is denied.
The composable content to display when not recording. Receives an onClick callback that toggles recording.
The composable content to display when recording. Receives an onClick callback that stops recording and the current audio level (rmsdB) for visualization.