MPMoviePlayer done button Clicked Change The UIView Height

I am using a MPMoviePlayer to display a video. I go into full screen and when the done button is clicked I want it to remove of the entire movie player from my view.

Right Now When I click The Done Button It Dismiss The MPMoviePlayer But It change The size Of My UIView Height. Is there any solution To remove MPMoviePlayer without affecting my View Size.


Create a videoPlayer view controller (MPMoviePlayerViewController subclass) and add it to your root view controller.

videoPlayerViewController = [[VideoViewController alloc] initWithContentURL:[NSURL fileURLWithPath:resourcePath]];
[rootViewController presentMoviePlayerViewControllerAnimated:videoPlayerViewController];
videoPlayer.controlStyle = MPMovieControlStyleFullscreen;

then add notifications:

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(stopVideo:) name:MPMoviePlayerPlaybackDidFinishNotification object:[videoPlayerViewController moviePlayer]];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(stopVideo:) name:MPMoviePlayerDidExitFullscreenNotification object:[videoPlayerViewController moviePlayer]];                        

then your method that gets called when the notification is received.

- (void) stopVideo:(NSNotification*) aNotification {
  [[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification object:[videoPlayerViewController moviePlayer]];
  [[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerDidExitFullscreenNotification object:[videoPlayerViewController moviePlayer]];
  MPMoviePlayerController *player = [aNotification object];
  [player stop];

Need Your Help

get the ip of app server serving request

ruby-on-rails ruby apache passenger

I have load balancer which routes my request to different rails app hosted on separate boxes.

AsyncDisplayKit invalidateCalculatedSize Swift not working

ios xcode swift asyncdisplaykit

I have an AsyncDisplayNode from Facebook's AsyncDisplayKit framework. When there is a data change in my app, the content of that cell may need to be changed, and I want to signal that change by cal...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.