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) => (
{
icon: '',
label: intl.formatMessage(intlMessages[availableVoice]),
label: intlMessages[availableVoice] ? intl.formatMessage(intlMessages[availableVoice]) : availableVoice,
key: availableVoice,
iconRight: selectedLocale.current === availableVoice ? 'check' : null,
customStyles: (selectedLocale.current === availableVoice) && Styled.SelectedLabel,

View File

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

View File

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