Hardcoded tts and stt to english.
This commit is contained in:
parent
6099fc651c
commit
6250645fa4
@ -84,7 +84,7 @@ class STTButton extends HTMLElement {
|
|||||||
this._recognition = new SpeechRecognition();
|
this._recognition = new SpeechRecognition();
|
||||||
this._recognition.continuous = true;
|
this._recognition.continuous = true;
|
||||||
this._recognition.interimResults = true;
|
this._recognition.interimResults = true;
|
||||||
this._recognition.lang = navigator.language || 'en-US';
|
this._recognition.lang = 'en-US';
|
||||||
|
|
||||||
this._recognition.onstart = () => {
|
this._recognition.onstart = () => {
|
||||||
this._isListening = true;
|
this._isListening = true;
|
||||||
|
|||||||
@ -99,13 +99,7 @@ class TTSButton extends HTMLElement {
|
|||||||
|
|
||||||
console.log('TTS: Loaded', this._voices.length, 'voices');
|
console.log('TTS: Loaded', this._voices.length, 'voices');
|
||||||
|
|
||||||
const lang = navigator.language || 'en-US';
|
this._selectedVoice = this._voices.find(v => v.lang === 'en-US');
|
||||||
const langPrefix = lang.split('-')[0];
|
|
||||||
|
|
||||||
this._selectedVoice = this._voices.find(v => v.lang === lang);
|
|
||||||
if (!this._selectedVoice) {
|
|
||||||
this._selectedVoice = this._voices.find(v => v.lang.startsWith(langPrefix));
|
|
||||||
}
|
|
||||||
if (!this._selectedVoice) {
|
if (!this._selectedVoice) {
|
||||||
this._selectedVoice = this._voices.find(v => v.lang.startsWith('en'));
|
this._selectedVoice = this._voices.find(v => v.lang.startsWith('en'));
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user