Skip to content

0.4.0

Latest
Compare
Choose a tag to compare
@janantala janantala released this 21 May 22:27
· 2 commits to master since this release

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