我正在从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];
最佳答案
初始化moviePlayerController之后,执行以下操作:
[moviePlayerController prepareToPlay];
例如:
moviePlayerController = [[MPMoviePlayerController alloc] init];
[moviePlayerController prepareToPlay];
它适用于ios 6和更早版本的:)。