Auto-play javascript loop

Hello friends,

I am creating a game based on html5 and JS, I want to play an audio clip for 8 seconds in the background in a loop, but when I add sound to the HTML code using:

<audio src="audio.mp3" autoplay loop></loop>

but still it plays the sound in one go.

can someone tell me how to do this?

+4
source share
1 answer

You can check these posts 1 and 2 because some browsers have loop issues, so you need to do this manually.

+5
source

Source: https://habr.com/ru/post/1525202/


All Articles