EzDevInfo.com

sonos

Control Sonos speakers with Ruby

What is a SMAPI context header?

The customsd.htm page now has this option: "Include SMAPI context headers with all requests" What does this mean? What is a smapi context header?


Source: (StackOverflow)

What's new in SMAPI 5.5?

Sonos 5.5 beta seems to have changed SMAPI somehow. Spotify for example seems to know the local time of the client, as it changes its response to getMetadata("root") depending on it, but as both the Spotify uris are https I can't sniff them to see. Anyone know what has changed?


Source: (StackOverflow)

Advertisements

Send "stop playback" to Sonos Controller

I have a Programmed Radio service and I want to implement a method that sends a "stop/pause playback" message to Sonos whenever the same user starts playing with our mobile app or web streaming. I noticed Spotify has that functionality implemented but I don't see any documentation on how to do it in the API Reference.


Source: (StackOverflow)

Spotify/Sonos integration

Apologies if this is the incorrect place to ask such a thing, however I was directed here by the Spotify CS Twitter account.

I was wondering if there was any possibility of the API's on Spotify that allow access to Your Music, Radio features etc would be opened up so that they could be incorportated into the Sonos Controller at all?

It would be a very worthwhile thing to have

Cheers!


Source: (StackOverflow)

Sonos - The information returned under "information" on the Now Playing Screen should be under "On Now"

The Sonos team asked me to ask this question here on StackOverflow.

I do not know what to change in my code in order to fix the following issue.

The internal Jira (CP-2805) says:

The information returned under "information" on the Now Playing Screen should be under "On Now"

Repro: 1. Open app in the Sonos controller 2. Play any station

Results: Observe that information about what is currently playing is being returned under "information."

Expect: This information should be returned under "On Now."


Source: (StackOverflow)

Unable to implement thumbs up/down for live stream

I'm trying to implement thumbs up/down for live streams (itemType = 'stream'). According to the documentation this should be possible, but unfortunately the icons won't appear. I believe I have correctly followed the steps at http://musicpartners.sonos.com/node/340.

When I debug getExtendedMetaData() and getMediaMetadata() it returns the dynamic tag with the correct properties:

<ns1:dynamic>
  <ns1:property>
    <ns1:name>isStarred</ns1:name>
    <ns1:value>1</ns1:value>
  </ns1:property>
</ns1:dynamic>

I also believe my presentation map XML and strings XML are correct. When I try the same for itemType = 'track' it works fine.

What could I be doing wrong? Is there a way to debug this? Is this possible at all?

I've been testing this on the Sonos app for OSX and iOS (on the iPad). Neither works.

On a side note, we also don't seem to be able to show Info & Options for live streams.


Source: (StackOverflow)

#sonos unable to play live radio having streaming url m3u8 extension

I have implemented same thing refered to doc http://musicpartners.sonos.com/node/83 for live radio streaming. the streaming url is like http://example.com/abc.m3u8 but this live stream is unable to play by sonos player. please suggest or ask me for more info.


Source: (StackOverflow)

Unable to Edit/Create playlists in "playlists" container in Sonos version 5.4 (latest update)

When I updated to version 5.4 I no longer have the option to create a playlist in the "playlists" container, nor to add a track to a playlist already existing in it. In version 5.3 it was working well. I also checked other Music Services on Sonos, same problem. Did anything change in the specifications for User Content Playlists that is not specified in the documentation for Playlist Editing?

This is how I'm adding my User Content container:

$result->mediaCollection[] = array('id'=>'playlists', 'title'=>'My Playlists', 'itemType'=>'favorites', 'containsFavorite'=>true, 'displayType'=>'genreList', 'readOnly'=>false, 'userContent'=>true, 'renameable'=>true, 'albumArtURI'=>PATH.'/img.png');

Edit:
I am using the Android controller (version 5.4, build 29590261) and I am testing on a Play:1 (version 5.4, build 29591030).
I am able to add a song/playlist to an already existing playlist or to a new playlist (by long press on a song to get to the extended metadata, and then "Add Track to 'Service Name' Playlist"), but what I can't figure out how to do is: deleting a playlist, renaming a playlist, and editing songs in a playlist (reorder, delete songs). I don't have a screenshot for version 5.3 but there was an button in the top right corner (three vertical dots) of the playlists container from which one can edit playlists or create new ones (check the screenshots below, from version 5.4). Am I missing something?

The playlists container Long press on the playlists container

