react-native-audio-recorder-player
react-native-audio-recorder-player copied to clipboard
How to play audio before stop recording?
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.
Version of react-native-audio-recorder-player 3.5.3
Version of React Native 0.69.3
Platforms you faced the error (IOS or Android or both?) both
Expected behavior
audio should be play before stop recording
Actual behavior
audio file is not playing before stop recording
I am developing a chat application in which I want to implement audio record feature like whatsapp, when I call startRecorder
it gives me the path of audio file, I want to play it when user pause recording, but it dont play any audio and dont giving any warning and error also.
if I call stopRecorder
it also gives the file path and then I can play audio file but now I can not add more content to that file,
Were you able to find out any solution?
const dirs = RNFetchBlob.fs.dirs.DocumentDir;
const audioFileName = "sound.aac";
const audioPath = "file://" + dirs + `/${audioFileName}`;
const path = Platform.select({
ios: audioPath,
android: undefined
});
This helped me
Hey, even I was not able to play audio without stopping but it was working for the audio config shared in the example.
` import AudioRecorderPlayer, { AVEncoderAudioQualityIOSType, AVEncodingOption, AudioEncoderAndroidType, AudioSet, AudioSourceAndroidType, OutputFormatAndroidType, } from 'react-native-audio-recorder-player';
const audioSet: AudioSet = { AudioEncoderAndroid: AudioEncoderAndroidType.AAC, AudioSourceAndroid: AudioSourceAndroidType.MIC, AVEncoderAudioQualityKeyIOS: AVEncoderAudioQualityIOSType.high, AVNumberOfChannelsKeyIOS: 2, AVFormatIDKeyIOS: AVEncodingOption.aac, OutputFormatAndroid: OutputFormatAndroidType.AAC_ADTS, };
// inside my react native component audioRecorderPlayer.startRecorder(undefined, audioSet)
`
Is there a fix for this yet? because I'm having the exact same issue
const dirs = RNFetchBlob.fs.dirs.DocumentDir; const audioFileName = "sound.aac"; const audioPath = "file://" + dirs + `/${audioFileName}`; const path = Platform.select({ ios: audioPath, android: undefined });
This helped me
I did exactly this, However, if you continue recording and pause again and you decide to listen to the audio. the end will be cut off.
do you have any fix for this?