1
AVCaptureVideoDataOutput
から取得したビデオをAVAsset
と保存する場合は、以下のようにwriteVideoAtPathToSavedPhotosAlbum
を使用しています。写真アルバムに保存されたビデオの情報をURLで取得します。
UIImagePickerController
を使用する際には、以下に取得するように戻って「保存された動画情報を」取得したい動画を保存した後しかし
NSString* filename = [NSString stringWithFormat:@"capture%d.mp4", _currentFile];
NSString* path = [NSTemporaryDirectory() stringByAppendingPathComponent:filename];
NSURL* url = [NSURL fileURLWithPath:path];
dispatch_async(dispatch_get_main_queue(), ^{
[_encoder finishWithCompletionHandler:^{
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
[library writeVideoAtPathToSavedPhotosAlbum:url completionBlock:^(NSURL *assetURL, NSError *error){
NSLog(@"save completed");
}];
}];
});
。
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[picker dismissViewControllerAnimated:YES completion:NULL];
NSLog(@"there");
// Handle a movie capture
NSString *type = info[UIImagePickerControllerMediaType];
NSURL *videoURL = info[UIImagePickerControllerMediaURL];
//do things with that info
}