feat(captions): Remove speechVoices check before transcription

This commit is contained in:
Lucas Fialho Zawacki 2024-04-10 11:33:10 -03:00
parent 8374e8b21a
commit 33a704981e
3 changed files with 3 additions and 16 deletions

View File

@ -133,7 +133,7 @@ const CaptionsButton = ({
availableVoices.map((availableVoice) => ( availableVoices.map((availableVoice) => (
{ {
icon: '', icon: '',
label: intl.formatMessage(intlMessages[availableVoice]), label: intlMessages[availableVoice] ? intl.formatMessage(intlMessages[availableVoice]) : availableVoice,
key: availableVoice, key: availableVoice,
iconRight: selectedLocale.current === availableVoice ? 'check' : null, iconRight: selectedLocale.current === availableVoice ? 'check' : null,
customStyles: (selectedLocale.current === availableVoice) && Styled.SelectedLabel, customStyles: (selectedLocale.current === availableVoice) && Styled.SelectedLabel,

View File

@ -122,7 +122,7 @@ const Select = ({
key={v} key={v}
value={v} value={v}
> >
{intl.formatMessage(intlMessages[v])} {intlMessages[v] ? intl.formatMessage(intlMessages[v]) : v}
</option> </option>
))} ))}
</select> </select>

View File

@ -23,20 +23,8 @@ const hasSpeechRecognitionSupport = () => typeof SpeechRecognitionAPI !== 'undef
&& typeof window.speechSynthesis !== 'undefined' && typeof window.speechSynthesis !== 'undefined'
&& VALID_ENVIRONMENT; && VALID_ENVIRONMENT;
const setSpeechVoices = () => {
if (!hasSpeechRecognitionSupport()) return;
Session.set('speechVoices', unique(window.speechSynthesis.getVoices().map((v) => v.lang)));
};
// Trigger getVoices
setSpeechVoices();
const getSpeechVoices = () => { const getSpeechVoices = () => {
if (!isWebSpeechApi()) return LANGUAGES; return LANGUAGES;
const voices = Session.get('speechVoices') || [];
return voices.filter((v) => LANGUAGES.includes(v));
}; };
const getSpeechProvider = () => { const getSpeechProvider = () => {
@ -79,7 +67,6 @@ const initSpeechRecognition = () => {
if (hasSpeechRecognitionSupport()) { if (hasSpeechRecognitionSupport()) {
// Effectivate getVoices // Effectivate getVoices
setSpeechVoices();
const speechRecognition = new SpeechRecognitionAPI(); const speechRecognition = new SpeechRecognitionAPI();
speechRecognition.continuous = true; speechRecognition.continuous = true;
speechRecognition.interimResults = true; speechRecognition.interimResults = true;