<AudioBlock>

The <AudioBlock> component displays an audio attachment. If the audio attachment is a voice-recorded message, a <VoiceBlock> is used instead.

interface AudioBlockProps

Properties

block
: AudioBlock

The audio block to display.

A collection of objects which are passed to all Chatbox theme components.

message
: MessageSnapshot

The message that this content block belongs to.

downloadUrl (optional)
: string

The URL used to download the file.

This URL is not the same as block.url. When the current user sends a file message, the block.url will hold a temporary blob: URL until that file is uploaded to TalkJS. The user can immediately see their file present in the chat, which makes for a smoother user experience.

The downloadUrl is the URL of the file once it is uploaded to TalkJS. As such, this property will be undefined until the upload is completed, while block.url will always be defined and should be used for preview purposes.

Example

In the default theme, the <AudioBlock> component is implemented as follows:

AudioBlock.js
1// loading...