- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
NSURL *videoURL = [info objectForKey:UIImagePickerControllerMediaURL];
//get the videoURL
NSString *tempFilePath = [videoURL path];
if ( UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(tempFilePath))
{
// Copy it to the camera roll.
UISaveVideoAtPathToSavedPhotosAlbum(tempFilePath, self, @selector(video:didFinishSavingWithError:contextInfo:), tempFilePath);
}
//NSURL *movieUrl = [NSURL fileURLWithPath:filePath];
_videoPlayer = [[MPMoviePlayerController alloc] initWithContentURL:videoURL];
_videoPlayer.view.frame = CGRectMake(kMarginWidth, kMarginWidth, kMPlayerWidth, kMPlayerHeight);
// Here is where you set the control Style like fullscreen or embedded
_videoPlayer.controlStyle = MPMovieControlStyleDefault;
_videoPlayer.scalingMode = MPMovieScalingModeAspectFit;
_videoPlayer.contentURL = videoURL;
self addSubview:_videoPlayer];
}
ただし、videoPlayer は機能せず、画面に「動画の読み込み中」が数秒間表示されるだけです。
保存した動画の再生方法を教えてください。または、アルバムに保存されたビデオのパスを取得する方法は?