Playlists are reactive lists of videos that can be played and observed efficiently, with built-in
support for pagination, caching and preloading. This is the recommended way of fetching and
playing videos through our player.
As with querying videos, the start point is the video store (
Also, to fetch playlist you will need a valid session or the call will return an error.
Every playlist holds a list of videos in memory. At first, this list represent the first "page" of
results that were retrieved from server. These videos can be retrieved with
getVideo is called with an index bigger than
playlist.size, it will throw an exception.
If you need more videos than those available at the moment, you can request a new batch of results
Note that if
Playlist.loadMoreOnAccess is true (default), the playlist will automatically load new
pages as you consume the playlist with
getVideo, checking if you are getting close enough to the last
available video. This makes it easy to show a list of videos without worrying about dynamic contents.
Playlists can be observed by registering a
PlaylistListener. This is extremely useful when
videos are shown in a
RecyclerView, for example, so that you can call the appropriate notify*
methods whenever something changes.
As with other APIs, we use request objects to define the query parameters. All request objects
PlaylistRequest interface. We expose several types of requests, each one with different
Once you have the request, just call
You can filter by user using
#By metadata and tags
You can filter by metadata and tags using
You can create a playlist with custom videos using
This is a special type of playlist which can be controlled by the user.
- It is mutable! You can use
removefunctions to add ids, and videos will be loaded accordingly
- It can't support the concept of page, so
As you access videos (through
getVideo) and consume them (through the player SDK), the playlist
will automatically cache video data and preload videos that we think you might request soon. You
can customize the preload quality using
You can also choose whether to enable HLS playback or not using the
When passing the playlist to a player, it is fundamental that these settings match
the player values,
Player.useHls respectively, otherwise preloading will
be wasting useful resources.