ILikeDisplaySong

From iLike

Jump to: navigation, search

The script command iLikeDisplaySong() will display a playable song object within your HTML or FBML page. Calling this script function will put a playable song object in place of an existing element within the page object model. You pass in the DOM element (the object on the page that should be replaced by the song), and the information to identify the song (either by track ID or by song/artist name).

Contents

Parameters

  • devKey - your developer key, unless set in the global variable _iLikeDevKey
  • elId - the Document Object Model element to be replaced by a song. elId needs to be a block-level element such as a DIV. We will set the width of elId to 400px, and the height will adjust to display a song. 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)
  • songName - the name of the song to display
  • artistName - the name of the artist
  • trackIds - if no song/artist are specified, the ID (or IDs) of songs to display

Usage

If you want to build a service or feature that deals with single songs that are editorially chosen by you, you can use iLikeDisplaySong to show and play music based on your editorial selection - just pass in the song name and artist name in the specified parameters. For example, the following code will replace the DIV names "song1" with a playable version of the song Clocks by Coldplay:

<div id="song1" /> 

<script>
  iLikeDisplaySong({elId: "song1", songName: "Clocks", artistName: "Coldplay"});
</script>

If you want to build an interactive appication or service where your users choose songs (for example, to allow one user to add a song to a message that is sent to another user), you need to use the iLikeSongChooser - this displays a search interface for a user to choose a song, and gives you back a track ID. Next, you can display a song by track ID. Specifying multiple track IDs will display a playlist of songs. For example:

iLikeDisplaySong({elId:"song2", trackIds:"20370"}); 
iLikeDisplaySong({elId:"song3", trackIds:"20366,20368,20372"});

Examples

Related pages

Personal tools