Customizing listener actions in the Info View

To get more information about the current item type (track, album, and so on), the listener selects the ellipse (...) to display the Info View. The Info View is a dialog/popup with actions listeners can select for the current item type. The Info View is available for most item types but we'll show only a few examples. 

The following screens display the Info View for an album and a song while browsing an album.

The following screens display the Info View for a playing song and a streaming station.

The actions listeners can select are grouped as default actions and custom actions. You can provide custom actions but you cannot modify the default actions.

Default actions

Default actions are built-in to the Sonos app and display automatically. The Sonos default actions that display depend on the content's <itemType> and viewing mode, either browse or now-playing. Some default actions display in the beginning of the Info View. Other default actions display at the end of the second Info View screen.

Some of the default actions are listed below.  Sonos may add other actions in the future.

  • Add Song to My Sonos
  • Add to Sonos Playlist
  • Play in Another Room...
  • Play Now
  • Play Next
  • Add to End of Queue
  • Replace Queue
  • More
  • Add Song to My Sonos
  • Add Song to Sonos Playlist
  • Others not shown

Custom actions

You can add optional custom actions to the Info View to provide features in the Sonos app that are specific to your service.

Custom actions include the following:

Custom Action Example Description
Album information Album Info  Displays a list of all the songs of an album. For example, this displays when browsing or playing a track.
Artist information Browse the Artist Displays information about the artist such as a list of albums, depending on your service offerings.
Related text About the Artist Displays text information related to the current <itemType> such as comments or other descriptions about it. To provide formatted and complex content, see the Open URL custom action.
Related browse Related Songs The listener can browse your service's content that you determine is related to the current item.
Related play
Start Radio The listener can play a radio stream that you determine is related to the current item.
Open URL
Concerts
The listener can open a URL in a browser or app to provide rich related information.
HTTP Request Save to My Acme Music
Sonos can make an HTTP REST request to your service. For example, use this to implement favorites as described in the separate tutorial, Integrating your service favorites with Sonos.
Playlists Add Song to My Playlist
Providing your own playlists require more complex implementation than the other custom actions.
See the separate tutorial, Implementing your playlists on Sonos for full implementation details.

You can implement many custom actions but be aware that the listener may have to scroll the Info View. Provide custom actions dynamically, depending on the context of the current <itemType>. For example, if you do not have any content for a related browse action, do not provide it for that Info View. Legacy desktop controllers do not display open URL or HTTP request actions.

Adding custom actions involves the following key tasks: provide the Info View display text and implement getExtendedMetadata responses.

Provide the Info View display text

Create an XML file with the text strings, such as strings.xml, and host the file on your server. See Strings and Localization for details. The strings in your strings.xml file for the examples above might look like the following. Sonos provides default text strings for some custom actions. 

...
<string stringId="ABOUT_ARTIST">About the Artist</string>
<string stringId="RELATED_SONGS">Related Songs</string>
<string stringId="START_RADIO">Start Radio</string>
<string stringId="CONCERTS">Concerts</string>
<string stringId="SAVE_MUSIC">Save to My Acme Music</string>
...

For some custom actions, you might need to provide an XML file called a presentation map that you host on your server. This provides a mapping of some messages that the Sonos firmware shows listeners, to your strings that you define in the strings.xml file. See Presentation Maps to learn how to set it up.

Implement getExtendedMetadata responses

Your getExtendedMetadata responses for custom actions need to include XML elements indicated in the table below. See the related section for implementation details. 

Custom Action Key XML Elements Section
Album information
<trackMetadata>
    <albumId>
Adding album and artist information

Artist information
<trackMetadata>
    <artistId>
 
<mediaCollection>
   <artistId>
Adding album and artist information
Related text
<relatedText>
Adding related text actions
Related browse
<relatedBrowse>
Adding related browse actions
Related play
<relatedPlay>
Adding related play radio streams
Open URL
<relatedActions>
    <action> 
        <actionType>openUrl 
        <openUrlAction>
Providing listeners with a URL to open
HTTP Request
<relatedActions>
    <action> 
        <actionType>simpleHttpRequest
        <simpleHttpRequestAction>
Implementing HTTP REST requests