如何从“照片”的相册播放电影?我不想使用 UIImagePickerController 来浏览电影,但我希望能够在下面的代码中指定电影的名称(或某种 id)来播放它。下面的代码在本地播放视频。如何修改路径以播放“照片”应用中存储的名为“视频”的相册中的视频?非常感谢您的帮助。
NSString *url = [[NSBundle mainBundle]
pathForResource:@"Movie1"
ofType:@"MOV"];
MPMoviePlayerViewController *playerViewController =
[[MPMoviePlayerViewController alloc]
initWithContentURL:[NSURL fileURLWithPath:url]];
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(movieFinishedCallback:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:[playerViewController moviePlayer]];
[playerViewController.view setFrame: self.view.bounds];
[self.view addSubview:playerViewController.view];
MPMoviePlayerController *player = [playerViewController moviePlayer];
[player play];
[playerViewController release];