0
我一直在試圖弄清楚如何讓我的電影視圖上的「播放符號」,以便用戶只需按下該按鈕,視頻就會開始播放。任何人都知道如何實現?電影播放器iOS5在視圖上播放符號
-(void)viewDidLoad
{
//Video player
NSString *url = [[NSBundle mainBundle] pathForResource:self.navigationItem.title ofType:@"mov"];
_player = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath: url]];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playerPlaybackDidFinish:) name:MPMoviePlayerPlaybackDidFinishNotification object:_player];
_player.view.frame = CGRectMake(350, 200, 400, 400);
[self.view addSubview:_player.view];
}
//Plays the movie once the "Play" button is pressed
-(IBAction)playMovie
{
[_player play];
}
//Exits fullscreen when movie is finished
- (void) playerPlaybackDidFinish:(NSNotification*)notification
{
_player.fullscreen = NO;
}