The XSPF Playlist Format, version 0

Abstract

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

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, or open the same playlist with different software on the same machine, and have it be usable. Existing formats lack a number of features needed to make this work well.
  3. Well made -- there is a glaring lack of craftsmanship to existing formats. For example, no dominant playlist format declares a namespace. And while there are independent efforts to write a format with a high level of craftsmanship, the Gnomoradio format for example, writing data formats is too hard to succeed without a team.

Over the course of our work we also realized that the format had to scale down well. The dominant playlist format is M3U, which is just a flat listing of song paths, and many developers are satisfied enough to stick with it. SMIL is all three of open, portable and well made, but is too complex for many needs; simple SMIL playlists are not simple to implement. Similarly, RDF had well made solutions to many problems we faced, but RDF tools are never trivial (as of this writing). We went to great lengths to make trivial playlists trivial to implement.

Publication Status and authorship

This is an informal document not associated with any standards body. It is intended to be clear and readable rather than conformant with existing standards for such documents.

The home of our working group is 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.

This document is maintained by Lucas Gonze with help from members of the XSPF WG including Matthias Friedrich.

Creation date of this document is Sunday, May 9, 2004. The most recent edit is July 4, 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. xspf: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 or isbn URN (if there existed isbn numbers for audio). 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. xspf:track elements MAY contain exactly one.
annotation
A human-readable comment on the track in text/plain format. xspf: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. xspf: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. xspf: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. xspf: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. xspf: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. xspf:track elements MAY contain exactly one.
link

The link element allows non-XSPF web resources to be included in xspf:track elements 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:track elements 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.

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

Todo list

  1. Table of contents.
  2. XSLT-friendly formatting, to allow for reformatting.
  3. Architectural notes on fuzzy search, catalogs, and content resolvers.
  4. Bug and issue list for XSPF.
  5. Contact address for bugs in this document and in XSPF.
  6. Named anchors for elements.
  7. Spell check.
  8. Solicit feedback on formatting of this document.
  9. Section to tell developers why they should support XSPF.
  10. Names of WG members.

Validate HTML

Validate CSS