Open ingviso opened 6 years ago
Just in case someone is having troubles here is how I made it work
Get all albums with the name. If there are not then create and save the new asset in it, otherwise take the first one (hence its an array) and save the media in it.
For images just change the videos params in createAssets to videos
saveToCameraRollVideo = (url) =>
RNPhotosFramework.getAlbumsByTitle('TestAlbum').then((response) => {
const {albums} = response;
if(albums.length ===0) {
return RNPhotosFramework.createAlbum('TestAlbum').then((album) => {
return RNPhotosFramework.createAssets({
album: album,
videos: [{
uri: url
}]
})
});
} else {
return RNPhotosFramework.createAssets({
album: albums[0],
videos: [{
uri: url
}]
})
}
});
I'm trying to save a video into a specific album, I use similar structure for the images and that works but the videos do not get saved into a album. This is on ios. I get the uri and the album but
In the createasset code below
I get the media as
and videos as
then when runnnig result become com up with assets as empty
Am I not using this correctly or should I rather be using RCTCameraRollRNPhotosFrameworkManager.createVideoAsset(videoWithUriProp); and then album.addAssetToAlbum(asset).then((status) => {}); ?