MediaLibrary asset Id changed after addAssetsToAlbumAsync


#1

After taking a video, I want to add it to an album and keep its asset id for later use

let asset = await MediaLibrary.createAssetAsync(videoUri);
console.log(asset.id); // 7492, for example

let assets = [];
assets.push(asset);

// given an album
await MediaLibrary.addAssetsToAlbumAsync(assets, album, false);

// now try to retrieve it
let assetInfo = await MediaLibrary.getAssetInfoAsync(asset.id);
// null, not found

But, when I fetch the list of assets in the album using MediaLibrary.getAssetsAsync, I find the video is in the album with an asset id of 7493 (for example). The id has been incremented by 1.

Is this expected behavior? Is there a definitive way to get the actual asset id for an item that has just been added to an album?


#2

Hey @dbruns,

Can you throw this in a Snack so I can try and debug it on my end? Also, is this happening on both platforms?

Cheers,

Adam


closed #3

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