I add subviews to my MPMoviePlayerController depending on the current playback time to realize an interactive video. At this point everything is working fine, except one thing:
The control elements of the MPMoviePlayerController
appear under my subviews when the user touches inside the video.
E.g. One subview appears between 0:10 and 0:20 at the point (10/10). If the user wants to seek backward or forward the subview appears in front of the control elements of the player and blocks them.
I add the subviews like this:
overlay.hidden = FALSE;
[self.player.view addSubview:overlay];
Where overlay
is a subclass of UIView.
Is there a way to control how the control elements appear or to add the subviews between the movie and the control elements?
I tried:
[self.player.backgroundView addSubview:overlay];
But here is the subview behind the movie.
The control elements aren't subviews of the MPMoviePlayerController
.
When debugging you should do a recursive print of your MPMoviePlayerController's view, that'll show you the entire subview hierarchy of that view. Like so:
po [[[self player] view] recursiveDescription]
Look for the MPVideoContainerView which has 4 subviews. The should insert your subview between 2 and 3, the MPVideoView which draws the video and the MPInlineVideoOverlay which holds all controls.