Search code examples
javascriptaudio

Why is this specific m4a audio file not playing on the <audio> component, but any other one will?


I was building an audio playback component when I noticed that my .m4a audio file was refusing to be played, for some reason. At first, I thought it had to do with the library I was using, Amplitudejs, but then I tried using a barebone HTML page and an <audio> tag to see if it works. It doesn't.

Oddly enough, using any other audio file works, including other .m4a files even from the same S3 bucket, uploaded in the same way. Does anyone know what's going on and why is my audio not playing?

here's my audio: https://deepscribes.s3.eu-central-1.amazonaws.com/uploads/1701605406836Transcription-test+ENG.m4a

And here's one that works: https://filesamples.com/samples/audio/m4a/Symphony%20No.6%20(1st%20movement).m4a

My audio (doesn't work):

<!-- It doesn't work -->
<audio controls muted src="https://deepscribes.s3.eu-central-1.amazonaws.com/uploads/1701605406836Transcription-test+ENG.m4a" />

The other audio (works)

<audio controls src="https://filesamples.com/samples/audio/m4a/Symphony%20No.6%20(1st%20movement).m4a" />


Solution

  • This is simply because your codec is wrong for the file type (container). Convert your file to a supported type (AAC) and it should work.

    By using VLC, I can see that the working audio uses the MPEG AAC codec. Commonly referred to as AAC. It has the most compatibility with web browsers and devices codec info for working audio

    On the non-working file, it says the codec is Apple Lossless Audio Codec. This was a proprietary format and has very little support across browsers (supported in Safari only). codec info for non-working audio

    For further reading and good explanations of codecs and support: https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Audio_codecs