I’ve downloaded and run the code from the recording app example (http://expo.io/@community/record, GitHub - expo/audio-recording-example: Audio Recording Example).
It’s up and running on an emulator and working fine. I have a requirement for a project to use .amr files.
When I change the config to use .amr encoding, on clicking play in the app I receive error:
[Unhandled Promise rejection: Error: java.lang.IllegalStateException: mSimpleExoPlayer is null!]
- node_modules\react-native\Libraries\BatchedBridge\NativeModules.js:117:42 in createErrorFromErrorData
- node_modules\react-native\Libraries\BatchedBridge\NativeModules.js:80:57 in <unknown>
The only code i have changed is this line:
this.recordingSettings = JSON.parse(JSON.stringify(Audio.RECORDING_OPTIONS_PRESET_HIGH_QUALITY));
To use the following options:
const rs = {
android: {
extension: '.amr',
outputFormat: Audio.RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_AMR_NB,
audioEncoder: Audio.RECORDING_OPTION_ANDROID_AUDIO_ENCODER_AMR_NB,
sampleRate: 8000,
numberOfChannels: 1,
bitRate: 128000,
},
ios: {
extension: '.amr',
outputFormat: Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_AMR,
audioQuality: Audio.RECORDING_OPTION_IOS_AUDIO_QUALITY_HIGH,
sampleRate: 8000,
numberOfChannels: 1,
bitRate: 128000,
linearPCMBitDepth: 16,
linearPCMIsBigEndian: false,
linearPCMIsFloat: false,
}
};
this.recordingSettings = JSON.parse(JSON.stringify(rs));
What am I doing wrong? Are the options wrong for recording, so the player won’t initialise correctly when trying to play the file?