I have an app that allows the user to move from a list of media items to a specific item using the drill-down table view model.

Once the user is inside the detail view, another table view exists allowing the user to select a specific media item.

I am having an issue creating a modal media player to play the .mp4 items. The code below is what I have so far.
if (indexPath.section == SectionHeader && indexPath.row == SectionHeaderEnclosure) {
if (item.enclosures) {
for (NSDictionary *dict in item.enclosures){
NSString *url = [dict objectForKey:@"url"];
NSLog(@" url is : %@",url);
//EXPERIMENTAL
MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];
// Register to receive a notification when the movie has finished playing.
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayBackDidFinish:) name:MPMoviePlayerPlaybackDidFinishNotification object:moviePlayer];
if ([moviePlayer respondsToSelector:@selector(setFullscreen:animated:)]) {
// Use the 3.2 style API
moviePlayer.controlStyle = MPMovieControlStyleDefault;
moviePlayer.shouldAutoplay = YES;
[self.view addSubview:moviePlayer.view];
[moviePlayer setFullscreen:YES animated:YES];
} else {
// Use the 2.0 style API
moviePlayer.movieControlMode = MPMovieControlModeHidden;
[moviePlayer play];
}
}
}
}
I need help with this line:
MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];
It is giving me an NSInvaild Argument Exception. I need help with the video player creation and subsequent deletion from the view.
It looks like you have the URL stored as a plain
NSString, whereas the player expects anNSURL. How about this?