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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T08:47:56+00:00 2026-05-16T08:47:56+00:00

I’m using a MPMoviePlayerController in my iPhone app to display some short video clips

  • 0

I’m using a MPMoviePlayerController in my iPhone app to display some short video clips sometimes. I deaclared a Category which ads a couple methods to the class to properly attach its view to a particular view and to remove it from there.
I use the notification system to let a class know when the movie has finished playing, then I try to remove it.
Here are the methods in the Category:

- (void)setViewInCurrentController{  
    LPAppDelegate * appDelegate = [[UIApplication sharedApplication] delegate];
    self.view.frame = CGRectMake(0, 0, 320, 480);
    self.view.alpha = 0.0;

    [appDelegate.window addSubview:self.view];
    [UIView beginAnimations:@"FadeIn" context:nil];
    [UIView setAnimationDuration:0.3];
    [UIView setAnimationBeginsFromCurrentState:YES];
    self.view.alpha = 1.0;
    [UIView commitAnimations];

}
- (void)removeViewInCurrentController{

    [UIView beginAnimations:@"FadeOut" context:nil];
    [UIView setAnimationDuration:0.3];
    [UIView setAnimationBeginsFromCurrentState:YES];
    self.view.alpha = 0.0;
    [UIView setAnimationDelegate:self];
    [UIView setAnimationDidStopSelector:@selector(removeFromSuperview)];
    [UIView commitAnimations];
} 

And here is where I use the MPMoviePlayer:

- (void)playVideoNarration:(VideoNarration *)vNarr{
    MPMoviePlayerController *player = [[MPMoviePlayerController alloc] 
                                       initWithContentURL:[NSURL fileURLWithPath:vNarr.videoURI]];
    [[NSNotificationCenter defaultCenter] 
                             addObserver:self
                                selector:@selector(videoNarrationFinishedPlaying:)                                                 
                                    name:MPMoviePlayerPlaybackDidFinishNotification
                                  object:player];

    [player setViewInCurrentController];
    player.controlStyle = MPMovieControlStyleNone;
    [player play]; 
}

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

    MPMoviePlayerController * player = [aNotification object];
    [[NSNotificationCenter defaultCenter] removeObserver:self
                                                    name:MPMoviePlayerPlaybackDidFinishNotification
                                                  object:player];
    [player removeViewInCurrentController];
    [player release];
}

The video shows correctly and then the player gets removed from the view and I guess it gets deallocated too, but when I see the app with Instruments Allocations Tool I see that the memory allocated gets up to 20+ MB and is not deallocated after the player finished.
The responsible for the allocations is a lib called VideoToolBox.

No leaks are shown except some from a library called AudioToolBox. Any guess on what is happening?

  • 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-16T08:47:56+00:00Added an answer on May 16, 2026 at 8:47 am

    The solution for that problem seems to be this:
    you have to call the [player stop] before releasing it. It appears a little strange since I’m already receiving a notification about the player finished playing. Doing so the memory gets deallocated (only a small amount remains , ~100Kb from CoreMedia, but I believe is it normal

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

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
We're building an app, our first using Rails 3, and we're having to build
I am using Paperclip to handle profile photo uploads in my app. They upload
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I used javascript for loading a picture on my website depending on which small
I am reading a book about Javascript and jQuery and using one of the

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.