lundi 1 décembre 2014

how to remove animation from the MPMoviePlayerController when done is pressed

I want to remove the transition animation that occur in MPMoviePLayerController when the user presses done button . I used to stop it when the movie finishes on its own using the moviePlayBackDidFinish: notification but its doesn't work, as in, the animation occurs. this code i used.



NSURL *fileURL=[NSURL URLWithString:mediaurl1];

moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:fileURL];
[moviePlayerController.view setFrame:CGRectMake(0, 150, 320, 270)];

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(doneButtonClick:)
name:MPMoviePlayerWillExitFullscreenNotification
object:moviePlayerController];

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(donefinished:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:moviePlayerController];

[self presentMoviePlayerViewControllerAnimated:moviePlayerController];

[mediaView addSubview:moviePlayerController.view];
[moviePlayerController setFullscreen:YES animated:NO];
moviePlayerController.useApplicationAudioSession = YES;
[moviePlayerController play];


this is my notification method to close the animation effect.



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



[mediaView removeFromSuperview ];
[moviePlayerController setFullscreen:NO animated:NO];
[self dismissViewControllerAnimated:NO completion:NO];
// [moviePlayerController setFullscreen:NO animated:NO];


}
-(void)donefinished:(NSNotification*)aNotification{


[mediaView removeFromSuperview ];
[moviePlayerController setFullscreen:NO animated:NO];
[self dismissViewControllerAnimated:NO completion:NO];
// [moviePlayerController setFullscreen:NO animated:NO];


}



Aucun commentaire:

Enregistrer un commentaire