Search code examples
sonos

Seeking Within Tracks Disabled for Audiobooks


We are attempting to build an API to play audiobooks on Sonos and we have run into the issue that seeking through tracks seems to be specifically disabled for audiobook type containers. We noticed this issue when we set the container type to 'container' and found that not only was seeking around the track possible, but so was "Quick Skips," which are only supposed to be possible for audiobooks and podcasts (https://developer.sonos.com/build/content-service-get-started/supported-audio-content/).

Here is what playback looks like when the container type for our chapter tracks is set to 'audiobook' and here's what it looks like when the container type is set to 'container.' Why are we running into this issue and is there any way to allow for seeking and quick skips within a track for tracks within an audiobook container?

Here are example getMetadata responses from our service.

Root:

<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Body>
        <getMetadataResponse xmlns="http://www.sonos.com/Services/1.1">
            <getMetadataResult xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
                <index>0</index>
                <count>1</count>
                <total>1</total>
                <mediaCollection>
                    <id>audiobook:33462:2617184</id>
                    <itemType>container</itemType>
                    <title>The Grapes of Wrath</title>
                    <summary>First published in 1939, The Grapes of Wrath creates an unforgettable portrait of the migrants who left the dust bowl for the promised land of California. Although he wrote it quickly, Steinbeck spent much time gathering detailed reports of the desperate conditions in migrant camps. He also worked in one camp helping to care for its starving residents. Although they have planted the land for generations, the Joads are tenant farmers. Now drought and mechanization have forced them off the Oklahoma farm they call home. As they travel toward new jobs in California, the penniless, hungry Joads learn that America has no mercy for the poor. Their fate is one that was repeated in hundreds of lives. Brilliant in its fusion of drama and rhetoric, The Grapes of Wrath changed the way the world saw migrant workers. They would never again be faceless masses who could be ignored and abandoned. This landmark work's impact earned John Steinbeck the Pulitzer Prize and contributed...</summary>
                    <author>John Steinbeck</author>
                    <narrator>Dylan Baker</narrator>
                    <canPlay>true</canPlay>
                    <albumArtURI>https://img1.od-cdn.com/ImageType-150/1694-1/5CE/FF2/0E/{5CEFF20E-0C05-4FA1-8903-34D26124FC29}Img150.jpg</albumArtURI>
                    <canResume>true</canResume>
                </mediaCollection>
            </getMetadataResult>
        </getMetadataResponse>
    </s:Body>
</s:Envelope>

Title:

<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Body>
        <getMetadataResponse xmlns="http://www.sonos.com/Services/1.1">
            <getMetadataResult xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
                <index>0</index>
                <count>20</count>
                <total>20</total>
                <mediaMetadata>
                    <id>navEl:33462:2617184:0:0</id>
                    <itemType>track</itemType>
                    <title>The Grapes of Wrath [0/20]</title>
                    <mimeType>audio/mpeg</mimeType>
                    <trackMetadata>
                        <author>John Steinbeck</author>
                        <narrator>Dylan Baker</narrator>
                        <albumArtURI>https://....Img150.jpg</albumArtURI>
                        <canPlay>true</canPlay>
                        <canAddToFavorites>false</canAddToFavorites>
                    </trackMetadata>
                </mediaMetadata>
                <mediaMetadata>
                    <id>navEl:33462:2617184:1:0</id>
                    <itemType>track</itemType>
                    <title>The Grapes of Wrath [1/20]</title>
                    <mimeType>audio/mpeg</mimeType>
                    <trackMetadata>
                        <author>John Steinbeck</author>
                        <narrator>Dylan Baker</narrator>
                        <albumArtURI>https://img1.od-cdn.com/ImageType-150/1694-1/5CE/FF2/0E/{5CEFF20E-0C05-4FA1-8903-34D26124FC29}Img150.jpg</albumArtURI>
                        <canPlay>true</canPlay>
                        <canAddToFavorites>false</canAddToFavorites>
                    </trackMetadata>
                </mediaMetadata>
                <mediaMetadata>
                    <id>navEl:33462:2617184:2:0</id>
                    <itemType>track</itemType>
                    <title>The Grapes of Wrath [2/20]</title>
                    <mimeType>audio/mpeg</mimeType>
                    <trackMetadata>
                        <author>John Steinbeck</author>
                        <narrator>Dylan Baker</narrator>
                        <albumArtURI>https://.....Img150.jpg</albumArtURI>
                        <canPlay>true</canPlay>
                        <canAddToFavorites>false</canAddToFavorites>
                    </trackMetadata>
                </mediaMetadata>
                <!--More MediaMetadata Elements-->
            </getMetadataResult>
        </getMetadataResponse>
    </s:Body>
</s:Envelope>

Are there any additional parameters that we have to include to make seeking work for audiobooks?


Solution

  • It looks like you're missing the duration element in trackMetadata. The fact that the Quick Skip buttons show up for the generic container itemType is unintended.

    The Sonos app shows Quick Skips for audiobooks whenever the metadata contains an author, narrator, or chapter title, provided that you:

    • Specify audioBook as the itemType.
    • Include duration in trackMetadata for each chapter.

    See Saving and Resuming Play Position for details.