3

我有一个问题,使用 Upnp 将视频文件发送到带有 java/android 的 Xbox 一。

我使用cling api通过网络发现和连接 upnp 设备。发现操作运行良好,检测到 xbox one。问题是当我尝试将视频链接发送到此设备时。

在这里,它是对 upnp 连接服务的 Xbox 响应:

<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 错误代码(内部服务器错误)

有人遇到过同样的问题吗?

提前感谢您的帮助。

4

1 回答 1

2

对于SetAVTransportURI, meta 必须按照XMLDLNA 规范的定义进行编码。

SetAVTransportURI(service, "http://www.duorimes.siquiere.fr/wa_files/Il_20camino.flv", "NO METADATA"),"NO METADATA"是非法XML字符串。

尝试使用空字符串""或生成您自己的元 XML 可能会有所帮助。

于 2015-08-06T03:06:06.310 回答