Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

An AVPlayerItem can occupy only one position in a player's queue at a time

Im getting this error when trying to play a video from my temp directory:

NSString *tmpDir = [NSTemporaryDirectory() stringByAppendingString:@"/"];
NSString *url = [tmpDir stringByAppendingString:videoToPlay];

MPMoviePlayerController *player =
[[MPMoviePlayerController alloc]
 initWithContentURL:[NSURL fileURLWithPath:url]];

Why am i getting this error "An AVPlayerItem can occupy only one position in a player's queue at a time."

Isnt that code correct? Am i missing something simple?

like image 959
Scoota P Avatar asked Jul 07 '11 04:07

Scoota P


2 Answers

I tried various solutions provided in apple dev forums. In my case what worked was just changing the source type from streaming to unknown:

// player.movieSourceType = MPMovieSourceTypeStreaming;

  player.movieSourceType = MPMovieSourceTypeUnknown;
like image 74
kzia Avatar answered Nov 06 '22 18:11

kzia


Use following statement to avoid such error. Please keep in mind that, THE sdk that you are using is under NDA.

[self.mPlayer.moviePlayer setControlStyle:MPMovieControlStyleDefault];

like image 39
Sagar Kothari Avatar answered Nov 06 '22 17:11

Sagar Kothari