感谢您的帮助,我有一个电影播放器,我想阻止用户向前浏览电影,但我不在乎他们是否向后(倒带)。我正在检测播放状态何时发生变化,然后测试“MPMoviePlayerDidSeekingForward”
问题是,无论方向如何,当我擦洗时,playbackState 总是在向前搜索。
由于各种原因,我无法制作自己的自定义播放器,我需要使用标准的 MPMoviePlayer。
这是代码:
- (void)moviePlayerPlaybackStateDidChangeNotificationReceived:(NSNotification *)notification {
//movie playback has started go to full screen.
if(_player.fullscreen == NO){
_player.fullscreen = YES;
}
//prevent user from scrubbing through the movie
// #ifdef DEBUG
//
// return;
// #else
if(_player.playbackState == MPMoviePlaybackStateSeekingForward){
NSString *alertMessage = [NSString stringWithFormat:@"you are not allowed to skip the movies"
UIAlertView *alert =
[[UIAlertView alloc] initWithTitle: @"Warning"
message: alertMessage
delegate: self
cancelButtonTitle: @"Continue"
otherButtonTitles: @"Stop", nil];
self.isShowing = YES;
[alert show];
[_player pause];
_player.fullscreen = NO;
}
// #endif