iOS - Playing more than one video

I am using this code with the MediaPlayer framework to play a video:

NSURL *url1 = [NSURL fileURLWithPath:[[NSBundle mainBundle]
                                     pathForResource:@"GrommeVideoExcerpt1" ofType:@"mp4"]];
grommePlayer1 =  [[MPMoviePlayerController alloc]

[[NSNotificationCenter defaultCenter] addObserver:self

grommePlayer1.controlStyle = MPMovieControlStyleDefault;
grommePlayer1.shouldAutoplay = YES;
[self.view addSubview:grommePlayer1.view];
[grommePlayer1 setFullscreen:YES animated:YES];

But when I play one video, then navigate to another video and try to play it, the app crashes. It gives me this error:


The problem here is you are adding a notification for when the video finishes playing, and that notification triggers a method you do not have (moviePlayBackDidFinish:) causing the crash.

You could implement this method or remove the notification, depends what you want to do after the video is done playing i.e. remove a viewController that plays the video, etc.

//Register notification
[[NSNotificationCenter defaultCenter] addObserver:self
//Then the method ...
-(void) moviePlaybackDidFinish:(NSNotification *)aNotification{
  [grommePlayer1.view removeFromSuperview];
  grommePlayer1 = nil;

Need Your Help

May be error in enclosed text which has TEXT datatype in last column, MySQL Error 1064 occurs

mysql syntax-error mysql-workbench

I am getting the following error in the SQL query below.what can be the possible cause?

Is any method to loading kml in background in html with java script

javascript html html5 google-maps

I trying to loading kml file on map in html but it takes more time to loading kml file on mobile screen

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.