setTimeout not working πŸ€” | Sololearn: Learn to code for FREE!

+6

setTimeout not working πŸ€”

Please help me to solve this error πŸ™‚ And why it's play when I touch on screen within 2 seconds https://code.sololearn.com/WjSlXvDi587A/?ref=app

11 Answers

New Answer

+6

I think Browsers has stopped supporting the play of audios after page loads without interacting with the page and can only be initiated when it has registered a gesture 🀷🏻.

+4

for security reasons auto playing audios will not work on SOLOLEARN. It will only work if the user start the audio by his own hands. But if you still want to autoplay then you should trick the user. For example, trick the user so that he/she will force to touch the screen, from there you can start the audio like create an ad popup, a custom alert Box, or just by simply touching the screen one time. This way you can force them to start the audio. πŸ‘‡πŸ‘‡πŸ‘‡πŸ‘‡ read this about blocking of auto play audio https://developer.mozilla.org/en-US/docs/Web/Media/Autoplay_guide

+3

+3

setTinmeout is working but on sololearn audio file can not be played without user gesture that's why you face an error

+2

I think it is Sololearn, I tried pasting the code into W3schools tryIt editor and it worked fine

+2

Check the code https://code.sololearn.com/WS1RhRi7Q8g9/?ref=app

+2

Hmm only here on sololearn you cant do this. I tried this many times but here it is not supported due to some reason. this is because of older version of browser engion used by sololearn.

+2

Cheque your browser version πŸŒπŸŒŽπŸŒα΄€Ιͺᴍ🌍🌎🌏 It's working for me

+1

丹ⓨㄩک廾 not working in Chrome and opera πŸ€”

0

γ…€Mr. Nβ™‘ β™‘Nβ‚¬β˜† γ…€γ…€ music not working πŸ™

-1

I think you need write js code to "js"(you write js to html)