views:

394

answers:

4

I'm trying to add custom buttons to the left and right of the standard rewind/play/forward controls in an MPMoviePlayerController view (OS 2.x and up). I've figured out how to add them to the player window, but they're always visible. Is there a way to detect when the standard controls appear and disappear?

A: 

Look into the movieControlMode property. You can set the MPMovieControlMode

MPMovieControlMode Options for displaying movie playback controls.

typedef enum {
   MPMovieControlModeDefault,
   MPMovieControlModeVolumeOnly,
   MPMovieControlModeHidden
} 

MPMovieControlMode;

You can also check out MPMoviePlayerScalingModeDidChangeNotification

Iggy
I know how to enable the controls, what I'm looking for is a notification when the controls appear and disappear (for instance, when the user taps the screen).
Mark Smith
A: 

Mark, did you ever figure this out? I'm looking for the same sort of notification...

Thanks in advance!

Nuncle
Not in a clean way. You can, ahem, inspect the child views of the player view to make an educated guess as to whether the controls are present, but there's no guarantee it won't break in a future OS release.
Mark Smith
A: 

I am also looking for a way to determine whether the controls in the MPMoviePlayerController appear or disappear?

Any other suggestions on how to implement this?

Jermaine
A: 

pre iOS3.2
to detect "disapierance" is easy:

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(movieFinishedCallback:) name:MPMoviePlayerPlaybackDidFinishNotification object:moviePlayerController];

to detect appierance is bit harder (maybe there is better way):

...
[moviePlayerController play];
mainTimer = [NSTimer scheduledTimerWithTimeInterval:1/100 target:self selector:@selector(tick) userInfo:nil repeats:YES];

- (void)tick {
  if( [[[UIApplication sharedApplication] windows] count] < 2 ) return;

  moviePlayerWindow = [[[UIApplication sharedApplication] windows] objectAtIndex:1];
  if( moviePlayerWindow ){
    [mainTimer invalidate], mainTimer=nil;
    // here you have moviePlayerWindow
  }
}
GameBit
I'm referring to the player controls that appear in a HUD over top of the movie. These will appear and disappear while the move is playing (for instance, when the user taps on the movie).
Mark Smith