Note: this is draft 2. It is superceded by draft 8.

The XSPF Playlist Format

Abstract

This document describes a playlist format named "XSPF", which stands for "XML Shareable Playlist Format". "XSPF" can be pronounced "spiff".

The genesis of this project came from the mutual recognition that the quality of playlist formats fell far below the normal standard for hypertext document types like HTML, RDF and Atom. Our goals were to create a playlist format that is all three of:
  1. Open -- existing formats are either ad-hoc standards with no owner, like M3U, or proprietary, like ASX.
  2. Portable -- you should be able to send a playlist sans content to your friend and have it be usable. Existing formats lacked a number of features needed to make this work well.
  3. Well made -- there is a glaring lack of craftsmanship to existing standards. For example, no important playlist format declares a namespace.

Publication Status and authorship

This is an informal document not associated with any standards body. It may become a formal document, but for the moment it is intended to be clear and readable rather than conformant with existing standards for such documents.

The home of our working group is a Wiki at http://playlist.musicbrainz.org/playlist/moin.cgi; we are in the process of moving to http://xspf.org. On IRC, we use #playlist on irc.freenode.net. There are perhaps six regular contributors, with another six commenting from time to time. Contributors came from two major audio software vendors, a major weblog aggregator, the W3C, and two significant .org sites related to music. We worked in the skunkworks style and were not sponsored by any organization or standards body. Our purpose was to engineer a high-quality design rather than to create normative requirements for interoperability.

The primary author of this document is Lucas Gonze. Creation date of this document is Sunday, May 9, 2004.

Example

A very simple playlist looks like this:

<?xml version="1.0" encoding="UTF-8"?> <playlist xmlns = "http://playlist.musicbrainz.org/playlist/moin.cgi/FrontPage/"> <trackList> <track><location>file:///mp3s/Yo+La+Tengo/And+Then+Nothing+Turned+Itself+Inside-Out</location></track> <track><location>file:///mp3s/Yo+La+Tengo/Genius+%2B+Love+%3D+Yo+La+Tengo+%28Disc+2%29</location></track> <track><location>file:///mp3s/Yo+La+Tengo/I+Can+Hear+The+Heart+Beating+As+One</location></track> <track><location>file:///mp3s/Yo+La+Tengo/Nuclear+War</location></track> <track><location>file:///mp3s/Yo+La+Tengo/Summer+Sun</location></track> </trackList> </playlist>

Element Definitions

xml
version
1.0
encoding
utf-8
playlist
namespace
http://xspf.org/ns/0/
title
A human-readable title for the playlist. xspf:playlist elements MAY contain exactly one.
annotation
A human-readable comment on the playlist in text/plain format. xspf:playlist elements MAY contain exactly one.
creator
Human-readable name of the entity (author, authors, group, company, etc) that authored the playlist. xspf:playlist elements MAY contain exactly one.
info
URI of a web page to find out more about this playlist. Likely to be homepage of the author, and would be used to find out more about the author and to find more playlists by the author. xspf:playlist elements MAY contain exactly one.
location
Source URI for this playlist. xspf:playlist elements MAY contain zero or more location elements.
identifier
Canonical ID for this playlist. Likely to be a hash or other location-independent name. MUST be a legal URI. xspf:playlist elements MAY contain zero or more identifier elements.
image
URI of an image to display in the absence of a //playlist/trackList/image element. xspf:playlist elements MAY contain exactly one.
date
ISO8601 creation date (not last-modified date) of the playlist. xspf:playlist elements MAY contain exactly one.
license
URI of a resource that describes the license under which this playlist was released.
attribution

An ordered list of URIs. The purpose is to satisfy licenses allowing modification but requiring attribution. If you modify such a playlist, move its //playlist/location element or //playlist/identifier to the top of the items in the //playlist/attribution element. xspf:playlist elements MAY contain exactly one xspf:attribution element.

