feat(captions): Remove speechVoices check before transcription
This commit is contained in:
parent
8374e8b21a
commit
33a704981e
@ -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,
|
||||
|
@ -122,7 +122,7 @@ const Select = ({
|
||||
key={v}
|
||||
value={v}
|
||||
>
|
||||
{intl.formatMessage(intlMessages[v])}
|
||||
{intlMessages[v] ? intl.formatMessage(intlMessages[v]) : v}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user