I am using expo and I am trying to record on android by using the webm output format ( Expo.Audio.RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_WEBM
). My issue is that I have tried all the different encoders and none of them seem to work. I was expecting that the vorbis encoder would work ( Expo.Audio.RECORDING_OPTION_ANDROID_AUDIO_ENCODER_VORBIS
) but I always get back an exception
{
"tryLoc": "root",
"completion": {
"type": "throw",
"arg": {
"framesToPop": 1,
"code": "E_AUDIO_RECORDING",
"message": "Start encountered an error: recording not started",
"stack": "Error: Start encountered an error: recording not started\n at createErrorFromErrorData (blob:http://172.16.6.80:19001/96c6e3c7-f483-40d9-a3ad-7a7114468a07:2297:17)\n at blob:http://172.16.6.80:19001/96c6e3c7-f483-40d9-a3ad-7a7114468a07:2249:27\n at MessageQueue.__invokeCallback (blob:http://172.16.6.80:19001/96c6e3c7-f483-40d9-a3ad-7a7114468a07:2691:18)\n at blob:http://172.16.6.80:19001/96c6e3c7-f483-40d9-a3ad-7a7114468a07:2436:18\n at MessageQueue.__guardSafe (blob:http://172.16.6.80:19001/96c6e3c7-f483-40d9-a3ad-7a7114468a07:2604:11)\n at MessageQueue.invokeCallbackAndReturnFlushedQueue (blob:http://172.16.6.80:19001/96c6e3c7-f483-40d9-a3ad-7a7114468a07:2435:14)\n at http://172.16.6.80:19001/debugger-ui/debuggerWorker.js:72:58"
}
}
}
This is the configuration that I am trying:
const recording = new Audio.Recording();
debugger;
await recording.prepareToRecordAsync({
android: {
extension: '.webm',
outputFormat: Audio.RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_WEBM,
audioEncoder: Audio.RECORDING_OPTION_ANDROID_AUDIO_ENCODER_VORBIS,
sampleRate: 44100,
numberOfChannels: 2,
bitRate: 128000
},
ios: {
extension: '.wav',
audioQuality: Audio.RECORDING_OPTION_IOS_AUDIO_QUALITY_MAX,
sampleRate: 44100,
numberOfChannels: 2,
bitRate: 128000,
linearPCMBitDepth: 16,
linearPCMIsBigEndian: false,
linearPCMIsFloat: false,
},
});
Any ideas on why that happens and what is the appropriate encoder that I have to use?