0
如何從「相冊」的相冊播放電影?我不想使用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];