問題: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];
}