I am trying to play video using MPMoviePlayerController
, and am having following error,
_itemFailedToPlayToEnd: {
kind = 1;
new = 2;
old = 0;
}
Below is my code,
NSURL *fileURL = [NSURL URLWithString:_videoUrl];
NSLog(@" fileURL: %@",fileURL);
_moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:fileURL];
_moviePlayer.movieSourceType = MPMovieSourceTypeStreaming;
UIWindow *backgroundWindow = [[UIApplication sharedApplication] keyWindow];
[_moviePlayer.view setFrame:backgroundWindow.frame];
[backgroundWindow addSubview:_moviePlayer.view];
[_moviePlayer prepareToPlay];
[_moviePlayer play];
How can I resolve this issue?
See Question&Answers more detail:os