XEP-0118: User Tune

This document defines an XMPP protocol extension for communicating information about the music to which a user is listening.


NOTICE: The protocol defined herein is a Draft Standard of the XMPP Standards Foundation. Implementations are encouraged and the protocol is appropriate for deployment in production systems, but some changes to the protocol are possible before it becomes a Final Standard.


Document Information

Series: XEP
Number: 0118
Publisher: XMPP Standards Foundation
Status: Draft
Type: Standards Track
Version: 1.0
Last Updated: 2004-11-12
Approving Body: XMPP Council
Dependencies: XMPP Core, XMPP IM, XEP-0060
Supersedes: None
Superseded By: None
Short Name: tune
Schema: <http://www.xmpp.org/schemas/tune.xsd>
Wiki Page: <http://wiki.jabber.org/index.php/User Tune (XEP-0118)>

Author Information

Peter Saint-Andre

Email: stpeter@jabber.org
JabberID: stpeter@jabber.org

Legal Notice

This XMPP Extension Protocol is copyright 1999 - 2007 by the XMPP Standards Foundation (XSF) and is in full conformance with the XSF's Intellectual Property Rights Policy <http://www.xmpp.org/extensions/ipr-policy.shtml>. This material may be distributed only subject to the terms and conditions set forth in the Creative Commons Attribution License (<http://creativecommons.org/licenses/by/2.5/>).

Discussion Venue

The preferred venue for discussion of this document is the Standards discussion list: <http://mail.jabber.org/mailman/listinfo/standards>.

Relation to XMPP

The Extensible Messaging and Presence Protocol (XMPP) is defined in the XMPP Core (RFC 3920) and XMPP IM (RFC 3921) specifications contributed by the XMPP Standards Foundation to the Internet Standards Process, which is managed by the Internet Engineering Task Force in accordance with RFC 2026. Any protocol defined in this document has been developed outside the Internet Standards Process and is to be understood as an extension to XMPP rather than as an evolution, development, or modification of XMPP itself.

Conformance Terms

The following keywords as used in this document are to be interpreted as described in RFC 2119: "MUST", "SHALL", "REQUIRED"; "MUST NOT", "SHALL NOT"; "SHOULD", "RECOMMENDED"; "SHOULD NOT", "NOT RECOMMENDED"; "MAY", "OPTIONAL".


Table of Contents


1. Introduction
2. Protocol
    2.1. Container Element and Child Elements
    2.2. Transport Mechanism
    2.3. Stop Command
3. Implementation Notes
4. Security Considerations
5. IANA Considerations
6. XMPP Registrar Considerations
    6.1. Protocol Namespaces
7. XML Schema
Notes
Revision History


1. Introduction

This document defines a protocol for communicating information about the music to which a user is listening. Such information may be seen as a kind of "extended presence", and users may want to communicate such information to their contacts on the network as a fun add-on to traditional IM applications or to provide integration with common music-player applications.

2. Protocol

2.1 Container Element and Child Elements

Information about tunes is provided by the user and propagated on the network by the user's client. The information container for tune data is a <tune/> element that is qualified by the 'http://jabber.org/protocol/tune' namespace. The tune information itself is provided as the XML character data of the following children of the <tune/> element:

Table 1: Child Elements

Element Description Example Datatype
artist The artist or performer of the song or piece Yes xs:string
title The title of the song or piece Heart of the Sunrise xs:string
source The collection (e.g., album) or other source (e.g., a band website that hosts streams or audio files) Yessongs xs:string
track A unique identifier for the tune; e.g., the track number within a collection or the specific URI for the object (e.g., a stream or audio file) 3 xs:string
length The duration of the song or piece in seconds 686 xs:unsignedShort

NOTE: The datatypes specified above are defined in XML Schema Part 2 [1].

2.2 Transport Mechanism

Tune information SHOULD be communicated and transported by means of the Publish-Subscribe [2] protocol or the subset of publish-subscribe specified in Personal Eventing via Pubsub [3]. Because tune information is not pure presence information and can change independently of the user's availability, it SHOULD NOT be provided as an extension to <presence/>.

