使用URL显示电影

时间:2013-09-06 04:18:58

标签: ios cocoa-touch uiimagepickercontroller mpmovieplayercontroller

我正在使用自定义相机覆盖来捕捉视频。我试图在另一个视图中显示用户拍摄的视频,但它无法正常工作。我正在使用此代码获取URL

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {

self.movieURL = info[UIImagePickerControllerMediaURL];
NSLog(@"Createing testing");

[picker dismissViewControllerAnimated:YES completion:NULL];}

这就是显示它

self.movieController = [[MPMoviePlayerController alloc] init];
[self.movieController setContentURL:self.movieURL];

[self.movieController.view setFrame:CGRectMake ( 0, 0, 320, 568)];

[self.view addSubview:self.movieController.view];

[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(moviePlayBackDidFinish:)
                                             name:MPMoviePlayerPlaybackDidFinishNotification
                                           object:self.movieController];

[self.movieController play];

1 个答案:

答案 0 :(得分:0)

您可以使用此

获取视频网址
self.movieURL =  [info objectForKey:UIImagePickerControllerMediaURL];
NSLog(@">>>>>>>>>>> Url %@", [self.movieURL absoluteString]);