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 931357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:29:13+00:00 2026-05-15T20:29:13+00:00

I have this code trying to run a video on the iPhone 4 Simulator.

  • 0

I have this code trying to run a video on the iPhone 4 Simulator.

The problem is that looks like it loads the player but half a second later loads a back screen on top of the whole application disabling touch and everything, and it looks like it does not play the video also, because I can’t hear anything.

Any ideas?!

MPMoviePlayerViewController *mp =
[[MPMoviePlayerViewController alloc] initWithContentURL:videoUrl];

if (mp) {
    mp.moviePlayer.scalingMode = MPMovieScalingModeFill; 
    mp.moviePlayer.movieSourceType = MPMovieSourceTypeFile;
    [mp.moviePlayer play];

    [self presentMoviePlayerViewControllerAnimated:mp];

    [mp release];
}
  • 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-15T20:29:14+00:00Added an answer on May 15, 2026 at 8:29 pm

    I believe the problem is caused by releasing the MPMoviePlayerViewController. Simply retain the controller until you are done with it.

    Prior to the “[mp release];” add this line to save the value away.

    self.moviePlayerViewController = mp;
    

    Then update your dealloc method to do the release:

    - (void)dealloc {
       [_moviePlayerViewController release], _moviePlayerViewController = nil;
       [super dealloc];
    }
    

    Add the synthesize to the top of your .m file:

    @synthesize moviePlayerViewController = _moviePlayerViewController;
    

    Add the defination to the @interface of your .h file:

    MPMovieViewController *_moviePlayerViewController;
    

    Add the property to your .h file:

    @property (readwrite, retain) MPMovieViewController *moviePlayerViewController;
    

    You may need some headers in your header:

    #import <MediaPlayer/MediaPlayer.h>
    #import <MediaPlayer/MPMoviePlayerViewController.h>
    

    You may also need to balance your “presentMoviePlayer” call with the dismiss somewhere:

    [self dismissMoviePlayerViewControllerAnimated];
    

    Phew, code everywhere. Anyway, if you are finished with the resource early, you may be able to release it sooner by using NotificationManager to watch for MPMoviePlayerPlaybackDidFinishNotification. There are many examples of that, so I won’t repeat it.

    Hope this helps.

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

Sidebar

Related Questions

I have this code in my ASP.NET application written in C# that is trying
I'm extremely new to JS and have this code that I'm trying to tweak.
I am trying to have this code run and delete a certain record in
I have this code and I am trying to run it on a .NET
I have this code, i'm trying to set the identity seed by a varable
I am trying to learn javascript i have this code: x=x.replace(/^\s+|\s+$/g,); can i have
I am trying to compare two dates. I have this code which I thought
I am trying to Login or SugarCrm using REST. I have this code,, //Login
I'm trying to overload the '--' postfix operator. I have this code: class Counter
Ok, so here's what I'm trying to do. I have this code in my

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.