Note: The following examples show use of the publish-subscribe subset specified in XEP-0163.

Example 1. User Publishes Tune Information

<iq type='set'
    from='stpeter@jabber.org/work'
    to='pubsub.jabber.org'
    id='tunes123'>
  <pubsub xmlns='http://jabber.org/protocol/pubsub'>
    <publish node='http://jabber.org/protocol/tune'>
      <item id='jg939lalsd92l11jdlsd'>
        <tune xmlns='http://jabber.org/protocol/tune'>
          <artist>Yes</artist>
          <title>Heart of the Sunrise</title>
          <source>Yessongs</source>
          <track>3</track>
          <length>686</length>
        </tune>
      </item>
    </publish>
  </pubsub>
</iq>
    

The tune information is then delivered to all subscribers:

Example 2. Tune Information is Delivered to All Subscribers

<message
    from='pubsub.jabber.org'
    to='maineboy@jabber.org'>
  <event xmlns='http://jabber.org/protocol/pubsub#event'>
    <items node='http://jabber.org/protocol/tune'>
      <item id='jg939lalsd92l11jdlsd'>
        <tune xmlns='http://jabber.org/protocol/tune'>
          <artist>Yes</artist>
          <title>Heart of the Sunrise</title>
          <source>Yessongs</source>
          <track>3</track>
          <length>686</length>
        </tune>
      </item>
    </items>
  </event>
</message>
.
.
.
    

As mentioned in XEP-0060, the stanza containing the event notification or payload MAY also include 'replyto' data (as specified by the Extended Stanza Addressing [4] protocol) to provide an explicit association between the published data and the user:

Example 3. Event notification with extended stanza addressing

<message
    from='pubsub.jabber.org'
    to='maineboy@jabber.org'>
  <event xmlns='http://jabber.org/protocol/pubsub#event'>
    <items node='http://jabber.org/protocol/tune'>
      <item id='jg939lalsd92l11jdlsd'>
        <tune xmlns='http://jabber.org/protocol/tune'>
          <artist>Yes</artist>
          <title>Heart of the Sunrise</title>
          <source>Yessongs</source>
          <track>3</track>
          <length>686</length>
        </tune>
      </item>
    </items>
  </event>
  <addresses xmlns='http://jabber.org/protocol/address'>
    <address type='replyto' jid='juliet@capulet.com'/>
  </addresses>
</message>
    

Naturally, further extensions could be included, e.g., using Out-of-Band Data [5] to specify a URL where one could buy the recording.

Example 4. Tune info with URL

<message
    from='pubsub.jabber.org'
    to='maineboy@jabber.org'>
  <event xmlns='http://jabber.org/protocol/pubsub#event'>
    <items node='http://jabber.org/protocol/tune'>
      <item id='jg939lalsd92l11jdlsd'>
        <tune xmlns='http://jabber.org/protocol/tune'>
          <artist>Yes</artist>
          <title>Heart of the Sunrise</title>
          <source>Yessongs</source>
          <track>3</track>
          <length>686</length>
	  <x xmlns='jabber:x:oob'>
	    <url>http://www.amazon.com/exec/obidos/ASIN/B000002J1Y</url>
	  </x>
        </tune>
      </item>
    </items>
  </event>
</message>
    

2.3 Stop Command

In order to indicate that the user is no longer listening to any tunes, the user's client SHOULD send an empty <tune/> element, which can be considered a "stop command" for user tunes:

Example 5. User Publishes "Stop Playing" Information

<iq type='set'
    from='stpeter@jabber.org/work'
    to='pubsub.jabber.org'
    id='tunes345'>
  <pubsub xmlns='http://jabber.org/protocol/pubsub'>
    <publish node='http://jabber.org/protocol/tune'>
      <item id='jg939lalsd92l11jdlsd'>
        <tune xmlns='http://jabber.org/protocol/tune'/>
      </item>
    </publish>
  </pubsub>
</iq>
    

Example 6. Empty Tune Information is Delivered to All Subscribers

