Reputation: 117
I am using Expo MediaLibrary to get videos from a specific folder and I am facing this problem.
MediaLibrary.getAssetsAsync() shows there are no media inside an album. while there are media inside the folder.
Code:
let album = await MediaLibrary.getAlbumAsync("GrabTube")
console.log(album )
let assets = await MediaLibrary.getAssetsAsync({album:album })
console.log(assets)
response:
Object {
"assetCount": 1,
"id": "876214992",
"title": "GrabTube",
}
Object {
"assets": Array [],
"endCursor": "0",
"hasNextPage": false,
"totalCount": 0,
}
In the first console.log, it shows there is one item/asset inside the folder. But as shown inside the second console.log it shows the folder is empty.
Is there any fix for this?
Upvotes: 1
Views: 1552
Reputation: 51
For some reason it's necessary to define the mediaType even when you have already defined the album...
to me the solution was change from :
let assets = await MediaLibrary.getAssetsAsync({album:album })
to:
let assets = await MediaLibrary.getAssetsAsync({album:album, mediaType:'audio' })
Upvotes: 2