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

  • SEARCH
  • Home
  • 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 6699413
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:41:32+00:00 2026-05-26T06:41:32+00:00

In my iPad app, I have a UIButton that is calling an IBAction to

  • 0

In my iPad app, I have a UIButton that is calling an IBAction to call a view controller as a modal to show a video in. I wanted the modal to appear as 720×405, and that part seems to work out okay. Here is the IBAction code the button is executing:

    -(IBAction)videoPlayerTest:(id)sender {
        VideoModalViewController *vc = [[VideoModalViewController alloc] initWithNibName: @"VideoModalViewController" bundle: nil];
        vc.fileName = @"testvideo.m4v";
        vc.modalPresentationStyle = UIModalPresentationFormSheet;
        [self presentModalViewController:vc animated: YES];
        vc.view.superview.frame = CGRectMake(0, 0, 720, 405); 
        vc.view.superview.center = self.view.center;
        [vc release];
    }

The modal comes up where I want it, and the controls respond on the MPMoviePlayerController; the jog bar, pause, play, etc. but if the user taps on the fullscreen button, the video does go fullscreen alright, but after that the MPMoviePlayerController won’t respond to any subsequent taps on the player controls. If I remove the modalPresentationStyle line it will work, but the modal appears on a fullscreen view instead of the 720×405 modal like I want. I’ve added Observers to try resizing the frame and recenter it when the user makes the movie controller fullscreen and back to windowed, but it didn’t appear to help at all. Here is that code.

    - (void)willEnterFullscreen:(NSNotification*)notification {
        NSLog(@"willEnterFullscreen");
        [self setModalPresentationStyle:UIModalPresentationFullScreen];
        self.view.frame = CGRectMake(0, 0, 1024, 768);
        self.view.center = self.view.center;
    }

    - (void)willExitFullscreen:(NSNotification*)notification {
        NSLog(@"willExitFullscreen");
        [self setModalPresentationStyle:UIModalPresentationFormSheet];
        self.view.frame = CGRectMake(0, 0, 720, 405);
        self.view.center = self.view.center;
    }

    - (void)playMovie {
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willEnterFullscreen:) name:MPMoviePlayerWillEnterFullscreenNotification object:nil];
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willExitFullscreen:) name:MPMoviePlayerWillExitFullscreenNotification object:nil];

        NSString *videoString = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:fileName];
        NSURL *videoURL = [NSURL fileURLWithPath:videoString];
        moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:videoURL];
        [self.view addSubview:moviePlayer.view];
        moviePlayer.view.frame = CGRectMake(0, 0, 720, 405);
        moviePlayer.view.backgroundColor = [UIColor grayColor];
        [moviePlayer prepareToPlay];
        [moviePlayer play];
    }

This is my first post– hope I did it right and provided enough information about the problem I’m having.

  • 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-05-26T06:41:33+00:00Added an answer on May 26, 2026 at 6:41 am

    I’ve solved my problem. I was unaware of MPMoviePlayerViewController and I created that and used that as my modal instead. It works great.

        -(void)playVideo:(NSString *)fileName {
            NSString *videoString = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:fileName];
            NSURL *videoURL = [NSURL fileURLWithPath:videoString];
            mpViewController = [[MPMoviePlayerViewController alloc] initWithContentURL:videoURL];
            [self presentModalViewController:mpViewController animated:NO];
            [[mpViewController moviePlayer] play];
        }
    
        -(IBAction)videoPlayerTest:(id)sender {
            [self playVideo:@"testvideo.m4v"];
        }
    

    Thought I’d post what I came up with just in case somebody else encounters the same

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

Sidebar

Related Questions

I have an iPad app where I have a view controller that is the
I have an iPad app and I have a video playing in a view.
In my iPad App I have a modal view ( UIViewController with modal presentation
I have an iPad app that records video and sends it to my SaaS
I have an iPad app with split view controller. I want to programmaticaly create
In my iPad App, I have one custom class inherited from UIButton. I am
I have an iPad app that has a UITableViewController that implements the NSFetchedResultsControllerDelegate .
I have this iPad app using Storyboard. There are some file that are marked
It is an iPad app based on SDK 3.2. I have a MainUIView, that
I'm building an iPad app that will have multiple paper pages and I'd like

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.