Autoplay HTML5 audio in Chrome for Android, Mobile Safari in iOS

Updated . Posted . Visible to the public.
  • Mobile browser's ignore the autoplay attribute on <audio> and <video> elements. Stupid reasons include saving mobile bandwidth on behalf of the user and/or securing app store sales.
  • Audio and video elements will only play as the result of a user interactions (click, touch).
  • A workaround is to have a "start button" in your application that loads and plays an initial sound.
  • You can now play further sounds without user interaction by changing the source on the same <audio> element.

I tested this on Chrome for Android. The interweb says Show archive.org snapshot it should work on Mobile Safari as well.

Henning Koch
Last edit
Judith Roth
License
Source code in this card is licensed under the MIT License.
Posted by Henning Koch to makandra dev (2013-01-27 08:46)