---
updatedAt: 2026-09-10T09:14:39.000Z
agentTools:
  siteIndex: https://docs.jwplayer.com/llms.txt
  projectIndex: https://docs.jwplayer.com/players/llms.txt
---

# ANDROID: Self-hosted Playlists with Multiple-source Playlist Items

```java Java
List<MediaSource> mediaSources = new ArrayList<>();
mediaSources.add(new MediaSource("https://cdn.jwplayer.com/videos/{MEDIA_ID}-{TEMPLATE_ID_HD}.mp4"));
mediaSources.add(new MediaSource("https://cdn.jwplayer.com/videos/{MEDIA_ID}-{TEMPLATE_ID_SD}.mp4"));

PlaylistItem playlistItem = new PlaylistItem.Builder()
        .sources(mediaSources)
        .image("https://www.mydomain.com/poster.jpg")
        .description("Some really great content")
        .title("Playlist-Item Title")
        .build();

List<PlaylistItem> playlist = new ArrayList<>();
playlist.add(playlistItem);
PlayerConfig config = new PlayerConfig.Builder()
        .playlist(playlist)
        .build();
mPlayer.setup(config);
```

# Create a List<MediaSource> object and name it.

<!-- java@1 -->



# Add the URLs for your sources to the mediaSources object.

<!-- java@2-3 -->



# Create and name a PlaylistItem object.

<!-- java@5 -->

Read more about <a href="https://sdk.jwplayer.com/android/v4/reference/com/jwplayer/pub/api/media/playlists/PlaylistItem.Builder.html" target="_blank">PlaylistItem.Builder()</a>.

# Use the source property to add mediaSources to the PlaylistItem object.

<!-- java@6 -->



# (Optional) Add a poster image (image) and video metadata (title, description).

<!-- java@7-9 -->



# Create a List<PlaylistItem> object and name it.

<!-- java@12 -->



# Add the PlaylistItem object to the playlist object.

<!-- java@13 -->



# Create a config object that defines the properties of the player.

<!-- java@14 -->

Read more about <a href="https://sdk.jwplayer.com/android/v4/reference/com/jwplayer/pub/api/configuration/PlayerConfig.Builder.html" target="_blank">PlayerConfig.Builder()</a>.

# Assign the playlist object to the config.

<!-- java@15 -->



# Set up JWPlayer -- mPlayer in the following example -- with config.

<!-- java@17 -->