Upnp 控制点无法播放音频

Upnp control point cannot playing audio

这是设置 SetAVTransportURI 操作的正确格式吗?

echo '
<?xml version="1.0"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
 <s:Body>
  <u:SetAVTransportURI xmlns:u="urn:schemas-upnp-org:service:AVTransport:1">
    <InstanceID>0</InstanceID>
    <CurrentURI>http://www.vorbis.com/music/Epoq-Lepidoptera.ogg</CurrentURI>
    <CurrentURIMetaData></CurrentURIMetaData>
    </u:SetAVTransportURI>
  </s:Body>
</s:Envelope>
' | curl -v -d @- \
 -H 'SOAPAction: "urn:schemas-upnp-org:service:AVTransport:1#SetAVTransportURI"' \
 -H 'content-type: text/xml; charset="utf-8"' \
 -H 'Connection: close' \
 http://192.168.1.6:49152/ctl/AVTransport

我收到 501 错误作为响应

* Hostname was NOT found in DNS cache
*   Trying 192.168.1.6...
* Connected to 192.168.1.6 (192.168.1.6) port 49152 (#0)
> POST /ctl/AVTransport HTTP/1.1
> User-Agent: curl/7.35.0
> Host: 192.168.1.6:49152
> Accept: */*
> SOAPAction: "urn:schemas-upnp-org:service:AVTransport:1#SetAVTransportURI"
> content-type: text/xml; charset="utf-8"
> Connection: close
> Content-Length: 432
> 
* upload completely sent off: 432 out of 432 bytes
< HTTP/1.1 500 Internal Server Error
< CONTENT-LENGTH: 411
< CONTENT-TYPE: text/xml; charset="utf-8"
< DATE: Fri, 20 Oct 2017 19:22:34 GMT
< EXT:
* Server Linux/4.9.28-v7+, UPnP/1.0, Portable SDK for UPnP devices/1.6.19+git20141001 is not blacklisted
< SERVER: Linux/4.9.28-v7+, UPnP/1.0, Portable SDK for UPnP devices/1.6.19+git20141001
< X-User-Agent: redsonic
< 
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<s:Body>
<s:Fault>
<faultcode>s:Client</faultcode>
<faultstring>UPnPError</faultstring>
<detail>
<UPnPError xmlns="urn:schemas-upnp-org:control-1-0">
<errorCode>501</errorCode>
<errorDescription>Action Failed</errorDescription>
</UPnPError>
</detail>
</s:Fault>
</s:Body>
</s:Envelope>
* Connection #0 to host 192.168.1.6 left intact

PS - 我还尝试将 DDLite 元数据(有和没有转义)添加到 CurrentURIMetadata。它给出了相同的 501 错误

&lt;DIDL-Lite xmlns=\"urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:sec=\"http://www.sec.co.kr/\" xmlns:upnp=\"urn:schemas-upnp-org:metadata-1-0/upnp/\""&gt;&lt;item id=\"0\" parentID=\"-1\" restricted=\"false\""&gt;&lt;res protocolInfo=\"http-get:*:audio/ogg:*\""&gt;http://www.vorbis.com/music/Epoq-Lepidoptera.ogg&lt;/res"&gt;&lt;/item"&gt;&lt;/DIDL-Lite"&gt;

PPS - the docs 中没有任何内容表明出了什么问题。

啊。似乎连接必须是 keep-alive 并且 currenturimetadata 有一些字段, XML 正确转义。如果它们是空的,一些渲染器会发疯。

echo '
<?xml version="1.0"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
 <s:Body>
  <u:SetAVTransportURI xmlns:u="urn:schemas-upnp-org:service:AVTransport:1">
    <InstanceID>0</InstanceID>
    <CurrentURI>http://www.vorbis.com/music/Epoq-Lepidoptera.ogg</CurrentURI>
    <CurrentURIMetaData>&lt;DIDL-Lite xmlns=&quot;urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/&quot; xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot; xmlns:sec=&quot;http://www.sec.co.kr/&quot; xmlns:upnp=&quot;urn:schemas-upnp-org:metadata-1-0/upnp/&quot;&gt;&lt;item id=&quot;0&quot; parentID=&quot;-1&quot; restricted=&quot;false&quot;&gt;&lt;res protocolInfo=&quot;http-get:*:audio/ogg:*&quot;&gt;http://www.vorbis.com/music/Epoq-Lepidoptera.ogg&lt;/res&gt;&lt;/item&gt;&lt;/DIDL-Lite&gt;</CurrentURIMetaData>
    </u:SetAVTransportURI>
  </s:Body>
</s:Envelope>
' | curl -v -d @- \
 -H 'SOAPAction: "urn:schemas-upnp-org:service:AVTransport:1#SetAVTransportURI"' \
 -H 'content-type: text/xml; charset="utf-8"' \
 -H 'Connection: keep-alive' \
 http://192.168.1.6:49152/ctl/AVTransport