目前国内的视频播放器中,支持 DLNA 播放比较好的是:腾讯视频。

刚才反编了一下他们的代码,发现使用了一个开源库,

地址:https://github.com/FuruyamaTakeshi/DLNA

并且在这个库的基础了做了一层封装,包含如下几个类:

DLNAController:

 1 @class CGUpnpAvController, CGUpnpAvRenderer, QLUpnpAVVolumeInfo, NSMutableArray, QLUpnpAVPositionInfo, NSString, NSTimer;
 2 @protocol DLNAControllerDelegate;
 3
 4 @interface DLNAController : XXUnknownSuperclass <CGUpnpControlPointDelegate> {
 5 @private
 6     dispatch_queue_s* _playQueue;    // 4 = 0x4
 7     dispatch_queue_s* _searchQueue;    // 8 = 0x8
 8     CGUpnpAvRenderer* _dlnaPlayingRender;    // 12 = 0xc
 9     CGUpnpAvRenderer* _dlnaSelectedRender;    // 16 = 0x10
10     CGUpnpAvController* _upnpAvController;    // 20 = 0x14
11     NSMutableArray* _dlnaRenders;    // 24 = 0x18
12     NSTimer* _timerLoadInfos;    // 28 = 0x1c
13     BOOL _isSettingVolume;    // 32 = 0x20
14     BOOL _isSettingSeek;    // 33 = 0x21
15     id<DLNAControllerDelegate> delegate;    // 36 = 0x24
16     float _trackDuration;    // 40 = 0x28
17     float _curPlayTime;    // 44 = 0x2c
18     float _volumePercentage;    // 48 = 0x30
19     NSString* _curRenderName;    // 52 = 0x34
20     unsigned _fileSize;    // 56 = 0x38
21     QLUpnpAVPositionInfo* _positionInfo;    // 60 = 0x3c
22     QLUpnpAVVolumeInfo* _volumeInfo;    // 64 = 0x40
23     NSString* _curTitle;    // 68 = 0x44
24 }
25 @property(retain) QLUpnpAVPositionInfo* positionInfo;    // G=0x1ecead; S=0x1ecec5;
26 @property(retain) QLUpnpAVVolumeInfo* volumeInfo;    // G=0x1ecee9; S=0x1ecf01;
27 @property(readonly, assign) int dlnaRendersCount;    // G=0x1eabf5;
28 @property(readonly, assign) float volumePercentage;    // G=0x1eae41;
29 @property(readonly, assign) float curPlayTime;    // G=0x1ead59;
30 @property(readonly, assign) float trackDuration;    // G=0x1eadcd;
31 @property(readonly, assign) NSString* curRenderName;    // G=0x1eacc1;
32 @property(copy) NSString* curTitle;    // G=0x1ecf25; S=0x1ecf3d;
33 @property(assign) unsigned fileSize;    // G=0x1ece81; S=0x1ece95;
34 @property(assign) id<DLNAControllerDelegate> delegate;    // G=0x1ece55; S=0x1ece69;
35 +(id)sharedDLNAController;    // 0x1ea329
36 -(void)didFindRendersMain:(id)main;    // 0x1ecdfd
37 -(void)maitainConnectionMain:(id)main;    // 0x1ecdb5
38 -(void)loseConnectionMain:(id)main;    // 0x1eccc1
39 -(void)mainPlayStop:(id)stop;    // 0x1ecc65
40 -(void)mainPlayFailed:(id)failed;    // 0x1ecc1d
41 -(void)mainPlayDown:(id)down;    // 0x1ecbc1
42 -(BOOL)setVolume:(float)volume skipIfBusy:(BOOL)busy;    // 0x1eca55
43 -(BOOL)seek:(double)seek;    // 0x1ec8f9
44 -(BOOL)quit;    // 0x1ec719
45 -(BOOL)stop;    // 0x1ec5ed
46 -(BOOL)pause;    // 0x1ec4d1
47 -(BOOL)play;    // 0x1ec341
48 -(BOOL)isPlaying;    // 0x1ec305
49 -(void)controlPoint:(id)point deviceInvalid:(id)invalid;    // 0x1ec301
50 -(void)controlPoint:(id)point deviceUpdated:(id)updated;    // 0x1ec2fd
51 -(void)controlPoint:(id)point deviceRemoved:(id)removed;    // 0x1ebfa1
52 -(void)controlPoint:(id)point deviceAdded:(id)added;    // 0x1ebc61
53 -(void)searchReaders:(BOOL)readers;    // 0x1eb8a9
54 -(void)connection:(id)connection didReceiveResponse:(id)response;    // 0x1eb785
55 -(void)connectionDidFinishLoading:(id)connection;    // 0x1eb76d
56 -(void)connection:(id)connection didFailWithError:(id)error;    // 0x1eb719
57 -(void)playOnThreadWithInfo:(id)info;    // 0x1eb4e5
58 -(void)beginPlayDLNAWithUrl:(id)url;    // 0x1eb225
59 -(void)playURL:(id)url;    // 0x1eafc5
60 -(void)setRenderAtIndex:(int)index;    // 0x1eaea5
61 -(id)getRenderAtIndex:(int)index;    // 0x1eaafd
62 -(void)loadInfoOfDLNA;    // 0x1ea83d
63 -(void)stopTimers;    // 0x1ea80d
64 -(void)startTimers;    // 0x1ea7ad
65 -(void)clearAllInfos;    // 0x1ea76d
66 -(void)clearTimerInfo;    // 0x1ea71d
67 -(void)clearPlayInfo;    // 0x1ea5e5
68 -(id)init;    // 0x1ea539
69 -(void)dealloc;    // 0x1ea411
70 @end

DLNAControllerDelegate

1 @protocol DLNAControllerDelegate <NSObject>
2 -(void)dlnaControllerdidStoped:(id)stoped;
3 -(void)dlnaControllerdidMaitainConnection:(id)connection;
4 -(void)dlnaControllerdidLoseConnection:(id)connection;
5 -(void)dlnaControllerdidFailedToPlay:(id)play;
6 -(void)dlnaControllerdidStartToPlay:(id)play;
7 -(void)dlnaController:(id)controller didFindRenders:(id)renders;
8 @end

DLNAModel

 1 @protocol DLNAModelDelegate;
 2
 3 @interface DLNAModel : XXUnknownSuperclass {
 4 @private
 5     id<DLNAModelDelegate> _delegate;    // 4 = 0x4
 6 }
 7 @property(assign, nonatomic) id<DLNAModelDelegate> delegate;    // G=0x1d2409; S=0x1d2419;
 8 -(void)request:(id)request didFailLoadWithError:(id)error;    // 0x1d23c9
 9 -(void)requestDidFinishLoad:(id)request;    // 0x1d2045
10 -(void)sendRequestWithVideoID:(id)videoID isPay:(BOOL)pay;    // 0x1d1ef5
11 @end

DLNAModelDelegate

@protocol DLNAModelDelegate <NSObject>
-(void)DLNAModelDelegateRequestDidFail:(id)dlnamodelDelegateRequest;
-(void)DLNAModelDelegateRequestDidSuccess:(id)dlnamodelDelegateRequest urlString:(id)string;
@end

DLNAPlayBkgView

@class UIActivityIndicatorView, UILabel;@interface DLNAPlayBkgView : XXUnknownSuperclass {
@privateUILabel* _tmpLabel;    // 48 = 0x30UIActivityIndicatorView* _tIndicator;    // 52 = 0x34
}
@property(retain, nonatomic) UILabel* tmpLabel;    // G=0x1d0c25; S=0x1d0c35;
@property(retain, nonatomic) UIActivityIndicatorView* tIndicator;    // G=0x1d0c59; S=0x1d0c69;
-(void)setLableTip:(id)tip showActivity:(BOOL)activity;    // 0x1d0a5d
-(id)initWithFrame:(CGRect)frame;    // 0x1d06c1
-(void)dealloc;    // 0x1d0669
@end

DLNASelectorView

