目前国内的视频播放器中,支持 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