Hello:
How can I re-create this function on Howler to PLAY / STOP a single audio file using the same button or image as trigger.
function togglePlay() {
return myAudio.paused ? myAudio.play() : myAudio.pause();
};
Hello!
According to the Howler documentation:
playing(id)
Check if a sound is currently playing or not, returns aBoolean(...)
So the method you were looking for is myAudio.playing().
Here is that code example you sent, adapted to this method.
function togglePlay(){
return myAudio.playing() ? myAudio.pause() : myAudio.play();
};
Will be great if working code is provided for better clarity of playing
actually, that's the code right there... All you need is to copy the rest of the sample code from the docs @goldfire provides!!! Happy coding!
Thanks for the reply !
Actually I set the timer to get the position of the song after every 3 sec. Post the song is paused player.pos() is giving me the normal song speed position it didn't giving me the paused song position.
so i have a doubt that song is actually getting paused or not.
Any solution for this ?
Most helpful comment
Hello!
According to the Howler documentation:
So the method you were looking for is
myAudio.playing().Here is that code example you sent, adapted to this method.