Package com.castlabs.android.player
Interface Playlist
- All Known Implementing Classes:
MultiControllerPlaylist
,PlaylistController
,SingleControllerPlaylist
public interface Playlist
Common Playlist interface.
- Since:
- 4.2.5
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addItem
(int position, PlayerConfig config) Adds an item at the specified position in the playlist.void
addItem
(PlayerConfig config) Adds an item at the end of the playlist.Returns the currently playing itemint
Returns current item indexReturns the current Playlist as a List ofPlayerConfig
items.int
getSize()
Returns the number of Configs in the playlist.nextItem()
Advances playback to the next Playlist item.void
open
(int startIndex, Parcelable... playerConfigs) Start playback with the specified index and with an Array ofPlayerConfigs
orBundles
.void
open
(int startIndex, List<? extends Parcelable> playerConfigs) Start playback with the specified index and player configsvoid
open
(Parcelable... playerConfigs) Starts playback with an Array ofPlayerConfigs
orBundles
.void
open
(List<? extends Parcelable> playerConfigs) Starts playback with a List ofPlayerConfigs
orBundles
.playItem
(int index) Advances playback to the Playlist item specified by the index.Moves backwards in the Playlist.void
removeItem
(PlayerConfig config) Removes an item from the Playlist.void
swap
(PlayerConfig playerConfig1, PlayerConfig playerConfig2) Interchanges two Playlist items.
-
Method Details
-
addItem
Adds an item at the end of the playlist.- Parameters:
config
- item to add
-
addItem
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
Removes an item from the Playlist. Note that this element must exist in the playlist already (ie. be part ofgetPlaylist()
).- Parameters:
config
- item to remove
-
swap
Interchanges two Playlist items. If any of such items is the currently playing item, playback won't be affected.- Parameters:
playerConfig1
- first item to swapplayerConfig2
- second item to swap
-
getCurrentItem
Returns the currently playing item- Returns:
- the currently playing item
-
getPlaylist
List<PlayerConfig> getPlaylist()Returns the current Playlist as a List ofPlayerConfig
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
Starts playback with an Array ofPlayerConfigs
orBundles
.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
Start playback with the specified index and with an Array ofPlayerConfigs
orBundles
.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 withplayerConfigs
- The array of player configs to play- Throws:
IllegalArgumentException
- when startIndex is not within the size range of playerConfigs
-
open
Starts playback with a List ofPlayerConfigs
orBundles
.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
Start playback with the specified index and player configsThe 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 withplayerConfigs
- The list of player configs to play- Throws:
IllegalArgumentException
- when startIndex is not within the size range of playerConfigs
-
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
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
Moves backwards in the Playlist.- Returns:
- the next item to play. If null, the start of the Playlist has been reached.
-