Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I believe I found the solution. If anyone else needs this functionality, here is how I got it to work:</p> <p>I used the code I found <a href="https://stackoverflow.com/questions/6113735/mpmovieplayercontroller-adding-uibutton-to-view-that-fades-with-controls">here</a> to find the MPInlineVideoOverlay subview in the MPMoviePlayer view array. Then I modified it as follows: </p> <p><pre><code> - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {</p> float newValue = 0; if([change objectForKey:NSKeyValueChangeNewKey] != [NSNull null]) { newValue = [[change objectForKey:NSKeyValueChangeNewKey] floatValue]; } NSLog(@"player controls are visible: %@", newValue ? @"YES" : @"NO"); self.controlsView.alpha = newValue; } -(void)recursiveViewTraversal:(UIView*)view counter:(int)counter { NSLog(@"Depth %d - %@", counter, view); //For debug if([view isKindOfClass:NSClassFromString(@"MPInlineVideoOverlay")]) { //Add any additional controls you want to have fade with the standard controls here mainControlsView = view; } else { for(UIView *child in [view subviews]) { [self recursiveViewTraversal:child counter:counter+1]; } } } -(void)setupAdditionalControls { //Call after you have initialized your MPMoviePlayerController (probably viewDidLoad) mainControlsView = nil; [self recursiveViewTraversal:moviePlayer.view counter:0]; //check to see if we found it, if we didn't we need to do it again in 0.1 seconds if(mainControlsView) { [mainControlsView addObserver:self forKeyPath:@"alpha" options:NSKeyValueObservingOptionNew context:NULL]; } else { [self performSelector:@selector(setupAdditionalControls) withObject:nil afterDelay:0.1]; } }` </code></pre> <p>Where mainControlsView is the standard Apple controls for MPMoviePlayer and self.controlsView is my view with my custom controls. I Key Value Observe the alpha property on the standard controls view and change mine to match whenever it changes.</p> <p>Rob</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload