我在播放来自互联网的视频时收到标题中提到的这个错误。
- (void)viewDidLoad
{
NSString *urlAdress = [NSString stringWithFormat:@"http://www.dailymotion.com/video/x108t8t"];
//NSString *urlAdress = [[NSBundle mainBundle] pathForResource:@"video8" ofType:@"mp4"];in this case video plays.
NSURL *videoURL = [NSURL fileURLWithPath:urlAdress];
self.mpvc = [[MPMoviePlayerViewController alloc] initWithContentURL:videoURL];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlaybackDidFinish:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:nil];
self.mpvc.moviePlayer.movieSourceType = MPMovieSourceTypeStreaming;
//when using file in resources use MPMovieSourceTypeFile,when online then streaming
[self presentMoviePlayerViewControllerAnimated:mpvc];
[super viewDidLoad];
}
//and here is moviePlaybackDidFinish method
- (void)moviePlayBackDidFinish:(NSNotification *)notification
{
MPMoviePlayerController *theMovie = [notification object];
[[NSNotificationCenter defaultCenter] removeObserver:self
name:MPMoviePlayerPlaybackDidFinishNotification
object:theMovie];
[theMovie stop];
[theMovie.view removeFromSuperview];
NSLog(@" playback finish Called......");
}
这是完整的代码。我已经阅读了大部分教程,stackoverflow 问题,但无法获得单一的解决方案