Creating a Playlist

Multiple pieces of content can be sent into the player as a playlist as shown below.

// Create a list to contain the PlaylistItems
List<PlaylistItem> playlist = new ArrayList<>();

// Add a PlaylistItem pointing to the first piece of content
playlist.add(new PlaylistItem("http://content/tv-show-pilot-adaptive.m3u8"));

// Add another PlaylistItem pointing to the second piece of content
// This time using the Builder
playlist.add(new PlaylistItem.Builder()
    .description("A good TV show")

// Add a final piece of content
playlist.add(new PlaylistItem("http://content/tv-show-ep3.mp4"));

// Load the playlist into the player

Playlist API Methods

Method Description
List<PlaylistItem> getPlaylist() Returns the player's current playlist
int getPlaylistIndex() Returns the index of the currently active item in the playlist
PlaylistItem getPlaylistItem(int index) Returns the currently playing PlaylistItem

Playlist Callbacks

Callback Description
onPlaylist(PlaylistEvent playlistEvent) Fired when a new playlist has been loaded into the player.
onPlaylistItem(PlaylistItemEvent playlistItemEvent) Fired when the playlist index changes to a new playlist item.
onPlaylistComplete(PlaylistCompleteEvent playlistCompleteEvent) Fired when the player is done playing all items in the playlist. However, if the repeat option is set true, this is never fired.