I'm trying to record some video and save it into a photo gallery.
Unfortunately, I am getting an error. I thought that video could be saved into
a photo gallery and I see that some of my other videos are included in the
photo gallery. I am calling a static method on UIVideo to see if the video is
compatible with my local photo gallery (I thought I was supposed to do this).
Unfortunately, the result always comes back false. If I take out this check,
when I call the SaveToPhotosAlbum, I get an NSError. Is there a better way to
save a video to a photo album? Any thoughts are appreciated.
Wally
public class VideoImagePickerDelegate : UIImagePickerControllerDelegate
{
Video _vi;
public VideoImagePickerDelegate(Video vi)
{
_vi = vi;
}
public override void Canceled (UIImagePickerController picker)
{
_vi.DismissModalViewControllerAnimated(true);
Console.WriteLine ("Cancelled picking an image");
}
public override void FinishedPickingMedia (UIImagePickerController
picker, NSDictionary info)
{
_vi.DismissModalViewControllerAnimated(true);
Console.WriteLine ("Did finish picking media");
var originalImage = new
NSString("UIImagePickerControllerMediaURL");
// use this code to
foreach( var key in info.Keys)
{
Console.WriteLine(key + " = " + info[key]);
}
var path = (info[originalImage] as NSUrl).ToString();
var isCompat =
UIVideo.IsCompatibleWithSavedPhotosAlbum(path);
if (isCompat)
{
UIVideo.SaveToPhotosAlbum(path, delegate(string
p, NSError error) {
if ( error == null )
{
Console.WriteLine("Saved");
}
else
{
Console.WriteLine("Error in
saving.");
}
} );
}
}
}
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch