TinksJS

TinksJS Reference / stopMusic

// Stop music and set its position to 0 seconds void tj.stopMusic();

Summary

tj.stopMusic() stops music and sets its position to zero. If you call tj.playMusic() again, it will play from the start.

If the music is already not playing when you call tj.stopMusic(), the call has no effect.

The following demo shows loading music and then playing it on a button click. And provides a Stop button for you to stop it half way through. When you click Play again, it will play from the start.

If you'd like to Pause music instead, e.g. stop it but keep its position. You can use tj.pauseMusic().

If you'd like to see a demonstration of a range of TinksJS Audio functions, you may like to check out the Audio Player example.

Thanks/Credits

Encouragement Music (encouragement.mp3) Unnamed author on Free SFX
Free Audio Hosting DropBox

JS

 

Result