0

我正在 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];
4

1 回答 1

1

After initializing moviePlayerController, do this:

[moviePlayerController prepareToPlay];

for example:

moviePlayerController = [[MPMoviePlayerController alloc] init];
[moviePlayerController prepareToPlay];

It works for ios 6 and earlier :).

于 2013-05-06T07:19:11.987 回答