Interface Playlist

All Known Implementing Classes:
MultiControllerPlaylist, PlaylistController, SingleControllerPlaylist

public interface Playlist
Common Playlist interface.
Since:
4.2.5
  • Method Details

    • addItem

      void addItem(@NonNull PlayerConfig config)
      Adds an item at the end of the playlist.
      Parameters:
      config - item to add
    • addItem

      void addItem(int position, @NonNull PlayerConfig config)
      Adds an item at the specified position in the playlist.
      Parameters:
      position - the position at which to add the item.
      config - item to add
      Throws:
      IndexOutOfBoundsException - if the position is negative or greater than the current Playlist size.
    • removeItem

      void removeItem(@NonNull PlayerConfig config)
      Removes an item from the Playlist. Note that this element must exist in the playlist already (ie. be part of getPlaylist()).
      Parameters:
      config - item to remove
    • swap

      void swap(@NonNull PlayerConfig playerConfig1, @NonNull PlayerConfig playerConfig2)
      Interchanges two Playlist items. If any of such items is the currently playing item, playback won't be affected.
      Parameters:
      playerConfig1 - first item to swap
      playerConfig2 - second item to swap
    • getCurrentItem

      @Nullable PlayerConfig getCurrentItem()
      Returns the currently playing item
      Returns:
      the currently playing item
    • getPlaylist

      List<PlayerConfig> getPlaylist()
      Returns the current Playlist as a List of PlayerConfig items.
      Returns:
      the current Playlist
    • getSize

      int getSize()
      Returns the number of Configs in the playlist.
      Returns:
      number of Configs
    • getCurrentItemIndex

      int getCurrentItemIndex()
      Returns current item index
      Returns:
      Current item index or -1 otherwise
    • open

      void open(@NonNull Parcelable... playerConfigs)
      Starts playback with an Array of PlayerConfigs or Bundles.

      The playlist might apply some generic configuration to the items passed to this method. This implies that the items in the playlist *won't necessarily be the same instances*.

      Parameters:
      playerConfigs - array of PlayerConfigs or Bundles, each representing a Playlist item.
    • open

      void open(int startIndex, @NonNull Parcelable... playerConfigs)
      Start playback with the specified index and with an Array of PlayerConfigs or Bundles.

      The playlist might apply some generic configuration to the items passed to this method. This implies that the items in the playlist *won't necessarily be the same instances*.

      Parameters:
      startIndex - The index of the config to start playback with
      playerConfigs - The array of player configs to play
      Throws:
      IllegalArgumentException - when startIndex is not within the size range of playerConfigs
    • open

      void open(@NonNull List<? extends Parcelable> playerConfigs)
      Starts playback with a List of PlayerConfigs or Bundles.

      The playlist might apply some generic configuration to the items passed to this method. This implies that the items in the playlist *won't necessarily be the same instances*.

      Parameters:
      playerConfigs - list of PlayerConfigs, or Bundles each representing a Playlist item.
    • open

      void open(int startIndex, @NonNull List<? extends Parcelable> playerConfigs)
      Start playback with the specified index and player configs

      The playlist might apply some generic configuration to the items passed to this method. This implies that the items in the playlist *won't necessarily be the same instances*.

      Parameters:
      startIndex - The index of the config to start playback with
      playerConfigs - The list of player configs to play
      Throws:
      IllegalArgumentException - when startIndex is not within the size range of playerConfigs
    • nextItem

      @Nullable PlayerConfig nextItem()
      Advances playback to the next Playlist item.
      Returns:
      the next item to play. If null, the end of the Playlist has been reached.
    • playItem

      @Nullable PlayerConfig playItem(int index)
      Advances playback to the Playlist item specified by the index.
      Returns:
      the item to play. If null, the end of the Playlist has been reached.
    • previousItem

      @Nullable PlayerConfig previousItem()
      Moves backwards in the Playlist.
      Returns:
      the next item to play. If null, the start of the Playlist has been reached.