我使用Upnp发送视频文件到带有java/android的xbox one有问题。
我使用了一个api来发现和连接upnp设备。发现操作正常,xbox one被检测到。问题是当我试图发送视频链接到这个设备。
这里,这是xbox对upnp连接服务的响应:
<root xmlns="urn:schemas-upnp-org:device-1-0"
xmlns:df="http://schemas.microsoft.com/windows/2008/09/devicefoundation"
xmlns:microsoft="urn:schemas-microsoft-com:WMPDMR-1-0"
xmlns:pnpx="http://schemas.microsoft.com/windows/pnpx/2005/11">
<specVersion>
<major>1</major>
<minor>0</minor>
</specVersion>
<device>`
<deviceType>urn:schemas-upnp-org:device:MediaRenderer:1</deviceType>
<friendlyName>Xbox-SystemOS</friendlyName>
<modelName>Xbox One</modelName>
<modelDescription>Digital Media Renderer</modelDescription>
<manufacturer>Microsoft Corporation</manufacturer>
<manufacturerURL>http://www.microsoft.com</manufacturerURL>
<modelURL>http://xbox.com</modelURL>
<UDN>uuid:6e5e6c24-e450-4c6b-8987-89c6be33a1f7</UDN>
<df:X_containerId>{6E5E6C24-E450-4C6B-8987-89C6BE33A1F7}</df:X_containerId>
<dlna:X_DLNACAP xmlns:dlna="urn:schemas-dlna-org:device-1-0"/>
<dlna:X_DLNADOC xmlns:dlna="urn:schemas-dlna-org:device-1-0">DMR-1.50</dlna:X_DLNADOC>
<pnpx:X_deviceCategory>MediaDevices</pnpx:X_deviceCategory>
<pnpx:X_hardwareId>VEN_0125&DEV_0002&REV_0001 VEN_0125&DEV_0002</pnpx:X_hardwareId>
<iconList>
<icon>
<mimetype>image/jpeg</mimetype>
<width>120</width>
<height>120</height>
<depth>24</depth>
<url>/upnphost/udhisapi.dll?content=uuid:cde23e6c-d763-427d-b96b-c71a8cc5a3a5</url>
</icon>
<icon>
<mimetype>image/jpeg</mimetype>
<width>48</width>
<height>48</height>
<depth>24</depth>
<url>/upnphost/udhisapi.dll?content=uuid:a89beb23-a099-4f65-8cd5-aad6e7210db0</url>
</icon>
<icon>
<mimetype>image/png</mimetype>
<width>120</width>
<height>120</height>
<depth>24</depth>
<url>/upnphost/udhisapi.dll?content=uuid:d4eb98f9-e708-4faa-bcd4-591a9365d000</url>
</icon>
<icon>
<mimetype>image/png</mimetype>
<width>48</width>
<height>48</height>
<depth>24</depth>
<url>/upnphost/udhisapi.dll?content=uuid:ba12866a-d6c8-4a19-94e7-7a2ed8f305b3</url>
</icon>
</iconList>
<serviceList>
<service>
<serviceType>urn:schemas-upnp-org:service:RenderingControl:1</serviceType>
<serviceId>urn:upnp-org:serviceId:RenderingControl</serviceId>
<controlURL>/upnphost/udhisapi.dll?control=uuid:6e5e6c24-e450-4c6b-8987-89c6be33a1f7+urn:upnp-org:serviceId:RenderingControl</controlURL>
<eventSubURL>/upnphost/udhisapi.dll?event=uuid:6e5e6c24-e450-4c6b-8987-89c6be33a1f7+urn:upnp-org:serviceId:RenderingControl</eventSubURL>
<SCPDURL>/upnphost/udhisapi.dll?content=uuid:654eefc5-0e1b-4bfa-a72f-e02001be36e4</SCPDURL>
</service>
<service>
<serviceType>urn:schemas-upnp-org:service:AVTransport:1</serviceType>
<serviceId>urn:upnp-org:serviceId:AVTransport</serviceId>
<controlURL>/upnphost/udhisapi.dll?control=uuid:6e5e6c24-e450-4c6b-8987-89c6be33a1f7+urn:upnp-org:serviceId:AVTransport</controlURL>
<eventSubURL>/upnphost/udhisapi.dll?event=uuid:6e5e6c24-e450-4c6b-8987-89c6be33a1f7+urn:upnp-org:serviceId:AVTransport</eventSubURL>
<SCPDURL>/upnphost/udhisapi.dll?content=uuid:85466b84-2a4a-4514-b7a4-2bb7a4871da4</SCPDURL>
</service>
<service>
<serviceType>urn:schemas-upnp-org:service:ConnectionManager:1</serviceType>
<serviceId>urn:upnp-org:serviceId:ConnectionManager</serviceId>
<controlURL>/upnphost/udhisapi.dll?control=uuid:6e5e6c24-e450-4c6b-8987-89c6be33a1f7+urn:upnp-org:serviceId:ConnectionManager</controlURL>
<eventSubURL>/upnphost/udhisapi.dll?event=uuid:6e5e6c24-e450-4c6b-8987-89c6be33a1f7+urn:upnp-org:serviceId:ConnectionManager</eventSubURL>
<SCPDURL>/upnphost/udhisapi.dll?content=uuid:1de93088-6694-4d7c-a4a5-771ae3008378</SCPDURL>
</service>
</serviceList>
</device>
</root>
正如api文档中所说,你必须首先发送一个SetAVTransportURI动作到提供视频文件url的设备:
4.2. Controlling a renderer
Cling Support provides several action callbacks that simplify creating a control point for the AVTransport service. This is the client side of your player, the remote control.
This is how you set an URI for playback:
ActionCallback setAVTransportURIAction = new SetAVTransportURI(service, "http://www.duorimes.siquiere.fr/wa_files/Il_20camino.flv", "NO METADATA") {
@Override
public void failure(ActionInvocation invocation, UpnpResponse operation, String defaultMsg) {
// Something was wrong
}
};
This is how you actually start playback:
ActionCallback playAction = new Play(service) {
@Override
public void failure(ActionInvocation invocation, UpnpResponse operation, String defaultMsg) {
// Something was wrong
}
};
在我的例子中,第一个动作发送给我一个500错误码(内部服务器错误)
有人遇到过同样的问题吗?
提前感谢您的帮助。
对于SetAVTransportURI
, meta必须用DLNA规范定义的XML
进行编码。
SetAVTransportURI(service, "http://www.duorimes.siquiere.fr/wa_files/Il_20camino.flv", "NO METADATA")
中"NO METADATA"
为非法XML
字符串。
尝试使用空字符串""
或生成自己的元XML可能会有所帮助。