Add actions

To get more information about the current item type (track, album, and so on), the listener selects the ellipsis (…) 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.

Browse More icon Info View

The following screen displays the Info View for a playing song:

Info view song

For a streaming station:

Info view 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.

Default actions

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

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. For example, custom actions for a song:

Custom action — song

Custom actions for an album:

Custom action — album

Custom actions include the following:

Custom Action Example Description
Show album information Album Info Displays a list of all the songs of an album. For example, this displays when browsing or playing a track.
Show artist information Browse the Artist Displays information about the artist such as a list of albums, depending on your service offerings.
See 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.
Browse to related item Related Songs The listener can browse your service’s content that you determine is related to the current item.
Play related item 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.
Make an 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, Add favorites.
Edit playlist Add Song to My Playlist Providing your own playlists require more complex implementation than the other custom actions. See Add playlists for 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.

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 Customize display for details about presentation maps.

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
Show album information trackMetadata & albumId Album & artist
Show artist information trackMetadata & artistId
mediaCollection & artistId
Album & artist
See related text relatedText Related text
Browse to related item relatedBrowse Related browse
Play related item relatedPlay Related play
Open URL relatedActions
actionType & openUrl
Web page
Make an HTTP Request relatedActions
actionType & simpleHttpRequest
REST request