views:

264

answers:

1

Hi,

I have a requirement where I have to play a video file which is available in remote location.

I am passing the URL to MPMoviePlayerController instance and called the method play.

Now, the movie is downloading. I have clicked on the "Done" button before the movie loads completely and came back to the rootview.

MPMoviePlayerPlaybackDidFinishNotification notification got called. I have stopped the video and released the player. Here is the code

  • (void)movieDidFinish:(NSNotification *)aNotifciation {

    [self.moviePlayer stop];

    [self removeActivityIndicatorView];

    [self.tableView reloadData];

    [[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification object:nil];

    [moviePlayer release];

    moviePlayer = nil;

}

But, still the video is loading in the background and iam able to hear the audio also.

This must not happen.

Can anyone give the solution for this?

Thanks in Advance.

A: 
[movieplayer stop];
movieplayer.initialPlaybackTime = -1.0;
[movieplayer release]; 

Setting initial playbacktime to -1 should solve your problem.

EEE