@class UITableView, UIView;
@protocol DLNASelectorViewDelegate;@interface DLNASelectorView : XXUnknownSuperclass <UITableViewDataSource, UITableViewDelegate> {
@privateUIView* _dlnaSearchingView;    // 48 = 0x30UITableView* _dlnaTableView;    // 52 = 0x34id<DLNASelectorViewDelegate> _delegate;    // 56 = 0x38UIView* _tContentView;    // 60 = 0x3cUIView* _noneDLNATipView;    // 64 = 0x40
}
@property(retain, nonatomic) UIView* dlnaSearchingView;    // G=0x1d16c9; S=0x1d1e35;
@property(retain, nonatomic) UITableView* dlnaTableView;    // G=0x1d15dd; S=0x1d1e59;
@property(retain, nonatomic) UIView* noneDLNATipView;    // G=0x1d12cd; S=0x1d1ed1;
@property(retain, nonatomic) UIView* tContentView;    // G=0x1d1e9d; S=0x1d1ead;
@property(assign, nonatomic) id<DLNASelectorViewDelegate> delegate;    // G=0x1d1e7d; S=0x1d1e8d;
-(void)tableView:(id)view didSelectRowAtIndexPath:(id)indexPath;    // 0x1d1dc1
-(int)tableView:(id)view numberOfRowsInSection:(int)section;    // 0x1d1d8d
-(id)tableView:(id)view cellForRowAtIndexPath:(id)indexPath;    // 0x1d1bf1
-(void)dlnaCloseDown:(id)down;    // 0x1d1bc5
-(void)dlnaRefreshDown:(id)down;    // 0x1d1b15
-(void)showSearchView;    // 0x1d1ab9
-(void)refreshSelectorTable;    // 0x1d18dd
-(id)initWithFrame:(CGRect)frame;    // 0x1d0d11
-(void)dealloc;    // 0x1d0c91
@end

@protocol DLNASelectorViewDelegate <NSObject>
-(void)DLNASelectorViewSelectedRender:(id)render;
-(void)DLNASelectorViewWillClose:(id)dlnaselectorView;
@end

QLUpnpAVPositionInfo:

@class CGUpnpAction;@interface QLUpnpAVPositionInfo : XXUnknownSuperclass {
@privatefloat _trackDuration;    // 4 = 0x4float _absTime;    // 8 = 0x8float _relTime;    // 12 = 0xcCGUpnpAction* _upnpAction;    // 16 = 0x10
}
@property(retain, nonatomic) CGUpnpAction* upnpAction;    // G=0x1f1eb5; S=0x1f1ec5;
@property(readonly, assign, nonatomic) float relTime;    // G=0x1f1ea5;
@property(readonly, assign, nonatomic) float absTime;    // G=0x1f1e95;
@property(readonly, assign, nonatomic) float trackDuration;    // G=0x1f1e85;
-(void)dealloc;    // 0x1f1e41
-(id)initWithAction:(id)action;    // 0x1f1d65
@end

QLUpnpAVVolumeInfo

@class CGUpnpAction;@interface QLUpnpAVVolumeInfo : XXUnknownSuperclass {
@privatefloat _currentVolumePercentage;    // 4 = 0x4CGUpnpAction* _upnpAction;    // 8 = 0x8
}
@property(retain, nonatomic) CGUpnpAction* upnpAction;    // G=0x1ed05d; S=0x1ed06d;
@property(readonly, assign, nonatomic) float currentVolumePercentage;    // G=0x1ed04d;
-(void)dealloc;    // 0x1ed009
-(id)initWithAction:(id)action;    // 0x1ecf61
@end

找时间阅读下汇编代码,写出一个开源版本。^_^

转载于:https://www.cnblogs.com/Proteas/p/3388734.html