Edit 2:
I figured out what is causing the issue. I am using the .wsdl for beta in order to be able to implement Custom Item Display (This is not beta anymore, as I understood from the Adding New SMAPI Features page). When I revert to the normal Sonos.wsdl file from the Sonos Documentation, the info and options button appears again. How can I use Custom Item Display while keeping the info and options button there and all functionalities of playlist editing unchanged?

Note: the Sonos(beta).wsdl was here but it's not available anymore.

Edit 3:
I downloaded the Sonos.wsdl from the Sonos documentation, but I still can't see the button. In order to reproduce the issue, please check the following PHP implementation and Presentation Map XML code:

PHP implementation:

define('BASE_PATH', rtrim("http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']), '/'));

class SonosAPI
{
    public function getMetadata($args)
    {
        $result = new StdClass();
        $result->index = $args->index;
        switch($args->id) {
            case 'root':
                $result->mediaCollection[] = array('id'=>'playlists', 'title'=>'My Playlists', 'itemType'=>'favorites', 'displayType'=>'genreList', 'readOnly'=>false, 'userContent'=>true, 'renameable'=>true, 'albumArtURI'=>BASE_PATH.'/image.png');
                $result->count = $result->total = 1;
                break;
            case 'playlists':
                $result->mediaCollection[] = array('id'=>'123', 'title'=>'Title', 'itemType'=>'playlist', 'displayType'=>'genreList', 'canPlay'=>true, 'readOnly'=>false, 'userContent'=>false, 'renameable'=>true, 'albumArtURI'=>BASE_PATH.'/image.png');
                $result->count = $result->total = 1;
                break;
        }

        return array('getMetadataResult' => $result);
    }

}

$server = new SoapServer("Sonos.wsdl", array('cache_wsdl' => 0)); // disable cache in development
$server->setClass('SonosAPI');

try {
    $server->handle();
} catch (Exception $e) {
    Log("[ERROR] ".$e->getMessage());
}

?>

Presentation Map file:

<?xml version="1.0" encoding="utf-8" ?>
<Presentation>

    <PresentationMap type="DisplayType">
        <DisplayType id="genreGrid">
            <DisplayMode>GRID</DisplayMode>
        </DisplayType>
        <DisplayType id="genreList">
            <DisplayMode>LIST</DisplayMode>
        </DisplayType>
        <DisplayType id="genreHero">
            <DisplayMode>HERO</DisplayMode>
        </DisplayType>
        <DisplayType id="genreEditorial">
            <DisplayMode>EDITORIAL</DisplayMode>
        </DisplayType>
        <DisplayType id="twoLine">
          <Lines>
            <Line token="title"/>
            <Line token="summary"/>
          </Lines>
        </DisplayType>
    </PresentationMap>

</Presentation>

XML response to getMetadata of root (which contains the playlists container):

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:ns1="http://www.sonos.com/Services/1.1" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
   <SOAP-ENV:Body>
      <ns1:getMetadataResponse>
         <ns1:getMetadataResult>
            <ns1:index>0</ns1:index>
            <ns1:count>4</ns1:count>
            <ns1:total>4</ns1:total>
            <ns1:mediaCollection>
               <ns1:id>rootlang:ar</ns1:id>
               <ns1:itemType>collection</ns1:itemType>
               <ns1:displayType>genreGrid</ns1:displayType>
               <ns1:title>Arabic</ns1:title>
               <ns1:albumArtURI>{SOME LINK}</ns1:albumArtURI>
            </ns1:mediaCollection>
            <ns1:mediaCollection>
               <ns1:id>rootlang:en</ns1:id>
               <ns1:itemType>collection</ns1:itemType>
               <ns1:displayType>genreGrid</ns1:displayType>
               <ns1:title>International</ns1:title>
               <ns1:albumArtURI>{SOME LINK}</ns1:albumArtURI>
            </ns1:mediaCollection>
            <ns1:mediaCollection>
               <ns1:id>rootlang:default</ns1:id>
               <ns1:itemType>collection</ns1:itemType>
               <ns1:displayType>genreGrid</ns1:displayType>
               <ns1:title>Arabic + International</ns1:title>
               <ns1:albumArtURI>{SOME LINK}</ns1:albumArtURI>
            </ns1:mediaCollection>
            <ns1:mediaCollection renameable="true" readOnly="false" userContent="true">
               <ns1:id>playlists</ns1:id>
               <ns1:itemType>favorites</ns1:itemType>
               <ns1:displayType>genreList</ns1:displayType>
               <ns1:title>My Playlists</ns1:title>
               <ns1:albumArtURI>{SOME LINK}</ns1:albumArtURI>
            </ns1:mediaCollection>
         </ns1:getMetadataResult>
      </ns1:getMetadataResponse>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

XML response to getMetadata of playlists:

 <?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:ns1="http://www.sonos.com/Services/1.1" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
   <SOAP-ENV:Body>
      <ns1:getMetadataResponse>
         <ns1:getMetadataResult>
            <ns1:index>0</ns1:index>
            <ns1:count>1</ns1:count>
            <ns1:total>1</ns1:total>
            <ns1:mediaCollection renameable="true" readOnly="false" userContent="false">
               <ns1:id>playlist:19663408</ns1:id>
               <ns1:itemType>playlist</ns1:itemType>
               <ns1:displayType>genreList</ns1:displayType>
               <ns1:title>Test Playlist</ns1:title>
               <ns1:canPlay>true</ns1:canPlay>
               <ns1:albumArtURI>{SOME LINK}</ns1:albumArtURI>
            </ns1:mediaCollection>
         </ns1:getMetadataResult>
      </ns1:getMetadataResponse>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Source: (StackOverflow)

Missing title in getExtendedMetadata documentation example

This is such a tiny piece of feedback but there is no other way for me to communicate this. It is disappointing that this has to affect my fledgling Stack Overflow reputation. Please reconsider this platform as the support mechanism for your developers/integrators. This will now show for anyone searching for sonos.

The API Reference for getExtendedMetadata is missing the title tag from the SAMPLE RESPONSE (FOR A TRACK).


Source: (StackOverflow)

Sonos API Browse container two-line displayy

For reason the two-line display of containers in browse are not working, via search it works perfectly. Can someone please review below output?

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <getMetadataResponse xmlns="http://www.sonos.com/Services/1.1">
         <getMetadataResult>
            <index>0</index>
            <count>2</count>
            <total>2</total>
            <mediaCollection>
               <canPlay>true</canPlay>
               <id>album-1200</id>
               <title>En de wind stilde</title>
               <itemType>album</itemType>
               <artistId>artist-5716</artistId>
               <artist>Ds. D.W. Tuinier</artist>
               <albumArtURI>http://***/albumart.php?album_id=1200&amp;size=200</albumArtURI>
            </mediaCollection>
            <mediaCollection>
               <canPlay>true</canPlay>
               <id>album-1163</id>
               <title>De Tas</title>
               <itemType>album</itemType>
               <artistId>artist-5619</artistId>
               <artist>Ben de Raaf</artist>
               <albumArtURI>http://***/albumart.php?album_id=1163&amp;size=200</albumArtURI>
            </mediaCollection>
         </getMetadataResult>
      </getMetadataResponse>
   </soap:Body>
</soap:Envelope>

Source: (StackOverflow)

"No Selections are Available" error when accessing content container

I'm having problem with backend integration with Sonos.

  1. API has been implemented according to WSDL provided by Sonos
  2. API returns a data for container X
  3. All tests pass in Sonos's self-testing tool

But when I'm trying to submit the integration to Sonos for review, I'm getting a submission rejection from Sonos with the next reason:

  • "No Selections are Available" when accessing content in X container.

Problem is that the official documentation (and rejection message) has no any details on such error message.

What that means?

EDIT:

getMetadata request (from smapiConfig-DEBUG.log of self-testing tool):

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.sonos.com/Services/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://www.sonos.com/Services/1.1" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
   <SOAP-ENV:Header>
      <tns:credentials>
         <tns:deviceId>00-00-00-00-00-00:Z</tns:deviceId>
         <tns:deviceProvider>Sonos</tns:deviceProvider>
         <tns:sessionId>123</tns:sessionId>
      </tns:credentials>
   </SOAP-ENV:Header>
   <ns0:Body>
      <ns1:getMetadata>
         <ns1:id>FEATURED_RELEASES</ns1:id>
         <ns1:index>0</ns1:index>
         <ns1:count>100</ns1:count>
      </ns1:getMetadata>
   </ns0:Body>
</SOAP-ENV:Envelope>

getMetadata response:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:ns1="http://www.sonos.com/Services/1.1" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
   <SOAP-ENV:Body>
      <ns1:getMetadataResponse>
         <ns1:getMetadataResult>
            <ns1:index>0</ns1:index>
            <ns1:count>100</ns1:count>
            <ns1:total>100</ns1:total>
            <ns1:mediaCollection>
               <ns1:id>ALBUM:104567018</ns1:id>
               <ns1:itemType>album</ns1:itemType>
               <ns1:title>Communion</ns1:title>
               <ns1:artist>Years &amp; Years</ns1:artist>
               <ns1:artistId>ARTIST:101412542</ns1:artistId>
               <ns1:canPlay>true</ns1:canPlay>
               <ns1:canEnumerate>true</ns1:canEnumerate>
               <ns1:canCache>true</ns1:canCache>
               <ns1:albumArtURI>https://example.com/0004567018_200.jpg</ns1:albumArtURI>
            </ns1:mediaCollection>
            <ns1:mediaCollection>
               <ns1:id>ALBUM:104567238</ns1:id>
               <ns1:itemType>album</ns1:itemType>
               <ns1:title>The Way Back Up</ns1:title>
               <ns1:artist>Prides</ns1:artist>
               <ns1:artistId>ARTIST:102159674</ns1:artistId>
               <ns1:canPlay>true</ns1:canPlay>
               <ns1:canEnumerate>true</ns1:canEnumerate>
               <ns1:canCache>true</ns1:canCache>
               <ns1:albumArtURI>https://example.com/0004567238_200.jpg</ns1:albumArtURI>
            </ns1:mediaCollection>
            <!-- ... other 98 mediaCollections ... -->
          </ns1:getMetadataResult>
      </ns1:getMetadataResponse>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Source: (StackOverflow)

Error in Python Self Test suite after implementing Custom Item Display for Sonos

I implemented Custom Item Display for my music service, as per the instruction available in the Sonos documentation for Customizing Item Display.

When I run the Python Self Test suite, I am getting the following error:

Element 'PresentationMap', attribute 'type': [facet 'enumeration'] The value 'DisplayType' is not an element of the set {'NowPlayingRatings', 'ListOverlays', 'InfoView', 'ArtWorkSizeMap', 'BrowseIconSizeMap', 'Search'}.

Note that I am replacing the Sonos.wsdl file in the test suite with the one from Sonos website (Sonos.wsdl), as this one contains the 'displayType' related changes.

This is how my Presentation Map xml file looks like:

<?xml version="1.0" encoding="utf-8" ?>
<Presentation>
    <PresentationMap type="DisplayType">
        <DisplayType id="genreGrid">
            <DisplayMode>GRID</DisplayMode>
        </DisplayType>
        <DisplayType id="genreList">
            <DisplayMode>LIST</DisplayMode>
        </DisplayType>
        <DisplayType id="genreHero">
            <DisplayMode>HERO</DisplayMode>
        </DisplayType>
        <DisplayType id="genreEditorial">
            <DisplayMode>EDITORIAL</DisplayMode>
        </DisplayType>
        <DisplayType id="playlist">
          <Lines>
            <Line token="title"/>
            <Line token="summary"/>
          </Lines>
        </DisplayType>
    </PresentationMap>

    <--! Other PresetationMap tags (NowPlayingRatings, InfoView, Search, BrowseIconSizeMap)-->
</Presentation>

Note also that when I remove the DisplayType tag from the Presentation Map xml file, the error does not appear anymore, but of course the display would be back to normal without the custom item display that I implemented.

I think the error is showing because the presentationmap.xsd in the test suite does not contain the DisplayType. How can I fix this in order to pass the test and avoid this error while keeping the custom item display that I implemented?


Source: (StackOverflow)

Sonos API - Unable to play AAC stream

I'm trying to play an aac stream through my service implementation. I set the mime type to audio/aac in the MediaMetadata. However the controller just shows the generic Track not encoded correctly message.

Is there any way to further troubleshoot this? How this is not encoded correctly?

This is an example file I'm using and passing into getMediaURI()

http://download.npr.org/npr-mp4/nprone/hello/amidst1/232.mp4

Thanks!


Source: (StackOverflow)

What is the API in sonos which developers can use to play/pause/stop music

I was going through the documentation and was looking for the API's which i can call from a console application to play/pause or stop music. I am assuming Sonos is like Philips Hue which requires the devices to be in the same local network.

Any help would be appreciated. Thanks

Sonos API


Source: (StackOverflow)

Can not add account for custom Sonos service

I've created a Sonos music service and added it to my speaker with customsd. Both endpoint urls (regular and secure) are available. The service is successfully added to the speaker.

With SoapUI I can send a https request for GetSessionId and it returns a valid response.

I use sessionId authentication, so when I want to add my account to the service in Sonos, the service asks for a username and a password. After filling in, I get a connection error. Problem with adding account. Connection can not be made.

The problem is, I expect a 'GetSessionId' request entering my music service (So I can debug the request), but it seems nothing comes in.

Can anyone tell me why or what is happening?


Source: (StackOverflow)