Question

I am playing a video from URL in my MPMovie player but after some time buffering stops and do not start again. Code to play movie is given below

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];
Was it helpful?

Solution

After initializing moviePlayerController, do this:

[moviePlayerController prepareToPlay];

for example:

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

It works for ios 6 and earlier :).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top