Want to highlight a helpful answer? Upvote!

Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

MPMoviePlayerController playback control disappears

Hi,

I added the MPMoviePlayerController in my project and it works fine. But the playback control appears only at the beginning. If I want to return to the previous view, I have to wait until the movie end...

I checked the sample project "MoviePlayer" and its playback control will appear/disappear when user touches the screen.

Here is my code about playing movie, I think there is no much different to the sample code.

============================
- (void)playMovieAtURL:(NSURL*)url {
MPMoviePlayerController* mPlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];

mPlayer.scalingMode = MPMovieScalingModeAspectFit;

mPlayer.movieControlMode = MPMovieControlModeDefault;

mPlayer.backgroundColor = [UIColor blackColor];
mPlayer.initialPlaybackTime = -1.0;

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(movieFinishedCallback:) name:MPMoviePlayerPlaybackDidFinishNotification
object:mPlayer];
[mPlayer play];
}

- (void)movieFinishedCallback:(NSNotification*)aNotification {
MPMoviePlayerController* mPlayer = [aNotification object];
[[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification
object:mPlayer];
[mPlayer stop];
[mPlayer release];
}

=========================

Could anyone tell me how to show the playback control just as the sample project??

BTW, the view in my project is applied with OpenGL, although I dont think this is the cause.

Thank you very much 🙂

iPhone OS 3.0.1

Posted on Sep 2, 2009 8:19 PM

Reply
3 replies

Sep 8, 2009 3:22 AM in response to FungSiu

I solved the problem finally...

In "applicationDidFinishLaunching", I would call a method "(void)startGameLoop" in my UIView.

- (void)startGameLoop {
CFTimeInterval time;
float delta;

while(YES) {
while(CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.002, TRUE) == kCFRunLoopRunHandledSource);
time = CFAbsoluteTimeGetCurrent();

//stuff here...
}
}

The problem occurs when CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, TRUE). After i changed to CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.002, TRUE), the playback control can appears/disappear by tapping the screen.

MPMoviePlayerController playback control disappears

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.