0
處理播放器按鈕
我加入這個代碼:在MPMoviePlayer
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(loadMoviePlayerStateChanged:)
name:MPMoviePlayerLoadStateDidChangeNotification
object:self.mp];
它激發我MPMoviePlayer的每一個狀態變化,這個功能:
- (void) loadMoviePlayerStateChanged:(NSNotification*)notification
{
MPMoviePlayerController *Player = notification.object;
MPMoviePlaybackState playbackState = Player.playbackState;
if (playbackState == MPMoviePlaybackStateSeekingForward)
{
NSLog(@"Forward");
}
else if (playbackState == MPMoviePlaybackStateSeekingBackward)
{
NSLog(@"Backward");
}
}
進入此功能...
但問題是與MPMoviePlaybackState playbackState = Player.playbackState;
當我啓動玩家時,playerState爲1,其他所有更改都爲0. - 這怎麼可能?
編輯:
這也是每次執行給零:
NSNumber *reason = [notification.userInfo objectForKey:MPMoviePlayerPlaybackDidFinishReasonUserInfoKey];
if ([reason intValue] == MPMoviePlaybackStateSeekingForward) {
// done button clicked!
}
你想要加載狀態的電影播放器或播放狀態? –