Question
Is there any way to use audio in a web app so that it will work on most browsers (Chrome,FF,Safari and IE9+) and devices (Android/IOS for mobile would do) ?
My requirements
I would need basic preloading, playing multiple sounds at once, muting them on click and perhaps looping (probably not seamlessly right? ;) ).
What I learned so far:
- Web Audio API wont work on IE and any Android. (link)
- with audio tag I get different durations for the same audio on Safari and Chrome ...
- I checked SoundManager2 but it won't work somewhere (throws HTML5 error code 4 for me)
- SoundJS seems to work cross-browser and device so far as I checked but there are limits ofcourse:
- cannot loop or use delay on Android
- Safari requires Quicktime to be installed for audio playback
- IE9 has limits with playing multiple sounds at once
- tried this and it wont play on my Android (v4.1.2 Samsung 3 mini)
- Howler.js seems to work on Android for instance as well, didn't make extensive testing yet
- when playing multiple sounds at once and turning volume for one of them up/down or muting it wont respond until you stop() and start playing all of them again
- Most tools use Flash as a fallback which might be useful in some cases
- It seems like it's not possible to seamlessly loop sounds with any of these approaches
- You have to provide different formats/codecs to be able to play sound in various browsers (mp3 and ogg would be sufficient I reckon?)
- Chrome (ogg,mp3,wav)
- FF (ogg, wav)
- IE9+ (mp3,aac)
- Safari (mp3,aac,wav)
A follow up question
What are your experiences with these and perhaps any other tools and do any of these provide what I need (cross-browser,cross-device)?
For each tool I mentioned there are comments or site-notes that say something didn't work in this case or that … Are we still 'not there yet' with audio in web browsers?
Any help appreciated, thank you!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…