<img src="https://img.shields.io/badge/%20-ENTERPRISE-%23B10031" style="float:left"/><br /> <img src="https://img.shields.io/badge/Android-V4-009727?logo=android" style="float:left"/>

<br />

The `PlaylistItem` class enables you to add content to your player and define the unique characteristics of that content:

  • Title

  • Description

  • Poster image

  • Media ID

<br />

There are multiple ways to load and play content in your player. As best practice approaches, we recommend the following:

  • Use `PlayerConfig.Builder()` to create single-item or multiple-item playlists with media hosted in your JWP account

  • Use `PlaylistItem.Builder()` to create single-item or multiple-item playlists with self-hosted media

  • Use `PlayerConfig.Builder()` to associate a playlist to a player and to initiate media playback



While you can use other approaches to create, associate, and play playlists, `PlaylistItem.Builder()` and `PlayerConfig.Builder()` enable you to add functionality like customization and advertising.

<br />

The following sections explain how to create a single-item playlist, create a multiple-item playlist, and add multiple sources to a playlist item.

<br /> <hr />

## JWP-hosted Content

When your content is hosted with JWP, the metadata added to a media item when it is uploaded to your account is used in your mobile app. Additionally, you have the ability to query the Analytics API to access SDK video metrics.

<br />

### Create a JWP-hosting single-item playlist

Use the following recipe to create a single-item playlist.

📱
ANDROID | FIRE TV: JWP-hosted Single-item Playlist
Open Recipe


<br /> <hr />

## Self-hosted Content

If you are self-hosting your content, you can set metadata for manually building the following type of playlists:

  • Single-item playlists

  • Multiple-item playlists

  • Playlists with multiple-source playlist items

<br />

Use the following recipes to learn how to build each of these playlists.

📱
ANDROID | FIRE TV: Self-hosted Single-item Playlist
Open Recipe

📱
ANDROID | FIRE TV: Self-hosted Multiple-item playlist
Open Recipe

📱
ANDROID | FIRE TV: Self-hosted Playlists with Multiple-source Playlist Items
Open Recipe


<br /> <hr />

## Frequently Used Methods and Callbacks

The following tables list frequently used methods and callbacks. To view all available methods and callbacks, visit our SDK reference.

<br />

### Methods

MethodDescription
`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`

<br />

### JWPlayerView Callbacks

CallbackDescription
`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<br /><br />However, if the repeat option is set `true`, this is never fired.
[`setPlaylistItemCallbackListener(playlistItemCallbackListener)`](🔗)Registers a listener to receive a blocking callback before the start of the next playlist item <br /><br /> There can only be one listener as additional assignments overwrite the previous listener. <br /><br /> Set the listener to `null` to clear to value.

<br />

(Script tags will be stripped)