WebPlaylist

The WebPlaylist UI object.  This object controls the UI that appears at the bottom of the page.  The information accessible here and operations available here correspond to the the actual UI.  Selection, column modification and setting of the MediaList that serves as the data for the UI.

Columns

A note about columns.  All the columns in the UI are driven by the existance of global level properties in Songbird.  There are a number of types available to the developer ( see appendColumn() ).  Each column must have a unique name and there are a number system default names we use to get the default set of columns.  They are set when Songbird starts.  When a column name is required as a parameter to a function the default names can be used provided the operation is not trying to add a column of that name.  They can be passed in for the before column, or they can be hidden via hideColumn().

The default columns have names of this format -

http://songbirdnest.com/data/1.0#<columnIdentifier>

The complete list of column names can be found in http://publicsvn.songbirdnest.com- /browser- /trunk- /components- /property- /src- /sbStandardProperties.h

Summary
The WebPlaylist UI object.
The MediaList associated with this WebPlaylist instance.
The current selection in the WebPlaylist.
Set the selection in the WebPlaylist.
Is the WebPlaylist hidden?
Get the total number of columns in the web playlist
Clear all columns from the web playlist
Insert a column into the web playlist
Remove a column from the playlist
Get the property ID bould to a particular column at a given index
Set the sort of the web playlist

mediaList

The MediaList associated with this WebPlaylist instance.

Type

MediaList

selection

The current selection in the WebPlaylist.

Type

Enumerator, contains MediaItems.

Example

//Get the current webplaylist.
var webPlaylist = songbird.webPlaylist;


//Get the currently selected mediaitems in the webplaylist.
var selectedMediaItems = webPlaylist.selection;

//Go through all the selected mediaitems.

//The hasMoreElements method will return true until there are
//no more elements left to get using the getNext method.

while(selectedMediaItems.hasMoreElements()) {
var mediaItem = selectedMediaItems.getNext();

//Do something with the mediaitem.
...
}

See Also

Please see http://www.xulplanet.com- /references- /xpcomref- /ifaces- /nsISimpleEnumerator.html for nsISimpleEnumerator interface reference.

WebPlaylist Methods

setSelectionByIndex()

Set the selection in the WebPlaylist.

Prototype

setSelectionByIndex(Number index, Boolean selected)

Parameters

indexIndex of the item in the WebPlaylist.  Index starts at 0.
selectedFlag used for setting the selection state, may be true or false.

Example

//Get the current webPlaylist.
var webPlaylist = songbird.webPlaylist;

//Select the first item.
webPlaylist.setSelectionByIndex(0, true);

//Select the third item.
webPlaylist.setSelectionByIndex(2, true);

//Unselect the first item.
webPlaylist.setSelectionByIndex(0, false);

hidden

Is the WebPlaylist hidden?

Setting mediaList on the WebPlaylist will automatically make the WebPlaylist visible.  hidden is intended for more advanced uses where a web page might want to manipulate the visiblity of the WebPlaylist directly.

Type

boolean

Example

// show the webplaylist
songbird.webPlaylist.hidden = false;
// hide the webplaylist
songbird.webPlaylist.hidden = true;
// is the webplaylist hidden?
alert(songbird.webPlaylist.hidden?"It's hidden":"It's shown");

getColumnCount()

Get the total number of columns in the web playlist

See Also

clearColumns() insertColumnBefore() removeColumn()

clearColumns()

Clear all columns from the web playlist

appendColumn()

Arguments

aPropertyIDThe ID of the property you want to add as a column
aWidthThe width in pixels of the column.  If there has been a width set for this particular column then that width will be respected and this ignored.

Add a column to the right side of visible columns

insertColumnBefore()

Insert a column into the web playlist

Arguments

aPropertyIDThe ID of the property you want to add as a column
aBeforePropertyIDIf specified, the new column will appear before the column that is bound to the specified property.  If not specified, the column will be added to the end of the list.
aWidthThe width in pixels of the column.  If there has been a width set for this particular column then that width will be respected and this ignored.

removeColumn()

Remove a column from the playlist

Arguments

aPropertyIDThe ID of the property that is bound to the column you wish to remove.

getColumnPropertyIDByIndex()

Get the property ID bould to a particular column at a given index

Arguments

aIndexThe index of the column from which you want to retrieve the bound property

Returns

The ID of the property bound to the specified column

setSortColumn()

Set the sort of the web playlist

Arguments

aPropertyIDThe ID of the property that is bound to the column you wish to sort.
aIsAscendingTrue if the sort should be ascending, false if the sort should be descending.
The WebPlaylist UI object.
A MediaList is a list of MediaItems.
A MediaItem represents a partial or whole piece of media.
The MediaList associated with this WebPlaylist instance.
Is the WebPlaylist hidden?
Clear all columns from the web playlist
Insert a column into the web playlist
Remove a column from the playlist