List of usage examples for android.media MediaMetadata2 toBundle
public @NonNull Bundle toBundle()
From source file:androidx.media.MediaController2.java
/** * Updates the playlist metadata//from ww w. j a v a 2 s .com * * @param metadata metadata of the playlist */ public void updatePlaylistMetadata(@Nullable MediaMetadata2 metadata) { Bundle args = new Bundle(); args.putBundle(ARGUMENT_PLAYLIST_METADATA, metadata == null ? null : metadata.toBundle()); sendCommand(COMMAND_CODE_PLAYLIST_SET_LIST_METADATA, args); }
From source file:androidx.media.MediaController2.java
/** * Sets the playlist./* w w w.ja v a 2 s. co m*/ * <p> * Even when the playlist is successfully set, use the playlist returned from * {@link #getPlaylist()} for playlist APIs such as {@link #skipToPlaylistItem(MediaItem2)}. * Otherwise the session in the remote process can't distinguish between media items. * * @param list playlist * @param metadata metadata of the playlist * @see #getPlaylist() * @see ControllerCallback#onPlaylistChanged */ public void setPlaylist(@NonNull List<MediaItem2> list, @Nullable MediaMetadata2 metadata) { if (list == null) { throw new IllegalArgumentException("list shouldn't be null"); } Bundle args = new Bundle(); args.putParcelableArray(ARGUMENT_PLAYLIST, MediaUtils2.toMediaItem2ParcelableArray(list)); args.putBundle(ARGUMENT_PLAYLIST_METADATA, metadata == null ? null : metadata.toBundle()); sendCommand(COMMAND_CODE_PLAYLIST_SET_LIST, args); }