public class PlaylistManager extends Object implements PlaylistSupport
Modifier and Type | Class and Description |
---|---|
static interface |
PlaylistManager.PlayerCallback
Interface defines the methods required by the PlaylistManager to interact
with a player widget
|
Constructor and Description |
---|
PlaylistManager()
Creates the PlaylistManager object.
|
PlaylistManager(AbstractMediaPlayer player)
Creates PlaylistManager for the specified player widget.
|
Modifier and Type | Method and Description |
---|---|
void |
addToPlaylist(List<MRL> mediaLocators)
Adds the media locators to the players' playlist.
|
void |
addToPlaylist(MRL mediaLocator)
Adds the media locator to the players' playlist.
|
void |
addToPlaylist(String... mediaURLs)
Adds the media at the specified URLs to the players' playlist.
|
void |
addToPlaylist(String mediaURL)
Adds the media at the specified URL to the players' playlist.
|
void |
clearPlaylist()
Removes all entries in the players' playlist
|
protected void |
flushMessageCache()
Fires debug events with messages that have been cached since the manager is created.
|
String |
getCurrentItem()
Returns the URL at the current playlist reference index
|
int |
getPlaylistIndex()
Returns the current playlist index
|
int |
getPlaylistSize()
Returns the number of entries in the playlist
|
protected PlaylistManager.PlayerCallback |
initCallback()
Returns a player callback handler links this manager to its associated player.
|
boolean |
isShuffleEnabled()
Checks if this player is in shuffle mode.
|
void |
load(int index)
Load the URL at the specified
index |
void |
loadAlternative()
Play another alternative URL for the current resource index
|
void |
loadNext()
Load the next URL in the playlist
|
void |
play(int index)
Play playlist entry at the specified
index |
void |
playNext()
Plays the next item in the playlist
|
void |
playNext(boolean force)
Plays the next item in the playlist
|
void |
playPrevious()
Plays the previous item in the playlist
|
void |
playPrevious(boolean force)
Plays the previous item in the playlist
|
void |
removeFromPlaylist(int index)
Removes the entry at the specified index from the players' playlist.
|
void |
setShuffleEnabled(boolean enable)
Enables or disables players' shuffle mode.
|
public PlaylistManager()
public PlaylistManager(AbstractMediaPlayer player)
player
- the player widgetprotected PlaylistManager.PlayerCallback initCallback()
This is a convenience method that should be overridden by sub-classes.
protected void flushMessageCache()
This method should ONLY be called by subclasses when the attached player is ready.
public boolean isShuffleEnabled()
PlaylistSupport
isShuffleEnabled
in interface PlaylistSupport
true
if player is in shuffle mode, false
otherwise.public void setShuffleEnabled(boolean enable)
PlaylistSupport
setShuffleEnabled
in interface PlaylistSupport
enable
- true
to enable shuffle, false
otherwisepublic void addToPlaylist(String mediaURL)
PlaylistSupport
In respect of the same domain policy of some plugins/browsers, the URL should point to a destination on the same domain where the application is hosted.
addToPlaylist
in interface PlaylistSupport
mediaURL
- the URL of the media.public void addToPlaylist(String... mediaURLs)
PlaylistSupport
The player chooses ONLY ONE of the mediaURLs
it supports.
In respect of the same domain policy of some browsers, the URLs should point to a destination on the same domain where the application is hosted.
addToPlaylist
in interface PlaylistSupport
mediaURLs
- the alternative URLs of the same media (probably in different formats).public void addToPlaylist(List<MRL> mediaLocators)
PlaylistSupport
addToPlaylist
in interface PlaylistSupport
mediaLocators
- list of alternative URLs of the same mediapublic void addToPlaylist(MRL mediaLocator)
PlaylistSupport
addToPlaylist
in interface PlaylistSupport
mediaLocator
- specifies alternative URLs of the same mediapublic void removeFromPlaylist(int index)
PlaylistSupport
removeFromPlaylist
in interface PlaylistSupport
index
- the index of the playlist entry.public void clearPlaylist()
PlaylistSupport
clearPlaylist
in interface PlaylistSupport
public void playNext() throws PlayException
PlaylistSupport
playNext
in interface PlaylistSupport
PlayException
- if there are no more entries in the playlist to be played. Especially if we've
advanced to the end of the playlist. Note: A player with a negative loop count (i.e. set to play
forever!) may not throw this exceptionpublic void playPrevious() throws PlayException
PlaylistSupport
playPrevious
in interface PlaylistSupport
PlayException
- if there are no more entries in the playlist to be played. Especially if we've
gotten to the beginning of the playlist. Note: A player with a negative loop count (i.e. set to play
forever!) may not throw this exceptionpublic void playNext(boolean force) throws PlayException
force
- true
if an end-of-playlist should roll over to the beginning, false
otherwise.PlayException
- if an end-of-playlist is reached. Only thrown if force
is falsepublic void playPrevious(boolean force) throws PlayException
force
- true
if a start-of-playlist should roll over to the end, false
otherwise.PlayException
- if a start-of-playlist is reached. Only thrown if force
is falsepublic void play(int index) throws IndexOutOfBoundsException
PlaylistSupport
index
play
in interface PlaylistSupport
index
- number of the playlist entryIndexOutOfBoundsException
- if index
is outside the bounds of the playlistpublic void loadAlternative() throws LoadException
LoadException
- if no alternative URL can be foundpublic void load(int index)
index
index
- the indexpublic void loadNext()
public String getCurrentItem()
public int getPlaylistSize()
PlaylistSupport
getPlaylistSize
in interface PlaylistSupport
public int getPlaylistIndex()
Copyright © 2009-2013. All Rights Reserved.