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

While playing a video using MPMoviePlayerViewController or MPMoviePlayerController, iOS SDK 5.2 generates an error as follows.

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

The exact error is as follows.

*** Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘An AVPlayerItem can occupy only one position in a player’s queue at a time.’

Please have a look into following code – WHICH GENERATES ERROR.

Now, have a look into following code WHICH WILL WORK FINE

The main difference in both code is as follows.

MovieSourceType is modified to “MPMovieSourceTypeUnknown” instead of “MPMovieSourceTypeStreaming”.

If you have a streaming URL, It is recommended to use “MPMovieSourceTypeStreaming”.

While having a static movie URL, It is recommended to use “MPMovieSourceTypeUnknown”.

If you have a URL from file or video from application itself, It is recommended to use “MPMovieSourceTypeFile”.

2 thoughts on “An AVPlayerItem can occupy only one position in a player’s queue at a time

Leave a Reply

Your email address will not be published. Required fields are marked *


*