Iphone MPMoviePlayer Notification
I am using a MpMoviePlayerController To play video in my aap. I want to handle the notification sent by tapping the control button displayed in the red circle in below image.
alt text http://grab.by/5iOY
Can any one help me out which notification does this control button fires???
UPdates: I tried it in this way,
NSString * filePath = [[NSBundle mainBundl开发者_运维问答e] pathForResource:@"Movie" ofType:@"m4v"];
NSURL *url = [NSURL fileURLWithPath:filePath];
self.player = [[[MPMoviePlayerViewController alloc] initWithContentURL:url] autorelease];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(movieDidExitFullScreen:)
name:MPMoviePlayerDidExitFullscreenNotification
object:self.player.moviePlayer];
[self.window addSubview:self.player.view];
And the function in selector is:
-(void)movieDidExitFullScreen:(id)sender{
NSLog(@"Movie player did exit full screen");}
But the function never gets called when tapping the control button.
Please let me know if m doing some thing wrong.
Regards,
Nic
your selector function should be like this
-(void)movieDidExitFullScreen:(NSNotification *)notification
I believe this will generate the MPMoviePlayerScalingModeDidChangeNotification
. When you receive the notification, you should check the value of the scalingMode
property to determine which scaling mode the player was switched to.
Update:
Looking at the documentation for the MPMoviePlayerController
(more specifically, the MPMovieControlStyle
enumeration), the button you want to handle seems to be the switch between embedded and full-screen view. This one should generate MPMoviePlayerWillEnterFullscreenNotification
(and the corresponding WillExit
and DidEnter
/DidExit
notifications).
精彩评论