Voice Messages
Nexconn Chat UI supports SDK HDVoiceMessage messages. The standard input widget can record voice, send a voice file, and render a playable voice bubble.
UI preview
The following image shows the default voice message UI.
Send a Voice Message
Use ChatProvider.sendVoiceMessage when your app already has a local audio file and duration.
await chatProvider.sendVoiceMessage(
'/local/path/voice.aac',
12,
);
The duration is in seconds.
Built-in Recording
When MessageInputConfig.enableVoiceInput is true, the input toolbar can switch to voice mode. The built-in recorder:
- Requests microphone permission.
- Records to a local AAC file.
- Sends on pointer release.
- Cancels when the user slides into the cancel area.
- Rejects recordings shorter than
minimumVoiceRecordingDuration. - Finishes at
maximumVoiceRecordingDuration.
ChatPageConfig(
inputConfig: MessageInputConfig(
enableVoiceInput: true,
minimumVoiceRecordingDuration: Duration(seconds: 1),
maximumVoiceRecordingDuration: Duration(seconds: 60),
),
)
Custom Recording
Use voiceDraftResolver when your app owns the recorder UI. Return a local file path and duration, and the input widget will send it as a voice message.
MessageInputConfig(
voiceDraftResolver: (context) async {
final draft = await openCustomRecorder(context);
if (draft == null) {
return null;
}
return MessageInputVoiceDraft(
path: draft.path,
duration: draft.duration,
);
},
)
For lower-level control, provide a custom MessageInputVoiceRecorder. If microphone permission is denied, the default recorder stops without sending a message and shows the configured permission-denied text.
Playback
Voice bubbles use the SDK HDVoiceMessage media path and the Chat UI audio player provider. Playback availability depends on the local or remote media fields supplied by the underlying SDK.
This Chat UI release does not expose a built-in speech-to-text button or public speech-to-text request API. Apps that need speech transcription should integrate their own service and render the result through custom message metadata or custom bubble builders.