MediaLibrary.getAssetsAsync with moment as album will result Error: Couldn't find album

SDK Version: 41
Platforms(Android/iOS/web/all): iOS

I’m trying to get assets inside the moment so I did like below.

const mediaType = [MediaLibrary.MediaType.photo, MediaLibrary.MediaType.video]
const albums = await MediaLibrary.getMomentsAsync()
albums.map(async album => {
  const assets = await MediaLibrary.getAssetsAsync({ album, mediaType })
})

This will raise error.

backend.js:32 Possible Unhandled Promise Rejection (id: 247):
Error: Couldn't find album
Error: Couldn't find album
    at Object.promiseMethodWrapper [as callMethod] (http://192.168.1.35:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false&minify=false:2765:36)
    at Object.NativeModulesProxy.<computed>.<computed> [as getAssetsAsync] (http://192.168.1.35:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false&minify=false:99502:30)
    at getAssetsAsync$ (http://192.168.1.35:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false&minify=false:281440:77)
    at tryCatch (http://192.168.1.35:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false&minify=false:29050:19)
    at Generator.invoke [as _invoke] (http://192.168.1.35:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false&minify=false:29223:24)
    at Generator.next (http://192.168.1.35:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false&minify=false:29093:23)
    at tryCatch (http://192.168.1.35:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false&minify=false:29050:19)
    at invoke (http://192.168.1.35:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false&minify=false:29123:22)
    at http://192.168.1.35:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false&minify=false:29153:13
    at tryCallTwo (http://192.168.1.35:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false&minify=false:3953:7)

I also tried to pass the ID string as an album await MediaLibrary.getAssetsAsync({ album: album.id, mediaType }) but it still raises error.
I can get the assets from the normal albums (from MediaLibrary.getAlbumsAsync) without any problem.

Is this a bug? or am I missing something?

Hey @foloinfo, could you provide a runnable reproduction of this in a Snack so we can quickly run and test it on our end?

Cheers,
Adam

Hi @adamjnav thanks for reply.

I made a reproduction with snack here.

If you change getMomentsAsync to getAlbumsAsync it works fine.
It returns album but not the assets, I confirmed it with virtual machine and actual device (iOS).

Thanks

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.