问题:app
在视频播放时,如今控制条采用磨砂的效果,会遮罩部分视频spa
解决思路视频
1 播放器直接设置不带控制条,在app在 Foreground状态,默认播放器暂停,这样须要在得到Foreground事件,进行设置播放server
- (void) viewWillAppear:(BOOL)animated{ 事件
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appWillEnterForegroundNotification) name:UIApplicationWillEnterForegroundNotification object:nil]; rem
} string
- (void) appWillEnterForegroundNotification{ io
NSLog(@"trigger event when will enter foreground."); event
} class
-(void) viewDidDisappear:(BOOL)animated{
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
2 直接侦听播放器准备播放通知,在通知中设置播放器带控制条
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayBackDidFinish:)
name:MPMoviePlayerReadyForDisplayDidChangeNotification
object:player];
- (void) moviePlayBackDidFinish:(NSNotification*)notification
{
player.controlStyle =MPMovieControlStyleEmbedded;
[[NSNotificationCenter defaultCenter]removeObserver:self name:MPMoviePlayerReadyForDisplayDidChangeNotification object:player];
}