Skip to content Skip to sidebar Skip to footer

Audio Is Unable To Play Via Javascript On Some Mobile Browsers

I'm trying to do a simple thing. I want some audio to play exactly after 10 seconds when the user enters the webpage. I used the following code var aud=new Audio('someAudio.mp3');

Solution 1:

I'm trying to do a simple thing. I want some audio to play exactly after 10 seconds when the user enters the webpage.

You can't unless there has been user interaction.

Handle a click event for some element. In that event handler, play some other audio. (This audio can be silent!) After 10 seconds have passed from load, if the user has touched/clicked something, and you've done this, you should be able to play your audio file.

Post a Comment for "Audio Is Unable To Play Via Javascript On Some Mobile Browsers"