【发布时间】:2012-03-17 18:36:14
【问题描述】:
我一直在试图弄清楚如何在我的电影视图顶部获得“播放符号”,以便用户只需按下它,视频就会开始播放。有人知道如何实现吗?
-(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;
}
【问题讨论】:
标签: objective-c ios5 xcode4.2 mpmovieplayercontroller