+ 9

Can anyone tell me how to play audio/sound on page load without user gesture?

If you know then please share a code..

12th Jun 2019, 7:46 PM
Jesse Pinkman
Jesse Pinkman - avatar
8 Respostas
12th Jun 2019, 8:39 PM
River
River - avatar
+ 8
Automatic music play dose not work on chrome browser because hi is very strict.
7th Feb 2021, 2:39 AM
Kirti Gurg (Don't Talk)
Kirti Gurg (Don't Talk) - avatar
+ 7
This might help you : https://www.sololearn.com/learn/HTML/2193/ See the <autoplay> attribute ..........
13th Jun 2019, 5:21 AM
Shadow Ninja[#Inactive]
Shadow Ninja[#Inactive] - avatar
+ 5
Same link posting twice?
13th Jun 2019, 4:41 PM
Janning⭐
Janning⭐ - avatar
+ 1
Playing sound is basically letting the website use your audio System. Some browsers want you to "pay them" for your work.
13th Jun 2019, 11:58 AM
H.O. HO services
+ 1
Due to browser restrictions (especially mobile devices) that isn't always possible. One workaround that I use is if there is any button that the user would have to click to use audio in the first place, then play and immediately pause the audio. This allows the audio to be played without issues in the future. An example could be for game sound effects, clicking a start/play button would quickly play then pause the audio to allow it to be played later. Also, I'm not completely sure about this, but I think that if the browser won't allow js to play audio on-demand, then neither will the autoplay attribute (as other answers have suggested) start it.
16th Jun 2019, 3:48 AM
JS Coder
0
First link not working, Please give the correct link @river
26th May 2020, 6:12 PM
vishnu vardhan
vishnu vardhan - avatar