ILikeDisplayPlaylist

From iLike

Jump to: navigation, search

The script command iLikeDisplayPlaylist() will display a full playlist within your HTML or FBML page. You provide a playlist ID, and we will store the music for the playlist, offering a standard interface for your page visitors to edit the playlist or add music.

Calling this script function will display a playlist object in place of an existing element within the page object model. You pass in the DOM element (the object on the page that will be replaced by the playlist), the playlist ID, as well as the "mode" for displaying the playlist.

Contents

Parameters

  • devKey - your developer key, unless set in the global variable _iLikeDevKey
  • elId - the Document Object Model element to be replaced by the playlist. elId needs to be a block-level element such as a DIV. We will set the width of elId to 450px, and the height will adjust to display as many songs as needed. Please design the page so that elId can expand in height to display with variable height. Make sure that elId can be resized without obstruction of the display of the song. (Note: the iLike terms of use require that you don't obstruct or attempt to hack or reconfigure the display of UI by the iLike Developer Platform)
  • playlistName - named value that you choose. This is the unique identifier for the playlist, that iLike will use to look up the songs in the playlist. Note that this value is only unique to your developer key -- it does not need to be globally unique across all other playlists.
  • maxSongs - optional, the maximum number of songs that can be added to the playlist. If not specified, or if set to 0, the number of songs allowed will be unlimited. (Note that iLike is currently limiting playlists to a 100-song maximum, but this may change in the future)
  • maxHeight - HTML only - optional, the maximum vertical height (in px) which the playlist can use. If necessary the list will scroll. Note that the minimum allowed value is 120, any lower value will be adjusted up.
  • editMode - optional, set this value to "edit", "view", or "add", to specify how the playlist interface should display. If not present the playlist defaults to "view" mode.
    • "view" displays the playlist in read-only mode. If one user (editor) is to create a playlist for others to view, then use this setting when other users (non-editors) view the playlist
    • "add" allows for adding songs only (users can't remove or change the order of songs they add). This mode is ideal for group-editing of songs in a playlist
    • "edit" allows for adding songs, removing songs, and changing playlist order. This is the natural mode for the main editor of a playlist to rearrange and remove songs
  • showNumbers - optional, if set to true, shows the song position in the playlist as a number before the song
  • onDisplay - optional, if provided this function will receive callbacks when the playlist is rendered instead of the global iLikeOnDisplayPlaylist callback, see iLikeOnDisplayPlaylist for details

Callback

A playlist callback may be defined as a global function called iLikeOnDisplayPlaylist or any function passed in the onDisplay parameter.

If a callback function is supplied it will be called each time the playlist is rendered, letting you know what editMode, the size of the playlist, etc. For full details see iLikeOnDisplayPlaylist.

Usage

This sample code will display a playlist in edit mode, with a playlist max-length of 15 songs.

<div id="playlist1" />
 
<script>
  iLikeDisplayPlaylist({elId:"playlist1", playlistName:"p1", maxSongs:"15", editMode:"edit"});
</script>

Where is the playlist stored?

iLike will take care of storing the list of songs in the playlist, as identified by the unique playlistName you provide, plus your developer key. To protect the data in your playlist, the playlist may only be displayed or edited when invoked from HTML or FBML based on the secure referers you list when you initially set up your developer key.

Further, as you may notice, you don't need to keep track of what songs are saved, iLike will take care of it for you. However, don't worry, your data is safe with iLike - iLike already stores tens of millions of user playlists without data loss, and the iLike platform re-uses this same storage. And if you're worried about data portability, iLike is taking a very open "don't be evil" approach on this. We will soon provide APIs for services such as querying the songs in a playlist, or adding and removing songs.

How do I know the size of the playlist?

Implement a playlist callback, and you can find out the length of the playlist each time it is rendered.

Examples

Related pages

Personal tools