You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi!
I have a problem on Android device . SpeechRecognition listener is not executed and I cannot fetch recorded text... Could you take a look at my component?
import{SpeechRecognition}from'@capacitor-community/speech-recognition';import{Box}from'@chakra-ui/react';import{FC,useEffect,useState}from'react';import'../SentenceSpeakExercise.css';exportinterfaceSentenceSpeakExerciseNativeProps{recordingActive: boolean|null;onRecordingFinished: ()=>void;onRecordAvailable: (sentence: string)=>void;}exportconstSentenceSpeakExerciseNative: FC<SentenceSpeakExerciseNativeProps>=({ recordingActive, onRecordAvailable })=>{const[nativeSpeechRecognitionAvailable,setNativeSpeechRecognitionAvailable]=useState<boolean|null>(false);useEffect(()=>{SpeechRecognition.available().then((result)=>setNativeSpeechRecognitionAvailable(result.available)).catch((err)=>{console.log('SpeechRecognition.available() failed:',err);});},[]);conststartRecording=async()=>{try{console.log('start recording...');// I can see this in logsawaitSpeechRecognition.requestPermissions();SpeechRecognition.addListener('partialResults',(data)=>{// this is not executed....console.log('partialResults was fired',JSON.stringify(data));onRecordAvailable('FIXME');});awaitSpeechRecognition.start({language: 'en-US',maxResults: 1,prompt: '',partialResults: true,popup: false,});}catch(error){console.error('Error starting recording:',error);}};conststopRecording=async()=>{try{console.log('stop recording...');SpeechRecognition.removeAllListeners();awaitSpeechRecognition.stop();}catch(error){console.error('Error stopping recording:',error);}};useEffect(()=>{if(recordingActive){startRecording();}else{stopRecording();}// Clean up listeners when component unmounts or recordingActive changesreturn()=>{SpeechRecognition.removeAllListeners();};},[recordingActive]);return(<Box>{nativeSpeechRecognitionAvailable &&<Box>nativespeechready</Box>}
{nativeSpeechRecognitionAvailable===false&&<Box>nativenotavailable</Box>}</Box>);};
Could you help me and tell is it bug in plugin or my mistake?
Hi!
I have a problem on Android device . SpeechRecognition listener is not executed and I cannot fetch recorded text... Could you take a look at my component?
Could you help me and tell is it bug in plugin or my mistake?
Used versions:
The text was updated successfully, but these errors were encountered: