Setup a Timer to play an audio file. Once timer completes audio will stop automatically

I would like to create a sleeping application. You can set up timer and select an audio file to play. It will stop at a specific time.

Use set timeout


var seconds=60;

setTimeout(function(){
     // your code to stop what ever you want.
}, seconds*1000);
1 Like

If the time is known (not dynamically changing), you could also use a timeline that fires a timeline action at the specific point.

Just be aware with audio that it can’t auto-play unless audio has been previously started on the page via a manual user interaction.

1 Like

Wow Awesoem! I will try this. If it goes well i ll upload my application too. Yeeh. Thank you so much for replying me.

Hey @jonathan Thank you so much really appreciate your answer and thank you again for spare few minutes of your valuable time. I will try these…

1 Like