Skip to content

SpeechSynthesisUtterance constructor takes an argument #6

@whitmer

Description

@whitmer

It took me about an hour to figure out why my speech wasn't being generated, I assumed I had the plugin setup wrong or something. If you look at the web speech API (https://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html#tts-section), the SpeechSynthesisUtterance constructor takes an optional argument, "DOMString text". Your plugin instead requires text to be set after the object is created.

In essence, this should be valid but it instead triggers an error event:

var u = new SpeechSynthesisUtterance("I have something to say");
speechSynthesis.speak(u);

I've fixed my code, but I'm sure it will surprise someone else and it would be great if you could update the code to match the spec. I'll try to find time to issue a pull request with the change, but this would be my first android code so it might take me a little bit to work up the courage :-).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions