MediaItem

A MediaItem represents a partial or whole piece of media.

Summary
A MediaItem represents a partial or whole piece of media.
A timestamp representing the date and time at which this MediaItem was created.
A timestamp representing the date and time at which this MediaItem was last updated.
The URI representing the location of the MediaItem.
The size (in bytes) of the content of the MediaItem.
The content type, also called mime type, of the MediaItem.
The global unique identifier of this Library object.
The creation time of this Library object.
The last update time of this Library object.
Get the value of a property for this library object.
Set the value of a property for this library object.

MediaItem Properties

mediaCreated

A timestamp representing the date and time at which this MediaItem was created.

Type

Number

mediaUpdated

A timestamp representing the date and time at which this MediaItem was last updated.

Type

Number

contentSrc

The URI representing the location of the MediaItem.  If the URI is a URL, it may be QI’ed to an nsIURL.

Type

Number, in bytes.

contentLength

The size (in bytes) of the content of the MediaItem.  If this MediaItem is also a MediaList, the contentLength will always be 0.

The contentLength may not be available for streams

Type

Number, in bytes.

contentType

The content type, also called mime type, of the MediaItem.

Type

String

Note

This property is never filled currently.

Resource Properties

guid

The global unique identifier of this Library object.

Type

String

Note

MediaItem, MediaList and Library are all Library Objects.

created

The creation time of this Library object.

Type

Number, in (TODO units???)

Note

MediaItem, MediaList and Library are all Library Objects.

updated

The last update time of this Library object.  Changing any property constitutes an update.

Type

Number, in (TODO units???)

Note

MediaItem, MediaList and Library are all Library Objects.

Resource Methods

getProperty()

Get the value of a property for this library object.

Prototype

String getProperty(String id)

Parameters

idThe ID property value requested.

Example

//This example assumes you already have created
//a mediaitem and assigned it to mediaItem.

//Get the albumName property from a mediaitem.
var albumName = mediaItem.getProperty("http://songbirdnest.com/data/1.0#albumName");

Standard Properties

http://songbirdnest.com/data/1.0#albumDetailUrlA URL with information on the album
http://songbirdnest.com/data/1.0#albumNameThe name of the album
http://songbirdnest.com/data/1.0#artistDetailUrlA URL with information on the artist
http://songbirdnest.com/data/1.0#artistNameThe name of the artist
http://songbirdnest.com/data/1.0#bitRateThe bit rate of the media, in bits per second
http://songbirdnest.com/data/1.0#bpmThe number of beats per minute
http://songbirdnest.com/data/1.0#columnSpecColumn display data
http://songbirdnest.com/data/1.0#composerNameThe name of the composer
http://songbirdnest.com/data/1.0#copyrightURLA URL with information on the copyright
http://songbirdnest.com/data/1.0#defaultColumnSpecDefault column display data
http://songbirdnest.com/data/1.0#disableDownloadPrevent this item from being downloaded
http://songbirdnest.com/data/1.0#discNumberThe number of disc this media appears on in a compilation
http://songbirdnest.com/data/1.0#downloadDetailsDownload state and progress
http://songbirdnest.com/data/1.0#durationThe duration of this media, in microseconds
http://songbirdnest.com/data/1.0#enableAutoDownloadwhether this item should be automatically downloaded when added to the main library
http://songbirdnest.com/data/1.0#excludeFromHistoryThis track should not be logged in playback history when played
http://songbirdnest.com/data/1.0#genreThe genre of this media
http://songbirdnest.com/data/1.0#hiddenWhether this item should be hidden from the user
http://songbirdnest.com/data/1.0#isPartOfCompilationWhether this media is part of a compilation
http://songbirdnest.com/data/1.0#lastPlayTimeThe last time the media was played
http://songbirdnest.com/data/1.0#lyricistNameThe name of the lyricist
http://songbirdnest.com/data/1.0#lyricsThe lyrics of the media
http://songbirdnest.com/data/1.0#originPageThe page this media was located on
http://songbirdnest.com/data/1.0#originPageTitleThe title of the page this media was located on
http://songbirdnest.com/data/1.0#originURLThe URL this media was retrived from
http://songbirdnest.com/data/1.0#playCountThe number of times this media has been played
http://songbirdnest.com/data/1.0#primaryImageURLThe URL of the primary image
http://songbirdnest.com/data/1.0#producerNameThe name of the producer
http://songbirdnest.com/data/1.0#ratingThe user-set rating of the item, either 0 (unset) or in the range 1-5
http://songbirdnest.com/data/1.0#recordLabelNameThe name of the record label
http://songbirdnest.com/data/1.0#sampleRateThe sample rate of the media, in samples per second
http://songbirdnest.com/data/1.0#skipCountThe number of times this item was skipped
http://songbirdnest.com/data/1.0#totalDiscsThe total number of discs in a compilation
http://songbirdnest.com/data/1.0#totalTracksThe total number of tracks in a compilation
http://songbirdnest.com/data/1.0#trackNameThe name of the track
http://songbirdnest.com/data/1.0#trackNumberThe track number of this media in a compilation
http://songbirdnest.com/data/1.0#yearThe year the media was released

Note

Metadata for the MediaItems may get updated and overwritten during playback.  See Metadata Updates for more details about cases where metadata may get updated.

See Also

setProperty()

setProperty()

Set the value of a property for this library object.

Prototype

setProperty(String id, String value)

Example

//This example assumes you already have created
//a mediaitem and assigned it to mediaItem.

//Set the albumName property from a mediaitem.
mediaItem.setProperty("http://songbirdnest.com/data/1.0#albumName", "Let Us Play");

Standard Properties

http://songbirdnest.com/data/1.0#albumDetailUrlA URL with information on the album
http://songbirdnest.com/data/1.0#albumNameThe name of the album
http://songbirdnest.com/data/1.0#artistDetailUrlA URL with information on the artist
http://songbirdnest.com/data/1.0#artistNameThe name of the artist
http://songbirdnest.com/data/1.0#bitRateThe bit rate of the media, in bits per second
http://songbirdnest.com/data/1.0#bpmThe number of beats per minute
http://songbirdnest.com/data/1.0#columnSpecColumn display data
http://songbirdnest.com/data/1.0#composerNameThe name of the composer
http://songbirdnest.com/data/1.0#defaultColumnSpecDefault column display data
http://songbirdnest.com/data/1.0#disableDownloadPrevent this item from being downloaded
http://songbirdnest.com/data/1.0#discNumberThe number of disc this media appears on in a compilation
http://songbirdnest.com/data/1.0#downloadDetailsDownload state and progress
http://songbirdnest.com/data/1.0#durationThe duration of this media, in microseconds
http://songbirdnest.com/data/1.0#enableAutoDownloadwhether this item should be automatically downloaded when added to the main library
http://songbirdnest.com/data/1.0#excludeFromHistoryThis track should not be logged in playback history when played
http://songbirdnest.com/data/1.0#genreThe genre of this media
http://songbirdnest.com/data/1.0#hiddenWhether this item should be hidden from the user
http://songbirdnest.com/data/1.0#isPartOfCompilationWhether this media is part of a compilation
http://songbirdnest.com/data/1.0#lyricistNameThe name of the lyricist
http://songbirdnest.com/data/1.0#lyricsThe lyrics of the media
http://songbirdnest.com/data/1.0#primaryImageURLThe URL of the primary image
http://songbirdnest.com/data/1.0#producerNameThe name of the producer
http://songbirdnest.com/data/1.0#ratingThe user-set rating of the item, either 0 (unset) or in the range 1-5
http://songbirdnest.com/data/1.0#recordLabelNameThe name of the record label
http://songbirdnest.com/data/1.0#sampleRateThe sample rate of the media, in samples per second
http://songbirdnest.com/data/1.0#totalDiscsThe total number of discs in a compilation
http://songbirdnest.com/data/1.0#totalTracksThe total number of tracks in a compilation
http://songbirdnest.com/data/1.0#trackNameThe name of the track
http://songbirdnest.com/data/1.0#trackNumberThe track number of this media in a compilation
http://songbirdnest.com/data/1.0#yearThe year the media was released

Note

Metadata for the MediaItems may get updated and overwritten during playback.  See Metadata Updates for more details about cases where metadata may get updated.

See Also

getProperty()

A MediaItem represents a partial or whole piece of media.
A MediaList is a list of MediaItems.
A Library is a collection of MediaItems and MediaLists.
When a MediaItem gets played, it’s metadata may change because the playback core is offering new metadata about this MediaItem that wasn’t available when metadata was first read from it because it was added to a Library.
Set the value of a property for this library object.
Get the value of a property for this library object.