Take the 2-minute tour ×

Before video starts playing and touchesEnded, ViewController changes and video starts playing in a different ViewController in the background.. How can I fix this problem? What I want is, if viewController changes, then stop playing..

- (void)viewDidLoad
    [super viewDidLoad];

 movpath = [[NSBundle mainBundle] pathForResource:@"video" ofType:@"m4v"];

    mpviewController = [[MPMoviePlayerViewController alloc]
                        initWithContentURL:[NSURL fileURLWithPath:movpath]];

    MPMoviePlayerController *mp = [mpviewController moviePlayer];
    [mp prepareToPlay];
    [mp setFullscreen:YES animated:YES];
    mp.controlStyle = MPMovieControlStyleNone;

    [[mpviewController moviePlayer] play];

    [self performSegueWithIdentifier:@"mainView" sender:self];
    [[mpviewController moviePlayer] stop];
    [mpviewController.view removeFromSuperview];

share|improve this question
stackoverflow.com/questions/13023241/… Try this link.thanks –  Tunvir Rahman Tusher Feb 13 at 11:16

1 Answer 1

You can stop your moviePlayer in -(void)viewDidDisappear method

share|improve this answer

Your Answer


