Class Playlist

Class Summary

Playlist()
structured, organized playlist made-up of Playable objects.

Method Summary

Field Detail

events
object reference to specific Events object for Playlist
Playlist.events.addListener(APMPlayer.events.type.PLAYLIST_CURRENT_CHANGE, function() {} );

Method Detail

  • {boolean} add(playable)
    adds a valid Playable to the playlist.
    Playlist.add(playable);
    Parameters:
    {Playable} playable the playable to add.
    Returns:
    {boolean} success or failure.
  • {Playable} current()
    returns the current Playable in the playlist.
    Playlist.current();
    Returns:
    {Playable} returns a valid playable, or null if nothing in playlist.
  • {boolean} goto(identifier)
    finds appropriate Playable in playlist and switches current pointer to that playable, if it exists in the playlist.
    Playlist.goto('boring_bluegrass_song');
    Parameters:
    {string} identifier of a specific Playable.
    Events:
    Events.type.PLAYLIST_CURRENT_CHANGE fires upon successful update of current playlist item (see Events).
    Returns:
    {boolean} success or failure.
  • {boolean} hasNext()
    returns whether or not there is at least one more item before end of playlist
    Playlist.hasNext();
    Returns:
    {boolean} true if playlist has another item, false if at end of playlist
  • {Playable} item(identifier)
    returns specific Playable by identifier, if it exists in playlist
    Playlist.item('kick_ass_rock_song');
    Parameters:
    {string} identifier of a specific Playable.
    Returns:
    {Playable} if found, returns a valid playable, or null if non-existant.
  • {boolean} next()
    advances current() point to next Playable in playlist. Also moves current to beginning if at end of playlist.
    Playlist.next();
    Events:
    Events.type.PLAYLIST_CURRENT_CHANGE fires upon successful change of current playlist item (see Events). Also passes previous_playable back with the Event.
    Returns:
    {boolean} false if no items exist in playlist.
  • {boolean} previous()
    sets current() point to back one Playable in playlist. Also moves current to end if at beginning of playlist.
    Playlist.previous();
    Events:
    Events.type.PLAYLIST_CURRENT_CHANGE fires upon successful change of current playlist item (see Events). Also passes previous_playable back with the Event.
    Returns:
    {boolean} false if no items exist in playlist.
  • {boolean} remove(identifier)
    finds and removes a specifc Playable in playlist by identifier. The current playlist item may not be removed.
    Playlist.remove('brittany_spears_theft_of_the_dial');
    Parameters:
    {string} identifier of a specific Playable.
    Returns:
    {boolean} success or failure.