I am writing an iOS application using Xamarin and am having an issue getting videos to save to my photo library. I am using the WriteVideoToSavedPhotosAlbum
method of the ALAssetsLibrary
(code below), but the video is never saved. I do no receive an error, but I also do not receive an asset URL in the completion block either.
Does anyone have any idea what could be going on here?
var url = NSUrl.FromFilename (this.FilePath);
ALAssetsLibrary library = new ALAssetsLibrary ();
library.WriteVideoToSavedPhotosAlbum (url, delegate(NSUrl u, NSError e)
{
if (e != null)
{
new UIAlertView ("Error", "Unable to save video to library", null, "Ok").Show();
}
});
One thing to note is the FilePath
value is a video stored in the applications document directory.
Thanks
One thing to note is the FilePath value is a video stored in the applications document directory? What you are looking for exactly? as WriteVideoToSavedPhotosAlbum is use to store video capture using camera because directly we can not get its url so we have to store video or image captured using camera to device first then we can get its url and other information using ALAssetsLibrary
I have done like this and its working for me hope this might help you: