- (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];
}
但是视频播放器不会出现,只能在屏幕上显示“加载电影”几秒钟。
那么有些人可以告诉我如何播放保存的视频吗?或如何检索相册中已保存视频的路径?