Skip to main content

Voice Message

Users can record and send voice messages through the built-in input component of Global IM UIKit. The message will appear in the message list component of the chat UI. By default, the SDK generates and sends messages containing the high-quality voice message content object HQVoiceMessage (type identifier: RC:HQVcMsg).

hqvoice-message(width=250)

Limitations

The voice input feature currently has the following limitations:

  • Global IM UIKit only supports sending voice messages in one-to-one chat and group chat sessions.
  • Users must record audio content that is at least 1 second long and no longer than 60 seconds.
  • Users cannot pause while recording a voice message.

Usage

The voice message input feature is enabled by default in the input bar component. Press and hold the voice button to record, and release to send.

Sending Voice Messages

In the message list, voice messages display information such as decibel levels and duration. Users can click the play button to view and play the voice message, which can be played multiple times. When a voice message is first displayed, the voice file is automatically downloaded and cached locally.

Voice Decibel Levels

During recording, the decibel level of the sound is recorded and sent along with the high-quality voice message. The decibel information is converted into a JSON format string and placed in the extra field of HQVoiceMessage, as shown below:

{
"HQVoicePowers": "level,level,level,level,..."
}

Customization

Customization of voice messages involves the recording button icon in the input bar, recording events, and the UI for displaying voice messages.

Customizing the UI for Voice Messages

The SDK generates and sends high-quality voice messages (RC:HQVoiceMsg) by default, which are displayed in the message list using the HQVoiceMessageItemProvider template.

All message display templates inherit from BaseMessageItemProvider<CustomMessage>. You can inherit BaseMessageItemProvider<CustomMessage> and implement your own high-quality voice message display template class, then provide this custom template to the SDK.