Permalink
Browse files

generated web speech not as good

keep it for offline use only
  • Loading branch information...
stoyan committed Mar 14, 2018
1 parent 33743a8 commit 4f34bf1ab636ad70310a821ae78e097c56c072a6
Showing with 3 additions and 4 deletions.
  1. +3 −4 src/App.js
@@ -92,7 +92,7 @@ function getAnswer(i) {
}

function getAudio() {
if (webvoices){
if (webvoices && navigator.onLine === false) {
return [];
}
const word = justLetters(term[0]);
@@ -163,14 +163,13 @@ class App extends Component {
say() {
this.pause();
this.setState({pause: false});
if (webvoices) {
if (webvoices && navigator.onLine === false) {
const u = new SpeechSynthesisUtterance(term[0]);
u.voice = webvoices[Math.floor(Math.random() * webvoices.length)];
speechSynthesis.speak(u);
} else {
this.state.audio[Math.floor(Math.random() * this.state.audio.length)].play();
}

}
}

toggleSettings() {

0 comments on commit 4f34bf1

Please sign in to comment.