Reputation: 22605
Let's say I have two audio files. I hooked them up with my javascript.
var audio1 = new Audio();
audio1.src = 'file1';
audio1.load();
var audio2 = new Audio();
audio2.src = 'file2';
audio2.load();
when I play audio1 then play audio2, mobile safari (ios) stops audio1 then plays audio2. It only happens with ios safari.
Upvotes: 2
Views: 3737
Reputation: 128
One possible workaround is to use server-side utility like sox to mix multiple audio files into one. It is not equivalent to playing multiple audio files at random position but depending on your needs it can be a solution.
Upvotes: 0
Reputation: 611
I did some testing on this recently. The short answer is as stated before, it doesn't work. I tried working with mp3,m4a(aac I purchased on itunes),mp4 and aif, so file format has no bearing on iOS safari's ability to play more than one stream at a time.
I have currently "solved" the issue in my web app by assigning priorities to sounds in the app so it can intelligently interrupt or ignore requests to play a sound file. Maybe you can try something similar.
Upvotes: 1
Reputation: 18870
As far as I'm aware, this is a design decision from Apple, it'S not possible to play more than one audio file.
Upvotes: 3