use of androidx.media2.common.MediaMetadata in project ExoPlayer by google.
the class SessionPlayerConnector method setPlaylist.
/**
* {@inheritDoc}
*
* <p>{@link FileMediaItem} and {@link CallbackMediaItem} are not supported.
*/
@Override
public ListenableFuture<PlayerResult> setPlaylist(final List<MediaItem> playlist, @Nullable MediaMetadata metadata) {
Assertions.checkNotNull(playlist);
Assertions.checkArgument(!playlist.isEmpty());
for (int i = 0; i < playlist.size(); i++) {
MediaItem item = playlist.get(i);
Assertions.checkNotNull(item);
Assertions.checkArgument(!(item instanceof FileMediaItem));
Assertions.checkArgument(!(item instanceof CallbackMediaItem));
for (int j = 0; j < i; j++) {
Assertions.checkArgument(item != playlist.get(j), "playlist shouldn't contain duplicated item, index=" + i + " vs index=" + j);
}
}
ListenableFuture<PlayerResult> result = playerCommandQueue.addCommand(PlayerCommandQueue.COMMAND_CODE_PLAYER_SET_PLAYLIST, /* command= */
() -> player.setPlaylist(playlist, metadata));
return result;
}
Aggregations