GithubHelp home page GithubHelp logo

dlnawrapper's Introduction

DLNAWrapper

封装DLNA功能,基于Upnp实现简单的视频投射
使用SSDP发现设备
使用SOAP控制设备
封装常用操作(播放,暂停等)
实现了DMC功能
实现投射本地资源功能

引用的依赖库:GCDAsyncUdpSocketGDataXMLGCDWebServerMasonry

Core

  • DLNAUpnpServer.h DLNA服务类,用于扫描设备
  • Device.h 设备
  • DeviceChangeDelegate.h 设备变化代理
  • ControlPoint.h 控制点类,用于执行动作
  • ControlService.h 封装设备可用的控制服务
  • Action 封装所有操作的动作,详细见Action文件夹
  • Config.h 定义配置类
  • FileServer.h 文件服务类,用于投射本地资源,不用此功能可无视

Using

集成到自己的项目中:

1.复制Core文件夹到项目里

  • 如果不需要投射本地资源的话,可以不用复制FileServer.h/.m 和 GCDWebServer文件夹,不用配置GCDWebServer和FileServer

2.配置GDataXML

  • 项目target -> Build Settings -> Search Paths -> Search Header Paths 添加 "$(SDKROOT)/usr/include/libxml2"
  • 项目target -> Build Phases -> Link Binary With Libraries -> 添加 "libxml2.2.tbd"
  • 项目target -> Build Phases -> Compile Sources -> 选择GDataXMLNode.m 回车添加 "-fno-objc-arc"

3.配置GCDWebServer

  • 项目target -> Build Phases -> Link Binary With Libraries -> 添加 "libz.1.2.5.tbd"

4.配置FileServer

  • 项目target -> Build Phases -> Link Binary With Libraries -> 添加 "Photos.framework"
  • ps: 可根据自己需求修改本地资源的获取方式(不用PhotoKit)

5.启动DLNAUpnpServer

[[DLNAUpnpServer shareServer] start];

6.启动FileServer(可选)

[[FileServer shareServer] start];

对设备的控制操作请参考例子

运行例子:

  • 根目录下
pod install
  • 打开DLNAWrapper.xcworkspace
  • ps: 例子写的有点随便,请不要在意

License

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

dlnawrapper's People

Contributors

keyyao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

dlnawrapper's Issues

SOAP控制不了设备

可以搜到设备也可以将视频投屏,但是有些设备不能对它进行暂停、快退进等操作的控制,比如创维的电视,视频投上去之后,就没法子对它进行其他操作了,请问这个要怎么解决

不支持https的视频投屏?

excecute "SetAVTransportURI" action error : "(null)", response data -- > <s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><s:Fault>s:ClientUPnPError402Not enough IN args, too many IN args, no IN arg by that name, one or more IN args are of the wrong data type. Only HTTP and file: resource identifiers are supported.</s:Fault></s:Body></s:Envelope>
2017-07-14 14:35:36.418174+0800 DLNAWrapper[1125:196404] 设置 URL 失败

视频播放

你好,运行博主的程序,能够正常显示iphone中的照片。但是不能播放iphone 本地的视频,也不能播放(输入网络地址的)youtube网络视频(没被墙,手机网页能播放)。

错误信息如下:

2017-04-16 12:20:13.559776-0400 DLNAWrapper[309:20496] ===============>> excecute "Stop" action success, response data -- > <?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">

<s:Body>

<u:StopResponse xmlns:u="urn:schemas-upnp-org:service:AVTransport:1"></u:StopResponse>

</s:Body>

</s:Envelope>
[DEBUG] Did open connection on socket 12
[DEBUG] Did connect
[DEBUG] Did start background task
[DEBUG] Connection received 145 bytes on socket 12
[DEBUG] Connection on socket 12 preflighting request "HEAD /video" with 145 bytes body
[DEBUG] Connection on socket 12 processing request "HEAD /video" with 145 bytes body
[DEBUG] Connection sent 251 bytes on socket 12
[DEBUG] Did close connection on socket 12
[VERBOSE] [192.168.1.138:5438] 192.168.1.116:36682 200 "HEAD /video" (145 | 251)
2017-04-16 12:20:14.942524-0400 DLNAWrapper[309:20642] ===============>> excecute "SetAVTransportURI" action error : "(null)", response data -- > <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>714</errorCode><errorDescription>Illegal MIME-type</errorDescription></UPnPError></detail></s:Fault>

</s:Body>

</s:Envelope>
2017-04-16 12:20:14.942932-0400 DLNAWrapper[309:20080] 设置 URL 失败
[DEBUG] Did disconnect
[DEBUG] Did end background task

不知道如何能播放手机本地视频或者网络视频到电视上?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.