[原]关于在 iOS 中支持 DLNA相关推荐

  1. ios 中使用DLNA搜索dms设备

    什么是DLNA DLNA的全称是DIGITAL LIVING NETWORK ALLIANCE, 其宗旨是Enjoy your music, photos and videos, anywhere a ...

  2. ios wkweb设置图片_在iOS中使用WKWebView如何支持展示webp格式图片(包括本地html)?...

    频繁有客人反馈我们图片在某些地区如:意大利 反馈我们APP图片展示太慢,印象客人下单体验,于是我们开始着手分析.因为我们是混合开发项目,首选确定了iOS不支持,安卓系统4.x以上天然支持不需要处理. ...

  3. iOS中的HotFix方案总结详解

    iOS中的HotFix方案总结详解 相信HotFix大家应该都很熟悉了,今天主要对于最近调研的一些方案做一些总结.iOS中的HotFix方案大致可以分为四种: WaxPatch(Alibaba) Dy ...

  4. 正则表达式在iOS中的运用

    http://my.oschina.net/u/1245365/blog/376517 http://my.oschina.net/joanfen/blog/415076 摘要 做项目时,经常要检测一 ...

  5. iOS中ImageIO框架详解与应用分析

    2019独角兽企业重金招聘Python工程师标准>>> iOS中ImageIO框架详解与应用分析 一.引言 ImageIO框架提供了读取与写入图片数据的基本方法,使用它可以直接获取到 ...

  6. [iOS开发]iOS中的Hash

    文章目录 前言 关联对象的底层原理 weak的实现原理 KVO的实现原理 iOS App签名的原理 对象引用计数存储的位置 Runloop与线程的存储关系 NSDictionary的原理 哈希表 哈希 ...

  7. ios中常用的第三方库

    下拉刷新 EGOTableViewPullRefresh – 最早的下拉刷新控件. SVPullToRefresh – 下拉刷新控件. MJRefresh – 仅需一行代码就可以为UITableVie ...

  8. Android中开发DLNA,Miracast对比

    Android中开发DLNA,Miracast对比 需求是在android 9.0上实现投屏,手机,高通平台. 主流的投屏技术:Miracast,DLNA,AirPlay. Google主推的goog ...

  9. iOS中几种数据持久化方案总结

    概论 所谓的持久化,就是将数据保存到硬盘中,使得在应用程序或机器重启后可以继续访问之前保存的数据.在iOS开发中,有很多数据持久化的方案,接下来我将尝试着介绍一下5种方案: plist文件(属性列表) ...

最新文章

  1. 李宏毅机器学习笔记(五)-----Where does the error come from
  2. CC2431 代码分析③-忍辱负重的CC2430
  3. 华为程序员频交Linux内核补丁遭质疑,管理员后续回应:承认贡献,但请不要琐碎提交...
  4. 多云战略未来五大趋势分析,必看!
  5. (MSDN)VB.NET的强大和C#语言的比较【转载】
  6. 1高并发服务器:多进程服务器
  7. 华为鸿蒙不再孤单mmes,华为Watch GT2新色图赏 简约时尚设计新增100种运动模式
  8. SparkSQL性能优化
  9. [JS][jQuery]清空元素html()、innerHTML= 与 empty()的区别 、remove()区别
  10. golang基础之初识
  11. mysql 合计单条数据_mysql之数据去重并记录总数
  12. thinkphp中I(parm)用法的注意事项
  13. Linux chapter 3
  14. 最小生成树 POJ - 3522(枚举边最小生成树)
  15. SPI机制入门、SPI机制原理
  16. Magisk 安装说明
  17. linux下addr2line详解
  18. phpwind database.php,phpwind中的数据库操作类
  19. Android流式布局FlowLayout,一款针对Tag的布局
  20. 手机版云盘怎么打开连接服务器,手把手教你简易NAS构建,手机/平板/智能电视随意调取,家庭存储云共享,有了自己的网络云盘后再也不用担心容量不够了!...

热门文章

  1. 位置服务器管理器,查看 DIMM 位置
  2. 位数不足前面补0mysql语句_全网热议:监控补光灯爆亮闪瞎眼!你遇到过吗?
  3. qopenglwidget 透明_廊坊透明真空袋用途-祺泰包装
  4. C语言代码规范(七)#define
  5. STM32F1笔记(十)PWM
  6. metasploitable2渗透测试
  7. 【数据结构基础笔记】【栈】
  8. c+ +三角函数_C ++中的三角函数
  9. matlab4.0,matlab 4.0
  10. 前端的请求最大线程数是多少啊_面试官:创建多少个线程合适,我该怎么说?...