Please provide the following:
- SDK Version: 37.0.3
- Platforms(Android/iOS/web/all): Android & iOS
I have recorded an audio file using expo-av for both Android and iOS and I am using the following recording options:
const recordingOptions = {
android: {
extension: '.m4a',
outputFormat: Audio.RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_MPEG_4,
audioEncoder: Audio.RECORDING_OPTION_ANDROID_AUDIO_ENCODER_AAC,
sampleRate: 44100,
numberOfChannels: 2,
bitRate: 128000,
},
ios: {
extension: '.m4a',
outputFormat: Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4AAC,
audioQuality: Audio.RECORDING_OPTION_IOS_AUDIO_QUALITY_MEDIUM,
sampleRate: 44100,
numberOfChannels: 1,
bitRate: 96400,
linearPCMBitDepth: 16,
linearPCMIsBigEndian: false,
linearPCMIsFloat: false,
},
}
I have then used MediaLibrary to save this recorded audio file like in the example below:
const uri = await this.recording.getURI();
const asset = await MediaLibrary.createAssetAsync(uri);
const album = await MediaLibrary.getAlbumAsync("Folder");
if (album === null) {
MediaLibrary.createAlbumAsync("Folder", asset, false);
} else {
MediaLibrary.addAssetsToAlbumAsync([asset], album.id, false);
}
On Android this code works fine and saves the .m4a audio file to the correct folder however on iOS I am getting the following error:
[Unhandled promise rejection: Error: This file type is not supported yet]
I tried changing the iOS file extension to .mp3, .caf and others but still ran into the same issue only on iOS.
I have also found two other threads talking about the same issue but there was no followup or response on what is causing the issue or how to fix it before the threads were closed.
https://forums.expo.dev/t/audio-not-saved-in-ios-gallery/
https://forums.expo.dev/t/audio-recording-not-saving-to-iphone/
Could someone provide some clarification?