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.
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;
}
}
}
}
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With