Implementing listener ratings

SMAPI dynamic ratings enable your listeners to rate tracks or programmed radio. The rating could be any form; for example: starred or unstarred, or thumbs up or thumbs down, on a track. When implemented, the rating icon(s) are displayed on the Now Playing view as selectable button(s) that enable listeners rate items.

You should provide the same interface on Sonos that you do for your service. For example, if your native app features a two-button, thumbs-up, thumbs-down style rating interface, then you should provide the same interface for users on Sonos controllers. See the sample in Step 1: Presentation Map Configuration for an example of this two-button interface.

The following items are essential for implementing dynamic ratings:

  • Presentation map XML file: The presentation map includes the rating state as well as all available ratings.
  • Strings XML file: Used for localization.
  • getExtendedMetadata: The Sonos Controller makes a getExtendedMetadata or getMediaMetadata request to learn the rating state.
  • rateItem: When the listener selects a rating, the Controller makes a rateItem request with the track ID and rating value from the getExtendedMetadata or getMediaMetadata response.
  • getLastUpdate: After a listener chooses a rating, the Controller issues a getLastUpdate request to update the 'favorites' value.

This tutorial walks you through setting these items up in both a single and double icon scenario.