Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Screen blackout when performing Pinch Gesture on MPMoviePlayerController

I have this strange issue in iOS4 where in the Video which is playing in MPMoviePlayerController blacks out when the user performs certain kind of gestures over the screen. I'm simply creating a UIViewController and object for MPMoviePlayerController and then setting the View onto the UIViewController.

I want to ask if this issue is solvable or not, and whats the correct way of playing a streaming video on iPhone.

And if there is way that I can use a overlay view over MPMoviePlayerController and capture all gestures and pass on single taps or touches to MPMoviePlayerController for general functionality of MPMoviePlayerController and avoiding Gestures that is causing the issue.

Please help me solving the problem with the Best possible solution and please help me in elaborating the solution.

like image 252
y ramesh rao Avatar asked Aug 18 '10 10:08

y ramesh rao


2 Answers

Apple embedded UIPinchGestureRecognizer in MPMoviePlayerViewController, but it can't be found in UIResponder.gestures property. You can disable UIPinchGestureRecognizer embedded in touchesBegan method of MPMoviePlayerViewController.


- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    for (UITouch *touch in touches) {
        NSArray *array = touch.gestureRecognizers;
        for (UIGestureRecognizer *gesture in array) {
            if (gesture.enabled && [gesture isMemberOfClass:[UIPinchGestureRecognizer class]]) {
                gesture.enabled = NO;
            }
        }
    }
}

like image 115
Jungkuk Choi Avatar answered Nov 03 '22 22:11

Jungkuk Choi


I had a similar problem and I just found the reason of my problem from the Apple's doc:

When you add a movie player’s view to your app’s view hierarchy, be sure to size the frame correctly, as shown here:

...

[player.view setFrame: myView.bounds]; // player's frame must match parent's

...

Now my pinches are not crashing my app.

like image 2
Chris Avatar answered Nov 03 '22 20:11

Chris