What is wrong with this code?
{
NSString *s = [urls objectAtIndex:selectedPage];
NSLog(@"video = %@\n", s); // JT 10.07.31
theMoviePlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL fileURLWithPath: s]];
//? theMoviePlayer.scalingMode=MPMovieScalingModeAspectFill;
[self.view addSubview:theMoviePlayer.view];
//[theMoviePlayer play]; // Movie playback is asynchronous, so this method returns immediately.
//[self presentMoviePlayerViewControllerAnimated:theMoviePlayer]; // JT 10.08.07
//---play movie---
MPMoviePlayerController *player = [theMoviePlayer moviePlayer];
[player play];
}
It will play videos from a local file, but the same file on a server doesn't play. Instead it returns this error:
2010-08-07 13:38:36.229 Fashion[47473:207] video = NYM_NAME_SLATE.mp4">http://gravuremag.com/ssp_director/albums/album-54/lg/KIKI_NYM_NAME_SLATE.mp4 2010-08-07 13:38:36.314 Fashion[47473:207] NSConcreteNotification 0xae175b0 {name = MPMoviePlayerPlaybackDidFinishNotification; object = ; userInfo = { MPMoviePlayerPlaybackDidFinishReasonUserInfoKey = 1; error = Error Domain=MediaPlayerErrorDomain Code=2 UserInfo=0xae172b0 "This movie could not be played."; }}