How do i write video to iphone camera roll using AVFoundation?
I am currently recording video using AVFoundation api and have specified a fileUrl to write to:
NSURL *fileUrl = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@%@", NSTemporaryDirectory(), @"output.mov"]];
However, right now its recording to a temp directory. How do i write this file to the camera roll? Whats 开发者_StackOverflowthe camera roll directory?
Thanks!
After recording to the disk do the following to copy the video to Camera Roll
if (UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(outFileName)) {
UISaveVideoAtPathToSavedPhotosAlbum(outFileName, self, @selector(video:didFinishSavingWithError: contextInfo:), nil);
}
Note that UIVideoAtPathIsCompatibleWithSavedPhotosAlbum() will be successful only of the recorded video is proper QuickTIme format.
I found some documentation on Apples site from the AVCamDemo code.
精彩评论