<attribution> <location>http://snafu.com/modified_version_of_modified_version_of_original_playlist.xspf</location> <location>http://bar.com/modified_version_of_original_playlist.xspf</location> <location>http://foo.com/original_playlist.xspf</location> </attribution>

link

The link element allows non-XSPF web resources to be included in XSPF documents without breaking XSPF validation.

<link rel="http://foaf.org/namespace/version1">http://socialnetwork.org/foaf/mary.rdfs</link>

rel
URI of a resource type.

URI of a resource.

meta

The meta element allows non-XSPF metadata to be included in XSPF documents without breaking XSPF validation.

<meta rel="http://example.org/key">value</meta>

rel
URI of a resource defining the metadata.

Value of the metadata element. MUST be valid text/plain, not XML.

trackList

Ordered list of xspf:track elements to be rendered. xspf:track elements MUST be rendered in the order in which they appear, from top to bottom, unless a different ordering is otherwise indicated. If an xspf:track element cannot be rendered, a user-agent MUST skip to the next xspf:track element and MUST NOT interrupt the sequence.

track
location
URI of resource to be rendered. Probably an audio resource, but MAY be any type of resource with a well-known duration, such as video, a SMIL document, or an XSPF document. The duration of the resource defined in this element defines the duration of rendering. //playlist/trackList/track elements MAY contain zero or more location elements, but a user-agent MUST NOT render more than one of the named resources.
identifier
Canonical ID for this resource. Likely to be a hash or other location-independent name, such as a MusicBrainz identifier like http://musicbrainz.org/track/28af4859-5f9e-483f-8ff3-3dc1e5a6f19d. MUST be a legal URI. xspf:playlist elements MAY contain zero or more identifier elements.
info
URI of a place where this resource can be bought or more info can be found.
image
URI of an image to display for the duration of the track. //playlist/trackList/track elements MAY contain exactly one.
annotation
A human-readable comment on the track in text/plain format. //playlist/trackList/track elements MAY contain exactly one.
creator
Human-readable name of the entity (author, authors, group, company, etc) that authored the resource which defines the duration of track rendering. This value is primarily for fuzzy lookups, though a user-agent may display it. //playlist/trackList/track elements MAY contain exactly one.
title
Human-readable name of the track that authored the resource which defines the duration of track rendering. This value is primarily for fuzzy lookups, though a user-agent may display it. //playlist/trackList/track elements MAY contain exactly one.
album
Human-readable name of the collection from which the resource which defines the duration of track rendering comes. For a song originally published as a part of a CD or LP, this would be the title of the original release. This value is primarily for fuzzy lookups, though a user-agent may display it. //playlist/trackList/track elements MAY contain exactly one.
trackNum
Integer with value greater than zero giving the ordinal position of the media on the xspf:album. This value is primarily for fuzzy lookups, though a user-agent may display it. //playlist/trackList/track elements MAY contain exactly one.
duration
Number giving the length of the media. This value is primarily for fuzzy lookups, though a user-agent may display it. A user-agent MUST NOT use this value to determine the rendering duration, since the data will likely be low quality. The exact format of this value is still under discussion. //playlist/trackList/track elements MAY contain exactly one.

Recipes

How do I set relative paths in an XSPF playlist, for example if I want to use it as a file manifest?

See the XML Base specification or IETF RFC 2396:

The rules for determining the base URI can be summarized as follows (highest priority to lowest):
  1. The base URI is embedded in the document's content.
  2. The base URI is that of the encapsulating entity (message, document, or none).
  3. The base URI is the URI used to retrieve the entity.
  4. The base URI is defined by the context of the application.
How to I convert XSPF to M3U?
Use the xspf2m3u.xsl stylesheet.
How to I convert XSPF to HTML?
Use the xspf2html.xsl stylesheet.
How to I convert XSPF to SMIL?
Use the xspf2smil.xsl stylesheet.
How to I convert XSPF to Soundblox?
Use the xspf2sblx.xsl stylesheet.

Administrative

Validate HTML

Validate CSS