A track is one item in the
trackList.
It has no attributes. Every child is optional, so a track can be empty in
principle, though a player then has nothing to find.
Children
| Element | Count | Content | Meaning |
|---|---|---|---|
location | 0 or more | URI | The resource to render, usually audio but possibly video, SMIL or another XSPF document. A player must not render more than one of a track’s locations. |
identifier | 0 or more | URI | A canonical ID for the resource, such as a MusicBrainz ID. Must be a legal URI. |
title | 0 or 1 | text | Human-readable name of the work. Mainly for fuzzy lookups; may be displayed. |
creator | 0 or 1 | text | Human-readable name of the author of the work. Mainly for fuzzy lookups. |
annotation | 0 or 1 | text, no markup | A human-readable comment. Character data with no markup. |
info | 0 or 1 | URI | A place to buy the resource or find more information about it. |
image | 0 or 1 | URI | An image to show during the track. |
album | 0 or 1 | text | Human-readable name of the collection the track comes from. Mainly for fuzzy lookups. |
trackNum | 0 or 1 | nonNegativeInteger | The track’s position on the album. See below. |
duration | 0 or 1 | nonNegativeInteger | Length in milliseconds. A hint only; a player must not use it to set the rendering time. |
link | 0 or more | URI | As at playlist level, with a rel attribute. |
meta | 0 or more | text, no markup | As at playlist level, with a rel attribute. |
extension | 0 or more | nested XML | As at playlist level, with an application attribute. |
Numbers
The specification defines trackNum as an integer “with value greater
than zero”, then says it must be a valid XML Schema
nonNegativeInteger, which also allows 0. So a parser that follows the
data type accepts a trackNum of 0 even though the description rules it
out. A generator should write 1 or more. duration is a
nonNegativeInteger count of milliseconds, so 215 seconds is
215000.
Finding the media
XSPF separates a track’s identity from where it is stored. A location
is a direct address. identifier, and the fuzzy text of
title, creator and album, let a player or a
content resolver look for the same work elsewhere when the address fails. XSPF
itself is not a catalogue: it only says which songs to play.
<track>
<location>http://example.com/song_1.flac</location>
<location>http://mirror.example.net/song_1.ogg</location>
<identifier>urn:example:recording:12345</identifier>
<title>First Song</title>
<creator>Artist Name</creator>
<album>Album Title</album>
<trackNum>1</trackNum>
<duration>215000</duration>
<image>http://example.com/cover.jpg</image>
<info>http://example.com/album/</info>
</track>