Question: I want to audio auto-play in android and iPhone mobiles is it possible?
Answer:
- Audio/video autoplay is not allowed on iPhone, iPad and Android. It’s a limit from the device, and there is no way to bypass it.
- On both iOS and Android (this includes both mobile and tablet devices) it is not possible to ‘autoplay’ a media file. What this means, in practice, is that you always need a user action to initiate an audio or video play, such as a button click.
Solutions:
- Another autoplay solution, especially applicable to audio, is using audio sprites. Instead of having different audio files you stitch them all together in one big file and move the current time. Another decent solution, but this takes a lot more work and overhead, and is probably unusable for video because of the file size. Also, you can still only play one sound at the same time.
- Yet another autoplay solution, only applicable for audio, is to use theWeb Audio API. Here’s an article about how to use it on iOS. Unfortunately the Web Audio API is not supported on any version of Internet Explorer and the stock Android Browser (Chrome for Android does support it), so you need to use other solutions for those browsers. You could try using something like Howler.js to make it work on all platforms.
Article taken from “haykranen.nl”