开发者

MPMoviePlayerController does not respond to setFullscreen = NO

I'm creating a custom MovieController using MPMovieController as base. I can switch the video to full-screen by calling

_[moviePlayer setFullscreen:YES animated:YES];_

Calling the same function ([moviePlayer setFullscreen:NO animated:YES];) to bring the movie-player back to the original state (ie when user press Done button) does not work.

As an alternative, I've also tried to -

a) listening to MPMoviePlayerDidExitFullscreenNotification and calling moviePlayBackDidFinish: function as a result of this.

b) posting my custom notification from inside "Don开发者_如何转开发e" function using this -

NSDictionary *thisDictionary = [NSDictionary dictionaryWithObject:[NSNumber numberWithInt:MPMovieFinishReasonUserExited] forKey:MPMoviePlayerPlaybackDidFinishReasonUserInfoKey];  
[[NSNotificationCenter defaultCenter] postNotificationName:MPMoviePlayerDidExitFullscreenNotification object:moviePlayer userInfo:thisDictionary];

But in all these cases, the movie-player view does not come back to its original state.

Help Please.

Thanks!


You have to register notification for the event. When you prepare for to play the video, do like this

  [[NSNotificationCenter defaultCenter] addObserver:self 
                        selector:@selector(moviePlayBackDidFinish:) 
                        name:MPMoviePlayerPlaybackDidFinishNotification 
                        object:nil];

and in your moviePlayBackDidFinish selector, do like this

  [[UIApplication sharedApplication] setStatusBarHidden:YES];
  [[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification 
        object:nil];


[self dismissModalViewControllerAnimated:YES];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