See how the voice attribute isn't a DOMString but: attribute SpeechSynthesisVoice voice;
To fix this you could just pass in the index of the selected <option> into the SpeechSynthesisVoiceList returned by var voicesAvailable = speechSynthesis.getVoices();
(I don't know if this site is even maintained, but thought I should document this)
Per the latest spec, https://dvcs.w3.org/hg/speech-api/raw-file/tip/webspeechapi.html#speechsynthesisvoice, the following is expected to throw a
TypeError
:utterance.voice = selectedVoice.getAttribute('data-voice-uri');
See how the
voice
attribute isn't aDOMString
but:attribute SpeechSynthesisVoice voice;
To fix this you could just pass in the index of the selected
<option>
into theSpeechSynthesisVoiceList
returned byvar voicesAvailable = speechSynthesis.getVoices();
(I don't know if this site is even maintained, but thought I should document this)