1 year ago
#269974
aurelien_morel
How to convert a .m4a file to a .wav file on Android using React Native?
I am trying to convert a .m4a file that I record using expo-audio into a .wav file. The goal is then to use it as a blob to send it on a Google Cloud Storage. I tried to do this using ffmpeg-kit-react-native:
const uri = recording.getURI();
console.log(uri);
if (Platform.OS === 'android') {
FFmpegKit.execute(`-i ${uri} temp.wav`).then(async (session) => {
// const returnCode = await session.getReturnCode();
uri = 'temp.wav';
});
}
const response = await fetch(uri);
const blob = await response.blob();
but I have no sucess (getting the error):
TypeError: null is not an object (evaluating 'FFmpegKitReactNativeModule.ffmpegSession')
uri have this form:
file:///data/user/0/host.exp.exponent/cache/ExperienceData/%2540aamorel%252Fvoki/Audio/recording-4038abed-f264-48ca-a0cc-861268190874.m4a
I am not sure if I use the FFmpeg toolkit correctly. Do you know how to make this work ? Or is there a simpler way to do it ?
react-native
ffmpeg
expo
wav
m4a
0 Answers
Your Answer