Features
- Native support detection #14
To detect native speech synthesis support use:
window.nativeSpeechSynthesisSupport(); // true, false
We use polyfill only when speech synthesis is not available. To initialize speech synthesis use:
var fallbackSpeechSynthesis = window.getSpeechSynthesis();
var fallbackSpeechSynthesisUtterance = window.getSpeechSynthesisUtterance();
var u = new fallbackSpeechSynthesisUtterance('Hello World');
u.lang = 'en-US';
u.volume = 1.0;
u.rate = 1.0;
u.onend = function(event) { console.log('Finished in ' + event.elapsedTime + ' seconds.'); };
fallbackSpeechSynthesis.speak(u);