We are building Sonos integration for our app, which allows you to check out audiobooks from public libraries. Due to the nature of the app, it will be very common that content will disappear from users' shelves as it is returned to the library.
We would also like to make use of Sonos Favorites ("My Sonos") so users have an easy way to reach their checked out audiobooks from the main screen of the Sonos controller app. However, when an audiobook is removed from a user's shelf, it remains on their Sonos Favorites shelf, albeit unplayable.
Is there any way to remove items from a user's Sonos Favorites once it is no longer available to them?
Is there any way to remove items from a user's Sonos Favorites once it is no longer available to them?
Unfortunately, no. Once a listener adds a favorite to My Sonos, it remains there until they remove it. For the best experience, you should use isEphemeral
tags for temporary content. Listeners will not be able to save this content to favorites, but it will eliminate any confusion when the content expires. See the Listeners save and play favorites in My Sonos section of Content on Sonos for details.
Edited to add:
The isEphemeral
element is defined as a property of the abstractMedia
object in the WSDL, which is the parent of both mediaCollection
and mediaMetadata
, so it applies to all content, including containers, tracks and audiobooks. From the WSDL:
<xs:sequence>
<xs:element ref="tns:id"/>
<xs:element ref="tns:itemType"/>
<xs:element ref="tns:semanticType" minOccurs="0"/>
<xs:element name="displayType" type="xs:string" minOccurs="0"/>
<xs:element name="title" type="xs:string"/>
<!-- .... snip ....-->
<!-- is this short lived, if so do not allow adding to Sonos Favorites or alarms-->
<xs:element name="isEphemeral" type="xs:boolean" minOccurs="0"/>
<!-- .... snip ....-->
</xs:sequence>
</xs:complexType>
Add <isEphemeral>true</isEphemeral>
to the mediaCollection
in the getMetadata
response for the list of audiobooks to mark the audiobook as ephemeral. This disables the “Add to My Sonos” and “Add to Sonos Playlist” options in the Sonos app. If a listener selects these options, the Sonos app displays a message that says “Feature not available for this content.”