DEV Community

So Sun Park
So Sun Park

Posted on

TIL: <audio> _ issue with iOS mobile

I am using < audio > sources for a project.
While testing, all iphone & ipad mobile browsers (chrome and safari) were not playing my audio sources at all. And UI was showing 'ERROR' only.

After many googlings and trials, I realized it was format problem. iOS doesn't seem to accept ogg files. I have almost 30 audio files to load, so I converted them into ogg files to lower the size but... Phew.

Wondering why iOS wouldn't accept ogg though. I couldn't find a useful article which explains why so. Instead, I just googled ogg's pros and cons (e.g., https://mp4gain.com/mp4gain/advantages-and-disadvantages-of-the-ogg-format-compared-to-mp3/)

Another problem I need to solve is, playing audio in mobile browser at certain timing. In pc browsers, I made <audio> to play at certain scroll-y locations. It does not work in iphone. It plays the audio only if the click/touch event directly calls audio.play(). Even if it's not exactly autoplay in <audio> tag, it still needs some user touch interaction to trigger.

Top comments (0)