For the cases when single view players don't cover all your needs, we created
VKPlayersManager component which provides more flexibility of playback experience and handles all video preparations for you.
This component takes
VKPlaylist as an input and prepares individual
VKPlayerViewController for every video in the playlist. So if you have a use case like a video feed, where you need to present every video individually, this component is the best option. It will take over the preloading, preparation and caching of videos, and you will only need to request a prepared player for a specific video and present it the way you need.
Let's take a look at a simple example of using the player manager. Assuming we have a list of video ids we want to play.
Once the manager has a playlist, it will take over the preparation of the playlist videos. So now you only need to request prepared player for desired video. You can request player by video index in playlist:
Or by video id:
Important note: you should always keep updated current playlist index for the manager. By having actual current playlist index, players manager can re-prioritize preloading order of playlist videos to your actual need. So you will always have prepared player for next required video. E.g. you were watching the first playlist video in your app and then moved to the third video, you should do:
So now manager can re-adjust preloading order and then you will move to the forth video, it will be ready for playback. Players manager also has smart adjustment algorithm, it analyzes the way you change playlist index and may accelerate preloading from one or another direction.
Another important moment is that you should always release player as soon as it's not visible and you don't need it anymore.
This way manager can use just a few players for playback of infinite number of videos and keep memory consumption minimal.
Here you can find example app with implementation of infinite video feed using