I'm trying to fetch all the songs on a user's phone using expo-media-library like this:
const getAudioFiles = async () => {
let media = await MediaLibrary.getAssetsAsync({
mediaType: "audio",
});
media = await MediaLibrary.getAssetsAsync({
mediaType: "audio",
first: media.totalCount,
});
setTotalAudioCount(media.totalCount);
setAudioFiles([...audioFiles, ...media.assets]);
};
It fetches successfully on android, but on an iPhone, it returns an empty array with no errors (but there are actually audio files on the phone!)
Any help on this will be really appreciated
Changed
mediaType