max
max

Reputation: 61

HTML5 Audio playback of aac stream does not work in iOS 11 with type="audio/mp4"

I encountered a problem with iOS 11 not being able to stream audio files from a HTML audio element. The file is an aac file hosted externally.

This is the code example:

<audio controls>
  <source src="http://techslides.com/demos/samples/sample.aac" type="audio/mp4">
</audio>

I solved this by changing the type to "audio/mpeg", but wanted to add this to stackoverflow to prevent other people from having to look for the bug for ages.

You can open this link in iOS to view what goes wrong. https://embed.plnkr.co/Z0fE5t5ycS1syKrKf1Nf/?show=preview

Upvotes: 2

Views: 1412

Answers (1)

max
max

Reputation: 61

So the fix turned out to be to change the type to "audio/mpeg". Although I still have no clue what goes wrong.

Fixed code:

<audio controls>
 <source src="http://techslides.com/demos/samples/sample.aac" type="audio/mpeg">
</audio>

And again the link with the initial bug and the fix:
https://embed.plnkr.co/Z0fE5t5ycS1syKrKf1Nf/?show=preview

I hope this was a worthy addition to stackoverflow as I'm quite new.

Upvotes: 4

Related Questions