Open jibo001 opened 2 weeks ago
Please fill the template to help you out. Also, please try the Example project compare before submiting the issue when you have certain issue with your project setup.
Example
"react-native-audio-recorder-player": "^3.6.12",
"react-native": "0.73.7",
android
when i press button fast will throw the error
const onStartRecord = useCallback(async () => { if (!audioRecorderPlayer) return setVoiceId('') try { audioRecorderPlayer.stopPlayer() audioRecorderPlayer.stopRecorder() audioRecorderPlayer.removePlayBackListener() audioRecorderPlayer.removeRecordBackListener() } catch (e: any) { ChatError.error('onStartRecord stopRecords', e.message) } finally { const audioSet: AudioSet = { AudioEncoderAndroid: AudioEncoderAndroidType.AAC, AudioSourceAndroid: AudioSourceAndroidType.MIC, AVEncoderAudioQualityKeyIOS: AVEncoderAudioQualityIOSType.high, AVNumberOfChannelsKeyIOS: 2, AVFormatIDKeyIOS: AVEncodingOption.aac, OutputFormatAndroid: OutputFormatAndroidType.AAC_ADTS, } try { Vibration.vibrate() await audioRecorderPlayer.startRecorder( path, audioSet, ) setModalVisible(true) audioRecorderPlayer.addRecordBackListener((e: RecordBackType) => { const _remain = Math.floor(MAX_DURATION - e.currentPosition / 1000) if (_remain <= NOTICE_DURATION && _remain >= 0) { if (_remain === 0) { onStopRecord() } setRemainSeconds(_remain) } duration.current = e.currentPosition }) } catch (e: any) { audioRecorderPlayer.stopRecorder() ChatError.error('onStartRecord', e.message) } } }, [audioRecorderPlayer])
the error occur afeter stopRecorder throw stop fail.
recode less than 1 seconds will throw stop fail
"react-native-audio-recorder-player": "^3.6.12",
"react-native": "0.73.7",
android
when i press button fast will throw the error
const onStartRecord = useCallback(async () => { if (!audioRecorderPlayer) return setVoiceId('') try { audioRecorderPlayer.stopPlayer() audioRecorderPlayer.stopRecorder() audioRecorderPlayer.removePlayBackListener() audioRecorderPlayer.removeRecordBackListener() } catch (e: any) { ChatError.error('onStartRecord stopRecords', e.message) } finally { const audioSet: AudioSet = { AudioEncoderAndroid: AudioEncoderAndroidType.AAC, AudioSourceAndroid: AudioSourceAndroidType.MIC, AVEncoderAudioQualityKeyIOS: AVEncoderAudioQualityIOSType.high, AVNumberOfChannelsKeyIOS: 2, AVFormatIDKeyIOS: AVEncodingOption.aac, OutputFormatAndroid: OutputFormatAndroidType.AAC_ADTS, } try { Vibration.vibrate() await audioRecorderPlayer.startRecorder( path, audioSet, ) setModalVisible(true) audioRecorderPlayer.addRecordBackListener((e: RecordBackType) => { const _remain = Math.floor(MAX_DURATION - e.currentPosition / 1000) if (_remain <= NOTICE_DURATION && _remain >= 0) { if (_remain === 0) { onStopRecord() } setRemainSeconds(_remain) } duration.current = e.currentPosition }) } catch (e: any) { audioRecorderPlayer.stopRecorder() ChatError.error('onStartRecord', e.message) } } }, [audioRecorderPlayer])