I would like to make a PLAY/PAUSE
button to responsive-voice.js
lib. It will start reading after clicking PLAY and change button label on PAUSE When again I will click this button it will of course pause and change the label on RESUME. After click RESUME it will continue reading the text from PHP. Right now my script not working.
<input id=playsound; onclick='changeState("<?php echo $step[' description ']; ?>");' type='button' value='PLAY' />
<script>
function changeState(tekst) {
var buttonvalue = document.getElementById('playsound').value;
switch (buttonvalue) {
case "PLAY":
document.getElementById('playsound').value = "PAUSE";
document.getElementById('playsound').onclick = responsiveVoice.speak(tekst, "Polish Female");
break;
case "PAUSE":
document.getElementById('playsound').value = "PLAY";
document.getElementById('playsound').onclick = responsiveVoice.pause();
break;
}
}
</script>