Uploading files, audio clips: issue with missing file extension of saved file if audio is encoded with 'audio/webm'

When uploading an audio clip, using the sendBirdSelectors.getSendFileMessage(store), encoded with ‘audio/webm’ format, the Sendbird backend stores the file without a file extension. This causes issues when using <audio> HTML tag to play said audio clip in browsers, specifically the duration of the audio clip is broken due to the missing file extension.

This does not happen though for audio clips send with ‘audio/mpeg’, ‘audio/m4a’ or ‘audio/ogg’. Those get the correct .mp3, .m4a, .oga extensions which prevents the issue above.

.m4a clip uploaded, plainUrl includes the file extension: .m4a

.ogg clip uploaded: plainUrl includes the file extension: .ogg

But the problem: ‘audio/webm’ file. There is no file extension.

This is a rather bigger concern, as it would seem, as the default Chrome MediaRecorder option for recording audio uses this format.

Is there a way for these audio files to be saved with a ‘logical’ file extension, when the audio clip sent is using ‘audio/webm’?

Hey @vibonacci, and thanks for posting to our community!

I am doing some testing here to see if I can recreate the same issue. I’ll update you with my findings.

I realized what the issue is. I was sending (naked) Blob’s to the Sendbird backend using FormData()

Converting them to a File object, with the proper mimeType, i.e. ‘audio/webm’ or ‘audio/ogg’, depending on the file, the proper extension is added.

Sending a File object like this:

now generates a file with .webm extension.