nulldev
nulldev

Reputation: 95

Loop Audio Specified Amount of Times Html5 or Javascript

I need to look this typing sound over and over again until my typing animation is done. I know I can use an audio editor to extend the sound but I just want to know if there is any way to do this with just html5 and javascript. I need to loop it a specific number of times then stop it.

Here is my code:

<audio autoplay>
<source src="sfx_typing.mp3" type="audio/mpeg">
<embed height="50" width="100" src="sfx_typing.mp3">
</audio>

Thanks in advance for any help.

This also should happen on page load with no delay and no plugins should be used in the audio playing.

Upvotes: 0

Views: 408

Answers (1)

Igor Gilyazov
Igor Gilyazov

Reputation: 777

You can play() audio again in ended event handler.

Upvotes: 1

Related Questions