<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type='text/xsl' href='xep.xsl'?>
<xep xmlns="">
<header>
  <title>Jingle Content Thumbnails</title>
  <abstract>This specification defines a way for a client to supply a preview image for Jingle content.</abstract>
  
<legal>
<copyright>This XMPP Extension Protocol is copyright © 1999 – 2024 by the <link url="https://xmpp.org/">XMPP Standards Foundation</link> (XSF).</copyright>
<permissions>Permission is hereby granted, free of charge, to any person obtaining a copy of this specification (the "Specification"), to make use of the Specification without restriction, including without limitation the rights to implement the Specification in a software program, deploy the Specification in a network service, and copy, modify, merge, publish, translate, distribute, sublicense, or sell copies of the Specification, and to permit persons to whom the Specification is furnished to do so, subject to the condition that the foregoing copyright notice and this permission notice shall be included in all copies or substantial portions of the Specification. Unless separate permission is granted, modified works that are redistributed shall not contain misleading information regarding the authors, title, number, or publisher of the Specification, and shall not claim endorsement of the modified works by the authors, any organization or project to which the authors belong, or the XMPP Standards Foundation.</permissions>
<warranty>## NOTE WELL: This Specification is provided on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. ##</warranty>
<liability>In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall the XMPP Standards Foundation or any author of this Specification be liable for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising from, out of, or in connection with the Specification or the implementation, deployment, or other use of the Specification (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if the XMPP Standards Foundation or such author has been advised of the possibility of such damages.</liability>
<conformance>This XMPP Extension Protocol has been contributed in full conformance with the XSF's Intellectual Property Rights Policy (a copy of which can be found at &lt;<link url="https://xmpp.org/about/xsf/ipr-policy">https://xmpp.org/about/xsf/ipr-policy</link>&gt; or obtained by writing to XMPP Standards Foundation, P.O. Box 787, Parker, CO 80134 USA).</conformance>
</legal>
  <number>0264</number>
  <status>Experimental</status>
  <type>Standards Track</type>
  <sig>Standards</sig>
  <approver>Council</approver>
  <dependencies>
    <spec>XMPP Core</spec>
    <spec>XEP-0096</spec>
    <spec>XEP-0231</spec>
  </dependencies>
  <supersedes/>
  <supersededby/>
  <shortname>thumbs</shortname>
  
  <author>
    <firstname>Marcus</firstname>
    <surname>Lundblad</surname>
    <email>ml@update.uu.se</email>
    <jid>mlundblad@jabber.org</jid>
  </author>

  
  <author>
    <firstname>Lance</firstname>
    <surname>Stout</surname>
    <email>lance@andyet.com</email>
    <jid>lance@lance.im</jid>
  </author>

  <revision>
    <version>0.4.2</version>
    <date>2024-07-24</date>
    <initials>egp</initials>
    <remark>
      <p>Restrict 'width' and 'height' to the 0..65535 range, instead of being unbounded integers.  This is in accordance to XEP-0084 and XEP-0221 for instance.</p>
    </remark>
  </revision>
  <revision>
    <version>0.4.1</version>
    <date>2022-09-05</date>
    <initials>lnj</initials>
    <remark>
      <p>Update xmlns in schema (was not updated when bumping)</p>
    </remark>
  </revision>
  <revision>
    <version>0.4</version>
    <date>2015-08-26</date>
    <initials>ljts</initials>
    <remark>
      <p>Changed format to use generic 'uri' attribute to allow for 'https:' and 'http:' URIs in addition to BoB 'cid:' URIs.</p>
      <p>Indicated that multiple thumbnails may be present.</p>
      <p>Expanded scope of use cases to be Jingle content in general, not just file transfer.</p>
    </remark>
  </revision>
  <revision>
    <version>0.3</version>
    <date>2009-04-27</date>
    <initials>ml</initials>
    <remark><p>Fixed typo in author's name :).</p></remark>
  </revision>
  <revision>
    <version>0.2</version>
    <date>2009-04-06</date>
    <initials>ml</initials>
    <remark><p>Add paragraph in security section about protecting against malicious thumbnail dimensions in offer. Fixed a typo.</p></remark>
  </revision>
  <revision>
    <version>0.1</version>
    <date>2009-04-02</date>
    <initials>psa</initials>
    <remark><p>Initial published version.</p></remark>
  </revision>
  <revision>
    <version>0.0.3</version>
    <date>2009-03-10</date>
    <initials>ml</initials>
    <remark><p>Split use-case section into "Introduction", "Requirements", and "Use case".</p>
    </remark>
  </revision>
  <revision>
    <version>0.0.2</version>
    <date>2009-02-25</date>
    <initials>ml</initials>
    <remark><p>Removed service disovery.
Added missing namespace on thumnail elements.</p>
    </remark>
  </revision>
  <revision>
    <version>0.0.1</version>
    <date>2009-02-23</date>
    <initials>ml</initials>
    <remark><p>First draft.</p></remark>
  </revision>
</header>
<section1 topic="Introduction" anchor="introduction">
  <p>When offering a Jingle session, it can be helpful to provide a small preview of the offered content to help the session responder decide whether to accept or reject the session.</p>
  <p>This is particularly useful for file transfer content (especially image files), but can also be used for things such as video (e.g. using a still frame from the stream as the preview thumbnail), and even audio by using a small image of album cover art.</p>
</section1>
<section1 topic="Requirements" anchor="requirements">
  <p>This documents defines a way to include a thumbnail image as an additional metadata in a Jingle content description.</p>
</section1>
<section1 topic="Use Cases" anchor="usecase">
  <p>When a client wishes to supply a thumbnail in a content offer, it can do so by including an extra &lt;thumbnail/&gt; element as shown in the following example:</p>
  <example caption="Inclusion of a thumbnail in a Jingle file transfer offer"><![CDATA[
<iq from='romeo@montague.lit/orchard'
    id='nzu25s8'
    to='juliet@capulet.lit/balcony'
    type='set'>
  <jingle xmlns='urn:xmpp:jingle:0'
          action='session-initiate'
          initiator='romeo@montague.lit/orchard'
          sid='851ba2'>
    <content creator='initiator' name='a-file-offer'>
      <description xmlns='urn:xmpp:jingle:apps:file-transfer:4' senders='initiator'>
        <file>
          <media-type>image/jpeg</media>
          <name>image.jpg</name>
          <size>3032449</size>
          <hash xmlns='urn:xmpp:hashes:1' algo='sha-1'>552da749930852c69ae5d2141d3766b1</hash>
          <desc>This is a test. If this were a real file...</desc>
          <thumbnail xmlns='urn:xmpp:thumbs:1'
                     uri='cid:sha1+ffd7c8d28e9c5e82afea41f97108c6b4@bob.xmpp.org'
                     media-type='image/png'
                     width='128'
                     height='96'/>
        </file>
      </description>
      <transport .../>
    </content>
  </jingle>
</iq>]]></example>

  <p>Thumbnails MAY be included for Jingle content other than file transfer. For example, with Jingle RTP video a thumbnail could be included to show who is calling (either by capturing a still frame from the input stream or by using an existing profile image):</p>
  <example caption="Inclusion of a thumbnail in a Jingle RTP video session"><![CDATA[
<iq from='romeo@montague.lit/orchard'
    id='ih28sx61'
    to='juliet@capulet.lit/balcony'
    type='set'>
  <jingle xmlns='urn:xmpp:jingle:1'
          action='session-initiate'
          initiator='romeo@montague.lit/orchard'
          sid='a73sjjvkla37jfea'>
    <content creator='initiator' name='webcam'>
      <description xmlns='urn:xmpp:jingle:apps:rtp:1' media='video'>
        <payload-type id='98' name='theora' clockrate='90000'>
          <parameter name='height' value='600'/>
          <parameter name='width' value='800'/>
          <parameter name='delivery-method' value='inline'/>
          <parameter name='configuration' value='somebase16string'/>
          <parameter name='sampling' value='YCbCr-4:2:2'/>
        </payload-type>
        <payload-type id='28' name='nv' clockrate='90000'/>
        <payload-type id='25' name='CelB' clockrate='90000'/>
        <payload-type id='32' name='MPV' clockrate='90000'/>
        <bandwidth type='AS'>128</bandwidth>
        <thumbnail xmlns='urn:xmpp:thumbs:1'
                   uri='cid:sha1+ffd7c8d28e9c5e82afea41f97108c6b4@bob.xmpp.org'
                   media-type='image/png'
                   width='128'
                   height='96'/>
      </description>
      <transport .../>
    </content>
  </jingle>
</iq>]]></example>

  <p>Multiple &lt;thumbnail/&gt; elements MAY be included to provide thumbnails of different sizes, media types, or URIs.</p>

  <p>If the provided URI has the scheme 'cid', then the thumbnail data MAY be requested using <span class="ref"><link url="https://xmpp.org/extensions/xep-0231.html">Bits of Binary (XEP-0231)</link></span> <note>XEP-0231: Bits of Binary &lt;<link url="https://xmpp.org/extensions/xep-0231.html">https://xmpp.org/extensions/xep-0231.html</link>&gt;.</note>.</p>
</section1>

<section1 topic="Definition of the thumbnail Element" anchor="thumbnail_element">
  <p>The following attributes are defined for the &lt;thumbnail/&gt; element.</p>
  <table caption="Attributes of the thumbnail Element">
    <tr>
      <th>Attribute</th>
      <th>Description</th>
      <th>Inclusion</th>
    </tr>
    <tr>
      <td>uri</td>
      <td>A URI where the thumbnail data can be accessed (typically by using a URI scheme of 'cid:', 'https:', or 'http:'). If the URI scheme is 'cid:' then the identifier MUST refer to a bit of binary data as described in <span class="ref"><link url="https://xmpp.org/extensions/xep-0231.html">Bits of Binary (XEP-0231)</link></span> <note>XEP-0231: Bits of Binary &lt;<link url="https://xmpp.org/extensions/xep-0231.html">https://xmpp.org/extensions/xep-0231.html</link>&gt;.</note></td>
      <td>REQUIRED</td>
    </tr>
    <tr>
      <td>media-type</td>
      <td>The value of the 'media-type' attribute MUST match the syntax specified in <span class="ref"><link url="http://tools.ietf.org/html/rfc2045">RFC 2045</link></span> <note>RFC 2045: Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies &lt;<link url="http://tools.ietf.org/html/rfc2045">http://tools.ietf.org/html/rfc2045</link>&gt;.</note>. That is, the value MUST include a top-level media type, the "/" character, and a subtype; in addition, it MAY include one or more optional parameters. The "type/subtype" string SHOULD be registered in the <span class="ref"><link url="http://www.iana.org/assignments/media-types">IANA MIME Media Types Registry</link></span> <note>IANA registry of MIME media types &lt;<link url="http://www.iana.org/assignments/media-types">http://www.iana.org/assignments/media-types</link>&gt;.</note>, but MAY be an unregistered or yet-to-be-registered value.</td>
      <td>RECOMMENDED</td>
    </tr>
    <tr>
      <td>width</td>
      <td>The intended display width of the thumbnail image. Used as a hint for the receiving client to prepare the appropriate UI, such as a dialog window.</td>
      <td>OPTIONAL</td>
    </tr>
    <tr>
      <td>height</td>
      <td>The intended display height of the thumbnail image. Used as a hint for the receiving client to prepare the appropriate UI, such as a dialog window.</td>
      <td>OPTIONAL</td>
    </tr>
  </table>
</section1>
<section1 topic="Security Considerations" anchor="security">
  <p>The inclusion of an image thumbnail may leak information about a transfer
otherwise taking place on an e2e encrypted file transfer stream. A client MAY
wish to not include a thumbnail.</p>
  <p>A client MUST NOT rely on the values specified for the width and height of a thumbnail to allocate a bitmap data buffer for the thumbnail, to prevent possible DoS attacks. Also a client SHOULD apply implementation-specific limits on the thumbnails, if using these values to pepare a UI element for the thumbnail image, e.g. with dimensions of 128x128 pixels, values exceeding these would then be truncated and the thumbnail image scaled down when received.</p>
</section1>
<section1 topic="IANA Considerations" anchor="iana">
  <p>This document requires no interaction with the <span class="ref"><link url="http://www.iana.org/">Internet Assigned Numbers Authority (IANA)</link></span> <note>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 &lt;<link url="http://www.iana.org/">http://www.iana.org/</link>&gt;.</note>.</p>
</section1>
<section1 topic="XMPP Registrar Considerations" anchor="registrar">
  <section2 topic="Protocol Namespaces" anchor="registrar-ns">
    <p>This specification defines the following XML namespace:</p>
    <ul>
      <li>urn:xmpp:thumbs:1</li>
    </ul>
    <p>The <span class="ref"><link url="https://xmpp.org/registrar/">XMPP Registrar</link></span> <note>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 &lt;<link url="https://xmpp.org/registrar/">https://xmpp.org/registrar/</link>&gt;.</note> includes this namespace in the registry located at &lt;<link url="https://xmpp.org/registrar/namespaces.html">https://xmpp.org/registrar/namespaces.html</link>&gt;, as described in Section 4 of <span class="ref"><link url="https://xmpp.org/extensions/xep-0053.html">XMPP Registrar Function (XEP-0053)</link></span> <note>XEP-0053: XMPP Registrar Function &lt;<link url="https://xmpp.org/extensions/xep-0053.html">https://xmpp.org/extensions/xep-0053.html</link>&gt;.</note>.</p>
  </section2>
  <section2 topic="Protocol Versioning" anchor="registrar-versioning">
    <p>If the protocol defined in this specification undergoes a revision that is not fully backwards-compatible with an older version, the XMPP Registrar shall increment the protocol version number found at the end of the XML namespaces defined herein, as described in Section 4 of <cite>XEP-0053</cite>.</p>
  </section2>
</section1>
<section1 topic="XML Schema" anchor="schema">
  <code><![CDATA[
<?xml version='1.0' encoding='UTF-8'?>

<xs:schema
    xmlns:xs='http://www.w3.org/2001/XMLSchema'
    targetNamespace='urn:xmpp:thumbs:1'
    xmlns='urn:xmpp:thumbs:1'
    elementFormDefault='qualified'>

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

  <xs:element name='thumbnail'>
    <xs:complexType>
      <xs:attribute name='uri' type='xs:anyURI' use='required'/>
      <xs:attribute name='media-type' type='xs:string' use='optional'/>
      <xs:attribute name='width' type='xs:unsignedShort' use='optional'/>
      <xs:attribute name='height' type='xs:unsignedShort' use='optional'/>
    </xs:complexType>
  </xs:element>
</xs:schema>
]]></code>
</section1>
</xep>
