You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I load the library by default for different distributions, had to make a change so the library does not cause errors.
Would this be valid for a PR ?
if (window.hasOwnProperty('speechSynthesis')) {
speechSynthesis.getVoices();
} else {
console.error('this browser does not support speechSyntesis');
return false;
}
if (window.hasOwnProperty('webkitSpeechRecognition')) {
var reconocimiento = new webkitSpeechRecognition();
} else {
console.error('this browser does not support webkitSpeechRecognition');
return false;
}
The text was updated successfully, but these errors were encountered:
artyom shouldn't generate any error when loaded from unsupported browsers (if it does, you are triggering some function of Artyom that use the APIs without verifying if they're supported or not). To verify if the browser supports any of the APIs use respectively the methods recognizingSupported (for voice commands) and speechSupported (for voice synthesis):
functionTalk(text){if(!artyom.speechSupported()){console.log("Cannot talk");return;}artyom.say(text);}functionStartRecognition(){if(!artyom.recognizingSupported()){console.log("Cannot process commands");return;}artyom.initialize({lang:"en-GB",continuous:true,debug:true,soundex:true,listen:true}).then(function(){console.log("Artyom is listening !");});}
It shouldn't return false because there are other functions used by developers like simulateInstruction, besides some browsers provide partial support for only one of the APIs, that means that returning false when the browser doesn't support Speech Synthesis would leave out the Speech Recognition and there won't be support for voice commands.
I load the library by default for different distributions, had to make a change so the library does not cause errors.
Would this be valid for a PR ?
The text was updated successfully, but these errors were encountered: