I've coded a button to display the "play" symbol (triangle). When you click the button, the selected audio plays and the button displays a "pause" symbol instead. If you click pause, the audio pauses and the button switches back to the play symbol. So far, so good. When the audio is OVER, however, the button keeps displaying the "pause" symbol. You can press the button again and the audio will play again, but the image does not return to the play triangle. Any advice for a newbie?
<script>
var loopA = document.getElementById('playA');
function playAudioA() {
if (loopA.paused) {
loopA.play();
pButtonA.className = "";
pButtonA.className = "fa fa-pause";
} else {
loopA.pause();
pButtonA.className = "";
pButtonA.className = "fa fa-play";
loopA.currentTime = 0
}
}
</script>
Aucun commentaire:
Enregistrer un commentaire