DLNA(二)

作者: dandelionYD | 来源:发表于2019-02-04 16:58 被阅读0次

接:DLNA(一)
下面我们来看看具体的控制(这里还是以悦me为例

具体的代码见gitHubDemo里面的具体的包括实现都有具体的实现

服务动作请求

1.设置图片的播放

http://192.168.124.43:1266/AVTransport/skyworth&208B3756FFED&192.168.124.43/control.xml

<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:u="urn:schemas-upnp-org:service:AVTransport:1">
    <s:Body>
        <u:SetAVTransportURI>
            <InstanceID>0</InstanceID>
            <CurrentURI>http://pic2.nipic.com/20090506/2256386_141149004_2.jpg</CurrentURI>
            <CurrentURIMetaData>&lt;DIDL-Lite xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dlna="urn:schemas-dlna-org:metadata-1-0/" xmlns:sec="http://www.sec.co.kr/"&gt;&lt;item id="filePath" parentID="0" restricted="1"&gt;&lt;upnp:class&gt;object.item.imageItem&lt;/upnp:class&gt;&lt;dc:title&gt;
            IMAG1466&lt;/dc:title&gt;&lt;dc:creator&gt;Unknown Artist&lt;/dc:creator&gt;&lt;upnp:artist&gt;Unknown Artist&lt;/upnp:artist&gt;&lt;upnp:albumArtURI&gt;http://IP:PORT/filePath&lt;/upnp:albumArtURI&gt;&lt;upnp:album&gt;Unknown Album&lt;/upnp:album&gt;&lt;res protocolInfo="http-get:*:image/jpeg:DLNA.ORG_PN=JPEG_LRG;DLNA.ORG_OP=01;DLNA.ORG_FLAGS=01700000000000000000000000000000"&gt;http://IP:PORT/filePath&lt;/res&gt;&lt;/item&gt;&lt;/DIDL-Lite&gt;</CurrentURIMetaData>
        </u:SetAVTransportURI>
    </s:Body>
</s:Envelope>

//返回response
<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Body>
        <u:SetAVTransportURIResponse xmlns:u="urn:schemas-upnp-org:service:AVTransport:1" />
    </s:Body>
</s:Envelope>

2.图片开始播放

http://192.168.124.43:1266/AVTransport/skyworth&208B3756FFED&192.168.124.43/control.xml

<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:u="urn:schemas-upnp-org:service:AVTransport:1">
    <s:Body>
        <u:Play>
            <InstanceID>0</InstanceID>
            <Speed>1</Speed>
        </u:Play>
    </s:Body>
</s:Envelope>

//response
<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Body>
        <u:PlayResponse xmlns:u="urn:schemas-upnp-org:service:AVTransport:1" />
    </s:Body>
</s:Envelope>

3.获取当前图片播放信息

http://192.168.124.43:1266/AVTransport/skyworth&208B3756FFED&192.168.124.43/control.xml

<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:u="urn:schemas-upnp-org:service:AVTransport:1">
    <s:Body>
        <u:GetTransportInfo>
            <InstanceID>0</InstanceID>
        </u:GetTransportInfo>
    </s:Body>
</s:Envelope>

//response
<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Body>
        <u:GetTransportInfoResponse xmlns:u="urn:schemas-upnp-org:service:AVTransport:1">
            <CurrentTransportState>NO_MEDIA_PRESENT</CurrentTransportState>
            <CurrentTransportStatus>OK</CurrentTransportStatus>
            <CurrentSpeed>1</CurrentSpeed>
        </u:GetTransportInfoResponse>
    </s:Body>
</s:Envelope>

4.停止图片播放

http://192.168.124.43:1266/AVTransport/skyworth&208B3756FFED&192.168.124.43/control.xml

<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:u="urn:schemas-upnp-org:service:AVTransport:1">
    <s:Body>
        <u:Stop>
            <InstanceID>0</InstanceID>
        </u:Stop>
    </s:Body>
</s:Envelope>

//response
<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Body>
        <u:StopResponse xmlns:u="urn:schemas-upnp-org:service:AVTransport:1" />
    </s:Body>
</s:Envelope>

5.设置视频播放

http://192.168.124.43:1266/AVTransport/skyworth&208B3756FFED&192.168.124.43/control.xml

<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:u="urn:schemas-upnp-org:service:AVTransport:1">
    <s:Body>
        <u:SetAVTransportURI>
            <InstanceID>0</InstanceID>
            <CurrentURI>http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4</CurrentURI>
            <CurrentURIMetaData>&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="f-0" parentID="0" restricted="0"&gt;&lt;dc:title&gt;Video&lt;/dc:title&gt;&lt;dc:creator&gt;Anonymous&lt;/dc:creator&gt;&lt;upnp:class&gt;object.item.videoItem&lt;/upnp:class&gt;&lt;res protocolInfo="http-get:*:video/*:DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01700000000000000000000000000000" sec:URIType="public"&gt;%@&lt;/res&gt;&lt;/item&gt;&lt;/DIDL-Lite&gt;</CurrentURIMetaData>
        </u:SetAVTransportURI>
    </s:Body>
</s:Envelope>

//response
<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Body>
        <u:SetAVTransportURIResponse xmlns:u="urn:schemas-upnp-org:service:AVTransport:1" />
    </s:Body>
</s:Envelope>

6.获取当前视频播放信息

http://192.168.124.43:1266/AVTransport/skyworth&208B3756FFED&192.168.124.43/control.xml

<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:u="urn:schemas-upnp-org:service:AVTransport:1">
    <s:Body>
        <u:GetTransportInfo>
            <InstanceID>0</InstanceID>
        </u:GetTransportInfo>
    </s:Body>
</s:Envelope>

//response
<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Body>
        <u:GetTransportInfoResponse xmlns:u="urn:schemas-upnp-org:service:AVTransport:1">
            <CurrentTransportState>NO_MEDIA_PRESENT</CurrentTransportState>
            <CurrentTransportStatus>OK</CurrentTransportStatus>
            <CurrentSpeed>1</CurrentSpeed>
        </u:GetTransportInfoResponse>
    </s:Body>
</s:Envelope>

7.视频播放指令

http://192.168.124.43:1266/AVTransport/skyworth&208B3756FFED&192.168.124.43/control.xml

<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:u="urn:schemas-upnp-org:service:AVTransport:1">
    <s:Body>
        <u:Play>
            <InstanceID>0</InstanceID>
            <Speed>1</Speed>
        </u:Play>
    </s:Body>
</s:Envelope>


//response
<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Body>
        <u:PlayResponse xmlns:u="urn:schemas-upnp-org:service:AVTransport:1" />
    </s:Body>
</s:Envelope>

8.获取音量

http://192.168.124.43:1266/RenderingControl/skyworth&208B3756FFED&192.168.124.43/control.xml

<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:u="urn:schemas-upnp-org:service:RenderingControl:1">
    <s:Body>
        <u:GetVolume>
            <InstanceID>0</InstanceID>
            <Channel>Master</Channel>
        </u:GetVolume>
    </s:Body>
</s:Envelope>

//response
<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Body>
        <u:GetVolumeResponse xmlns:u="urn:schemas-upnp-org:service:RenderingControl:1">
            <CurrentVolume>100</CurrentVolume>
        </u:GetVolumeResponse>
    </s:Body>
</s:Envelope>

9.设置音量

http://192.168.124.43:1266/RenderingControl/skyworth&208B3756FFED&192.168.124.43/control.xml

<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:u="urn:schemas-upnp-org:service:RenderingControl:1">
    <s:Body>
        <u:SetVolume>
            <InstanceID>0</InstanceID>
            <Channel>Master</Channel>
            <DesiredVolume>5</DesiredVolume>
        </u:SetVolume>
    </s:Body>
</s:Envelope>

//response
<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Body>
        <u:SetVolumeResponse xmlns:u="urn:schemas-upnp-org:service:RenderingControl:1" />
    </s:Body>
</s:Envelope>

10.暂停视频指令

http://192.168.124.43:1266/AVTransport/skyworth&208B3756FFED&192.168.124.43/control.xml

<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:u="urn:schemas-upnp-org:service:AVTransport:1">
    <s:Body>
        <u:Pause>
            <InstanceID>0</InstanceID>
        </u:Pause>
    </s:Body>
</s:Envelope>

//response
<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Body>
        <u:PauseResponse xmlns:u="urn:schemas-upnp-org:service:AVTransport:1" />
    </s:Body>
</s:Envelope>

11.播放快进退

http://192.168.124.43:1266/AVTransport/skyworth&208B3756FFED&192.168.124.43/control.xml

<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:u="urn:schemas-upnp-org:service:AVTransport:1">
    <s:Body>
        <u:Seek>
            <InstanceID>0</InstanceID>
            <Unit>REL_TIME</Unit>
            <Target>00:01:44</Target>
        </u:Seek>
    </s:Body>
</s:Envelope>

//response
<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Body>
        <u:SeekResponse xmlns:u="urn:schemas-upnp-org:service:AVTransport:1" />
    </s:Body>
</s:Envelope>

上述对于基本的控制指令都有了,发现要实现网络的都应该没问题了,但是老大需要我去实现本地的图片/视频的播放,结果还是得用其他的方式将本地的资源变成http的方式来访问。
详见 DLNA(三)

友情链接:

相关文章

  • DLNA和Upnp

    DLNA介绍一、DNLA的建立二、DLNA的成员三、DLNA标准的制定四、DLNA的设备五、DLNA的架构六、云时...

  • DLNA(二)

    接:DLNA(一) 下面我们来看看具体的控制(这里还是以悦me为例) 具体的代码见gitHubDemo里面的具体...

  • iOS开发,如何利用Platinum库开发一个DLNA功能?

    一、DLNA简介 什么是DLNA? DLNA的全称是DIGITAL LIVING NETWORK ALLIANCE...

  • DLNA目录

    学习DLNA记录 1. DLNA概述 通过这篇文章,你将了解什么DLNA,DLNA可以做什么以及相关过程 2. D...

  • DLNA(三)

    上节 DLNA(二)我们说了 对于DLNA的网络的资源投屏,但是要实现本地的,还是需要其他的方式 看到网上有人使用...

  • DLNA 与 UPnP 初探

    DLNA 是什么 DLNA 的全称是 Digital Living Network Alliance (数字生活网...

  • DLNA调研

    1:DLNA简述: DLNA是Digital Living Network Alliance(数字生活网络联盟)的...

  • Android DLNA投屏-基本原理

    1. DLNA简介 DLNA(Digital Living Network Alliance),即数字家庭网络联盟...

  • DLNA

    DLNA **两个实现DLNA相关功能的库 **https://github.com/wangshuaidavid...

  • iOS DLNA同屏投影开发

    最后更新 2017-08-15 23:20 提到DLNA,看到最多的是FuruyamaTakeshi/DLNA ...

网友评论

      本文标题:DLNA(二)

      本文链接:https://www.haomeiwen.com/subject/vcnpsqtx.html