Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8544759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:38:15+00:00 2026-06-11T12:38:15+00:00

I have an app with a tab bar controller at the root. The home

  • 0

I have an app with a tab bar controller at the root. The “home view” is a 3D rendered screen in OpenGL. There are certain 3D objects that you can click on that need to display a video. The video should be fullscreen and fade in and out.

To do this, I made the HomeViewController create a MPMoviePlayerViewController, assigned it a URL and then presented it from the tab bar controller. (I would have presented it from the HomeViewController but for some reason it didn’t change its orientation properly–I’m sure it’s related to all of the custom 3D stuff, and I didn’t program it, so I just did a workaround by displaying it from a senior view.)

(Note that I am presenting the MPMoviePlayerViewController modally (not using the built-in presentModalMovieViewController or whatever) because Apple forces the transition to be the wacky screen-shift, and I wanted the dissolve.)

Now, that works fine. The modal window dissolves in, the video plays. You can play and pause it, fast forward, hit “Done” and the modal window goes away. Voila.

Now, here comes the totally weird bug: if you don’t tap the video player and let the controls fade out (as they do after a second or two) the user cannot bring them back by tapping. It seems like the video controller stops responding to user input after that fade. Again, it works fine before they fade away. But after that point, I have to wait for the video to play all the way (at which point the modal window does, in fact, go away).

For reference, here is the relevant code to the modal video player:

-(void) startVideoWithURL:(NSURL *)videoURL {

    if (!self.outsideMoviePlayerViewController) {
        self.outsideMoviePlayerViewController = [[MPMoviePlayerViewController alloc] initWithContentURL:nil];
    }

    if (videoURL) {

        [self stopAnimation];

        self.outsideMoviePlayerViewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
        self.outsideMoviePlayerViewController.moviePlayer.contentURL = videoURL;

        [[[AppController instance] getCustomTabBarViewController] presentModalViewController:self.outsideMoviePlayerViewController animated:YES];

        // Move observation of the dismiss from the MoviePlayerViewController to self.
        [[NSNotificationCenter defaultCenter] removeObserver:self.outsideMoviePlayerViewController
                                                        name:MPMoviePlayerPlaybackDidFinishNotification
                                                      object:self.outsideMoviePlayerViewController.moviePlayer];
        [[NSNotificationCenter defaultCenter] addObserver:self
                                                 selector:@selector(movieFinishedCallback:)
                                                     name:MPMoviePlayerPlaybackDidFinishNotification
                                                   object:self.outsideMoviePlayerViewController.moviePlayer];

    }

}

-(void) movieFinishedCallback:(NSNotification *)aNotification {

    // Summary: Restart 3D animation, unregister from notifications, kill the modal video.

    [self startAnimation];

    MPMoviePlayerController *moviePlayer = [aNotification object];
    [[NSNotificationCenter defaultCenter] removeObserver:self
                                                    name:MPMoviePlayerPlaybackDidFinishNotification
                                                  object:moviePlayer];

    [[[AppController instance] getCustomTabBarViewController] dismissModalViewControllerAnimated:YES];

}

The only other reference I could find to an issue like this was some archived post on the Apple Support Communities, here:

https://discussions.apple.com/thread/2141156?start=0&tstart=0

In this thread, the issue poster figures it out himself, and states that the issue was resolved. Here’s his explanation:

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.

Unfortunately, I’m not programming a game and nobody on my dev team calls CFRunLoopRunInMode anywhere in the code. The closest thing I found to this was in the animation code (in the same ViewController):

- (void)startAnimation
{
    if (!animating)
    {
        NSLog(@"startAnimation called");
        CADisplayLink *aDisplayLink = [[UIScreen mainScreen] displayLinkWithTarget:self selector:@selector(drawFrame)];
        [aDisplayLink setFrameInterval:animationFrameInterval];
        [aDisplayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
        self.displayLink = aDisplayLink;

        animating = TRUE;
    }
}

If anyone has any insights on what could be causing this, I would appreciate it. I figured that, at the very least, even if I figure it out myself tonight, this problem could go up on Stack Overflow and be archived for the sake of posterity.

Cheers.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T12:38:16+00:00Added an answer on June 11, 2026 at 12:38 pm

    I figured out what was causing this problem.

    I noticed that the first video did play, while successive ones did not. I moved this code:

    if (!self.outsideMoviePlayerViewController) {
            self.outsideMoviePlayerViewController = [[MPMoviePlayerViewController alloc] initWithContentURL:nil];
    }
    

    This way the creation of the outsideMoviePlayerViewController was inside the next block, like so:

    if (videoURL) {
    
            self.outsideMoviePlayerViewController = [[MPMoviePlayerViewController alloc] initWithContentURL:nil];
    
            [self stopAnimation];
    
            self.outsideMoviePlayerViewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
            self.outsideMoviePlayerViewController.moviePlayer.contentURL = videoURL;
    

    Now a new controller is created instead of recycling the controller each time I played a video. The bug went away. I’m not 100% sure why this happened, because there are a variety of things that occur when you display a modal view controller.

    The bottom line is probably that I should have done this in the first place as part of the lazy loading paradigm instead of trying to keep the controller in memory.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an app that launches to a tab bar controller. When the app
I have an app that is built starting from a tab bar controller. It's
I have a tab bar controller view that loads a record from an api
I have a tab-bar and navigation controller application (like Youtube app or Contacts app).
I have an app that if it is quit in a certain view, I
i have an app with tab bar and a navigation controller inside every tab.
I have an ios5 app developed using storyboards that currently displays a tab bar
I have a tab bar application with a navigation controller and view controllers inside
My app has two distincts modes. There's a tab bar controller in the app
At the moment I have app wich have Tab bar Controller with Navigation bar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.