From 33a704981e110b5ec5a2ea6098f298dca1afe636 Mon Sep 17 00:00:00 2001 From: Lucas Fialho Zawacki Date: Wed, 10 Apr 2024 11:33:10 -0300 Subject: [PATCH] feat(captions): Remove speechVoices check before transcription --- .../audio/captions/button/component.jsx | 2 +- .../audio/captions/select/component.jsx | 2 +- .../components/audio/captions/speech/service.js | 15 +-------------- 3 files changed, 3 insertions(+), 16 deletions(-) diff --git a/bigbluebutton-html5/imports/ui/components/audio/captions/button/component.jsx b/bigbluebutton-html5/imports/ui/components/audio/captions/button/component.jsx index 65c1a0fc1a..beff71abe2 100644 --- a/bigbluebutton-html5/imports/ui/components/audio/captions/button/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/audio/captions/button/component.jsx @@ -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, diff --git a/bigbluebutton-html5/imports/ui/components/audio/captions/select/component.jsx b/bigbluebutton-html5/imports/ui/components/audio/captions/select/component.jsx index 0d92090653..0ac175f3de 100644 --- a/bigbluebutton-html5/imports/ui/components/audio/captions/select/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/audio/captions/select/component.jsx @@ -122,7 +122,7 @@ const Select = ({ key={v} value={v} > - {intl.formatMessage(intlMessages[v])} + {intlMessages[v] ? intl.formatMessage(intlMessages[v]) : v} ))} diff --git a/bigbluebutton-html5/imports/ui/components/audio/captions/speech/service.js b/bigbluebutton-html5/imports/ui/components/audio/captions/speech/service.js index 66750d1078..ac9e948774 100644 --- a/bigbluebutton-html5/imports/ui/components/audio/captions/speech/service.js +++ b/bigbluebutton-html5/imports/ui/components/audio/captions/speech/service.js @@ -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;