Skip to content
August 4, 2013 / pauldundon

Android Chrome <audio> Element Doesn’t Play from Javascript

The problem: You are calling play() on an audio element, but playback doesn’t start on Chrome on Android.

The cause: There appears to be a feature in Chrome on Android which restricts <audio> tags from playing unless “authorised” by a user click. Calls to “play” will have no effect until the user clicks on the play button of the element, or a call to play is made inside a click handler.

Possible solution: No solution appears to be possible unless there is a click of some sort between creating the element and your first required play() call. However, if there is a such an event, calling play and then immediately calling pause will “authorise” the element.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: