1
I made a simple button "play/pause" for audio, with the following script:
<audio id="myAudio"
src="http://www.sousound.com/music/healing/healing_01.mp3" preload="auto">
</audio>
<script type="text/javascript" charset="utf-8" async defer>
var myAudio = document.getElementById("myAudio");
var isPlaying = false;
function togglePlay() {
if (isPlaying) {
myAudio.pause()
} else {
myAudio.play();
}
};
myAudio.onplaying = function() {
isPlaying = true;
};
myAudio.onpause = function() {
isPlaying = false;
};
</script>
However, I would actually like to click the button "play/pause" instead of pausing, restart from '0' playback. Some light?
Thank you, successfully implemented!
– dib
@dib Valeu!!!!!
– Sam