Sonos Music API - Getting Started Guide

Content Playback

A client device using the Sonos Music API invokes the getMediaURI method to obtain the playback URL of a track given an object (track) ID.  This method is called on a secure endpoint using SSL, and returns an HTTP URL for the track that is assumed valid for a few minutes.  A client device should not store track URLs for a long period of time, which means the actual stream URL may be different every time.

Service providers should take care to ensure that their stream types support seeking to arbitrary locations in the stream.  Not all streams can support this capability.  For example, DMCA compliant programmed radio cannot seek due to the DMCA guidelines.

Service providers and devices should strive to minimize the amount of time required to initialize stream playback.  Some effective measures are:

  • Services should not force devices to redirect needlessly to obtain a streaming URI.
  • Devices should tune buffer sizes to avoid waiting for a large buffer to fill before playback.
  • Devices should use byte ranges in HTTP requests to support seeking via HTTP.
  • Services and devices should make use of performance optimizations such as “fast start” if using Microsoft Media Streaming (MMS).

Streaming Protocols

The Sonos Music API does not constrain implementers to use any particular protocol.  The only requirement is that getMediaURI provide streamable content in a form recognized by the device.   The current API implementation has been built with streaming via HTTP and MMS.

Codecs

The Sonos Music API is codec agnostic.  The format of the audio stream is determined by the content type of the data at the streaming URI.  Sonos supports codecs such as MP3, WMA, AAC, and OGG.