how to trigger cloud queue from smapi server?

*爱你&永不变心* 提交于 2019-12-11 18:34:54

问题


Trying to configure a music service on Sonos. I have been Following the Sonos guide for programmed radio.

https://developer.sonos.com/build/content-service-add-features/add-programmed-radio/

But not sure what should be returned from the smapi server to have the player use the endpoints declared in the manifest.

That would be step three in this graphic.

https://developer-assets.ws.sonos.com/doc-assets/prog_radio_seq10_review.png

I've tried adding radio as an itemType and using some of the existing types but so far I never got the player to make any requests to the cloud queue server.

<SOAP-ENV:Envelope
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Header/>
    <SOAP-ENV:Body>
        <ns2:getMetadataResponse
            xmlns:ns2="http://www.sonos.com/Services/1.1">
            <ns2:getMetadataResult>
                <ns2:index>0</ns2:index>
                <ns2:count>2</ns2:count>
                <ns2:total>2</ns2:total>
                <ns2:mediaCollection>
                    <ns2:id>smapicontainer:31</ns2:id>
                    <ns2:itemType>radio</ns2:itemType>
                    <ns2:title>radio collection</ns2:title>
                </ns2:mediaCollection>
                <ns2:mediaMetadata>
                    <ns2:id>smapicontainer:32</ns2:id>
                    <ns2:itemType>radio</ns2:itemType>
                    <ns2:title>radio metadata</ns2:title>
                </ns2:mediaMetadata>
            </ns2:getMetadataResult>
        </ns2:getMetadataResponse>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

expecting to see some calls to the endpoint for radio type. That are declared in the manifest. The manifest seems to be configured correctly as it does get calls to /radio/timePlayed when playing sample tracks.

{
  "schemaVersion": "1.0",
  "endpoints": [
    {
      "type": "radio",
      "uri": "https://13467fb8.ngrok.io/flight/radio"
    },{
      "type": "reporting",
      "uri": "https://13467fb8.ngrok.io/flight/radio"
    }
  ],
  "presentationMap": {
    "uri": "https://13467fb8.ngrok.io/flight/assets/presentationmap.xml",
    "version": 2
  },
  "strings": {
    "uri": "https://13467fb8.ngrok.io/flight/assets/strings.xml",
    "version": 2
  }
}

updated smapi response with mediaMetaData with itemType program. Seems to be missing something still, as the manifest "radio" endpoint does prevent calls to the smapi server. But it still doesn't make any requests to the endpoint associated with radio. I get "unable to play selected item" alerts when the items are selected.

<SOAP-ENV:Envelope
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Header/>
    <SOAP-ENV:Body>
        <ns2:getMetadataResponse
            xmlns:ns2="http://www.sonos.com/Services/1.1">
            <ns2:getMetadataResult>
                <ns2:index>0</ns2:index>
                <ns2:count>3</ns2:count>
                <ns2:total>3</ns2:total>
                <ns2:mediaMetadata>
                    <ns2:id>prad:32</ns2:id>
                    <ns2:itemType>program</ns2:itemType>
                    <ns2:title>radio channel a</ns2:title>
                </ns2:mediaMetadata>
                <ns2:mediaMetadata>
                    <ns2:id>smapicontainer:33</ns2:id>
                    <ns2:itemType>program</ns2:itemType>
                    <ns2:title>radio channel b</ns2:title>
                </ns2:mediaMetadata>
                <ns2:mediaMetadata>
                    <ns2:id>radio:34</ns2:id>
                    <ns2:itemType>program</ns2:itemType>
                    <ns2:title>radio channel c</ns2:title>
                </ns2:mediaMetadata>
            </ns2:getMetadataResult>
        </ns2:getMetadataResponse>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Below is the only traffic I can generate to the endpoints in the manifest file. Nothing for type radio, but do get some for reporting if I play one of the sample tracks included in the smapi sample server. image of traffic to the endpoint


回答1:


You need to add the version number somewhere in the radio and reporting endpoints. See Sonos Music API service reporting and manifest file for details.




回答2:


You should be returning an array of mediaMetadata objects for the getMetadataResponse, with itemType of program. See https://musicpartners.sonos.com/node/286



来源:https://stackoverflow.com/questions/55985381/how-to-trigger-cloud-queue-from-smapi-server

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!