Add TTS support

This commit is contained in:
Gareth Latty
2016-07-20 16:44:30 +01:00
parent 15e92a69ea
commit 7d56015c31
9 changed files with 105 additions and 5 deletions
+9
View File
@@ -33,6 +33,15 @@ function start(url, version) {
}
});
if ('speechSynthesis' in window) {
game.ports.say.subscribe(function (text) {
window.speechSynthesis.cancel();
var utterance = new SpeechSynthesisUtterance(text);
utterance.lang = "en-GB";
window.speechSynthesis.speak(utterance);
});
}
game.ports.qr.subscribe(function (idAndValue) {
new QRCode(document.getElementById(idAndValue.id), {
text: idAndValue.value,