- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
メソッドで、ビデオの URL を取得して再生できます。
@property (nonatomic,retain) MPMoviePlayerController *moviePlayerController;
if ([mediaType isEqualToString:@"public.movie"])
{
NSURL *aURL = [info objectForKey:UIImagePickerControllerMediaURL];//get the url
// and init the video player using this url
_moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:aURL];
[self.view _moviePlayerController.view];
_moviePlayerController.useApplicationAudioSession = NO;
_moviePlayerController.fullscreen = YES;
[_moviePlayerController play];
}
もちろん、インポートする必要がありますMediaPlayer.framework
編集:現在、Cocoa プロジェクトの大部分は を使用しているため、上記のコードではインスタンスを自分arc
で保持する必要があります(この回答で述べたように)。MPMoviePlayerController