skip to Main Content

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" />

2

Answers


  1. 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

    Login or Signup to reply.
  2. My approach
    The first thing I did, was I monitored the dev tools network tab… I noticed that the content is returning a HTTP code 206 (instead of the second one’s return of 200)… You can read up about that here the primary reason here being the "Range" header being set…
    So seeing that I thought to myself that this should still be playing and therefore the error must be coming from somewhere else… After searching around the web (and here on SO) I found this which points out exactly the error you are facing. It happens to be a problem with what type of encoding your file is using. So what I did was I converted your file to the correct codec and it was able to play the file even with the 206 still returning.
    Solution
    Convert your audio file before uploading (whether s3 or other providers)… If this audio happens to be something you are regularly recording, you can also try to set the default encoding type in your software that way you aren’t constantly converting the file to the correct encoding.

    Edit
    I also like the insights Justin Condello brought to the table.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search