AurelioDeRosa / HTML5-API-demos

A repository where you can find information about many JavaScript and HTML5 APIs.
706 stars 179 forks source link

SpeechSynthesisVoice bug #7

Closed miketaylr closed 8 years ago

miketaylr commented 8 years ago

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');

   [Constructor,
    Constructor(DOMString text)]
    interface SpeechSynthesisUtterance : EventTarget {
        attribute DOMString text;
        attribute DOMString lang;
        attribute SpeechSynthesisVoice voice;
        attribute float volume;
        attribute float rate;
        attribute float pitch;

        attribute EventHandler onstart;
        attribute EventHandler onend;
        attribute EventHandler onerror;
        attribute EventHandler onpause;
        attribute EventHandler onresume;
        attribute EventHandler onmark;
        attribute EventHandler onboundary;
    };

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)

AurelioDeRosa commented 8 years ago

Hi @miketaylr.

Thank you for reporting this issue. I'm going to fix it as soon as possible.

AurelioDeRosa commented 8 years ago

The issue has been fixed. Thank you for reporting it.

miketaylr commented 8 years ago

Thank you!