The related browse action allows listeners to browse your service for music related to the current item. The following shows an example in the Info View of a related browse action.

The following steps describe how to implement the related browse action:
- Define the text string in your strings.xml file that is to display in the Info View of the Sonos app. (“Related Songs”).
1 |
<string stringId="RELATED_SONGS">Related Songs</string> |
- When the listener selects the ellipsis (…) to see the Info View, Sonos sends your service a
getExtendedMetadata
request. This example is for a trackitemType
.
1 2 3 4 5 6 7 8 9 10 11 |
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:Header> ... </s:Header> <s:Body> <getExtendedMetadata xmlns="http://www.sonos.com/Services/1.1"> <id>t:123456</id> </getExtendedMetadata> </s:Body> </s:Envelope> |
- Include all the custom action items for the Info View in your
getExtendedMetadata
response. To simplify this example we’ll show a related browse custom action.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.sonos.com/Services/1.1"> <s:Body> <ns:getExtendedMetadataResponse> <ns:getExtendedMetadataResult> <ns:mediaMetadata> <ns:id>t:123456</ns:id> <ns:itemType>track</ns:itemType> <ns:title>This is the title</ns:title> <ns:genre>Alternative</ns:genre> <ns:mimeType>audio/mp3</ns:mimeType> <ns:trackMetadata> <ns:artistId>a:12345678</ns:artistId> <ns:artist>Example Artist</ns:artist> <ns:albumId>M:123456</ns:albumid> <ns:genre>Alternative</ns:genre> <ns:duration>236</ns:duration> <ns:albumArtURI>https://example.com/art_legacy.jpg</ns:albumArtURI> <ns:canPlay>true</ns:canPlay> <ns:canSkip>true</ns:canSkip> <ns:canAddToFavorites>true</ns:canAddToFavorites> </ns:trackMetadata> <ns:mediaMetadata> . . . Details for other custom actions in the Info View are not shown . . . <ns:relatedBrowse> <ns:id>related-t:123456</ns:id> <ns:type>RELATED_SONGS</ns:type> </ns:relatedBrowse> </ns:getExtendedMetadataResult> </ns:getExtendedMetadataResponse> </s:Body> </s:Envelope> |
- Note the following about
relatedBrowse
:
Element Description id
The value related-t:123456
identifies the service’s tracks related to the current track,t:123456
. The pattern of these IDs is up to you.type
The value RELATED_SONGS
corresponds to thestringId
value in the strings.xml file above. - When a listener chooses a
relatedBrowse
action, the Sonos app sends agetMetadata
request to your service using the given related browseid
(related-t:123456
). - Your service should respond to
getMetadata
with amediaCollection
of related songs.