我正在我的MPMovie播放器中播放来自URL的视频,但经过一段时间后,缓冲停止并且不再重新开始。播放电影的代码如下:
NSURL *fileURL = [NSURL URLWithString:strURL];
//moviePlayerController.movieSourceType=MPMovieSourceTypeFile;
NSLog(@"url: %@",fileURL);
[moviePlayerController setContentURL:fileURL];
[self.view bringSubviewToFront:btnAddFav];
[moviePlayerController setAllowsAirPlay:YES];
moviePlayerController.fullscreen = NO;
moviePlayerController.scalingMode = MPMovieScalingModeAspectFit;
//moviePlayerController.initialPlaybackTime
[moviePlayerController prepareToPlay];
[moviePlayerController play];
答案 0 :(得分:1)
初始化moviePlayerController后,执行以下操作:
[moviePlayerController prepareToPlay];
例如:
moviePlayerController = [[MPMoviePlayerController alloc] init];
[moviePlayerController prepareToPlay];
适用于ios 6及更早版本:)。