<message
    from='pubsub.jabber.org'
    to='maineboy@jabber.org'>
  <event xmlns='http://jabber.org/protocol/pubsub#event'>
    <items node='http://jabber.org/protocol/tune'>
      <item id='jg939lalsd92l11jdlsd'>
        <tune xmlns='http://jabber.org/protocol/tune'/>
      </item>
    </items>
  </event>
</message>
.
.
.
    

3. Implementation Notes

To prevent a large number of updates when a user is skipping through tracks, an implementation may wait several seconds before publishing new tune information.

If the length is unknown (e.g., the user is listening to a stream), the <length/> element SHOULD NOT be included.

4. Security Considerations

This protocol introduces no security considerations above and beyond those defined in Publish-Subscribe (XEP-0060).

5. IANA Considerations

This document requires no interaction with the Internet Assigned Numbers Authority (IANA) [6].

6. XMPP Registrar Considerations

6.1 Protocol Namespaces

The XMPP Registrar [7] includes 'http://jabber.org/protocol/tune' in its registry of protocol namespaces.

7. XML Schema

<?xml version='1.0' encoding='UTF-8'?>

<xs:schema
    xmlns:xs='http://www.w3.org/2001/XMLSchema'
    targetNamespace='http://jabber.org/protocol/tune'
    xmlns='http://jabber.org/protocol/tune'
    elementFormDefault='qualified'>

  <xs:annotation>
    <xs:documentation>
      The protocol documented by this schema is defined in
      XEP-0118: http://www.xmpp.org/extensions/xep-0118.html
    </xs:documentation>
  </xs:annotation>

  <xs:element name='tune'>
    <xs:complexType>
      <xs:sequence minOccurs='0'>
        <xs:element name='artist' type='xs:string' minOccurs='0'/>
        <xs:element name='title' type='xs:string' minOccurs='0'/>
        <xs:element name='source' type='xs:string' minOccurs='0'/>
        <xs:element name='track' type='xs:string' minOccurs='0'/>
        <xs:element name='length' type='xs:unsignedShort' minOccurs='0'/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

</xs:schema>
  

Notes

1. XML Schema Part 2: Datatypes <http://www.w3.org/TR/xmlschema-2/>.

2. XEP-0060: Publish-Subscribe <http://www.xmpp.org/extensions/xep-0060.html>.

3. XEP-0163: Personal Eventing via Pubsub <http://www.xmpp.org/extensions/xep-0163.html>.

4. XEP-0033: Extended Stanza Addressing <http://www.xmpp.org/extensions/xep-0033.html>.

5. XEP-0066: Out of Band Data <http://www.xmpp.org/extensions/xep-0066.html>.

6. The Internet Assigned Numbers Authority (IANA) is the central coordinator for the assignment of unique parameter values for Internet protocols, such as port numbers and URI schemes. For further information, see <http://www.iana.org/>.

7. The XMPP Registrar maintains a list of reserved protocol namespaces as well as registries of parameters used in the context of XMPP extension protocols approved by the XMPP Standards Foundation. For further information, see <http://www.xmpp.org/registrar/>.


Revision History

Version 1.0 (2004-11-12)

Per a vote of the Jabber Council, advanced status to Draft. (psa)

Version 0.10 (2004-10-29)

Added example with URL. (psa)

Version 0.9 (2004-10-27)

Changed recommendation to not include the <length/> element if the track time is unknown. (psa)

Version 0.8 (2004-10-26)

Added implementation notes; clarified nature of <source/> and <track/> elements; if length is unknown, set to zero. (psa)

Version 0.7 (2004-05-20)

Changed <length/> datatype from xs:duration to xs:unsignedShort. (psa)

Version 0.6 (2004-04-25)

Corrected several errors; added reference to XEP-0033. (psa)

Version 0.5 (2004-02-19)

Reverted from infobits to tune elements. (psa)

Version 0.4 (2003-12-14)

Slight modifications to track changes to infobits specifications. (psa)

Version 0.3 (2003-10-23)

Replaced tune elements with infobits. (psa)

Version 0.2 (2003-09-10)

Added "stop" function via empty <tune/> element. (psa)

Version 0.1 (2003-09-08)

Initial version. (psa)

END