I just added Http streaming to my iOS app. I'm using mpmovieplayercontroller I'm having trouble, when the movie ends the player doesn't dismiss
when I had the player pointing to a .mp4 it dismissed just fine. but now i have it pointed to a .m3u8 file. It stops playing one second from the end. (-0:01) even if it does get to the end (0:00) the player still doesn't dismiss.
my code is below
-(void)playmovie
{
NSURL *url = [NSURL URLWithString:self.videoitem];
self.moviePlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:url];
// Register this class as an observer instead
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(movieFinishedCallback:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:self.moviePlayer.moviePlayer];
// Register to receive a notification that the movie is now in memory and ready to play
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(movieLoadStateDidChange:)
name:MPMoviePlayerLoadStateDidChangeNotification
object:nil];
self.moviePlayer.view.frame = CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height);
[[UIApplication sharedApplication] setStatusBarHidden:YES];
[self.view addSubview:self.moviePlayer.view];
}
- (void)movieFinishedCallback:(NSNotification*)Notification
{
MPMoviePlayerController *moviePlayervc = [Notification object];
// Remove this class from the observers
[[NSNotificationCenter defaultCenter] removeObserver:self
name:MPMoviePlayerPlaybackDidFinishNotification
object:moviePlayervc];
// Dismiss the view controller
[self dismissViewControllerAnimated:YES completion:nil];
}
thank you for any help you can give me.