views:

83

answers:

2

I have MPMoviePlayerController, with which I play a movie. I have my movieControlMode MPMovieControlModeHidden. I want this behaviour: while the movie plays, if tap on the screen is received, stop it, release the movie player. How can this be done?

mMoviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:mMovieURL];
[mMoviePlayer setOrientation:UIDeviceOrientationPortrait animated:NO];
mMoviePlayer.movieControlMode = MPMovieControlModeHidden;
[mMoviePlayer play];

How can I add target/event handler?

10x in advance! Danail

A: 

One solution could be to place an invisible UIButton, covering the entire screen, which, on touchUpInside, calls a function to stop, release and remove the moviePlayer.

Gubb
+1  A: 

which sdk you using if below 3.2 you have add overlay view on MPMoviePlayerController window after you get MPMoviePlayerControllerPreloadDidFinishNotification when user clicks on that View you will get TouchEnd call back just call [PlayerController stop] it will work.

If IOS4 no need of overlay view just use touchended method just call [PlayerController stop] it will work.

jeeva