I have a horizontal flow layout for my UICollectionView. Each cell takes up the entire screen and paging is on. Each cell also contains an MPMoviePlayerController and I'm able to playback video without issue. However, if I scroll left or right the currently displayed movie (which is paused at this point) disappears - the player view goes black. If I then trigger the playback the video appears again. I've tried added prepareToPlay in the scrollview delegate methods to somehow keep the video visibile, but without success.
You can use only one instance of MPMoviePlayerController
at once. This is a limitation with MPMoviePlayerController
.
In your case, when you start to scroll, atleast two MPMoviePlayerController
should be initialized and trying to play a video. This is not possible with MPMoviePlayerController
.
If you want to play more than one video at once in the same screen, you might want to consider using AVFoundation
for this. And there are open source video players based on AVFoundation
. Usine one of them will be easier than creating a AVFoundation
player from scratch.