目前国内的视频播放器中,支持 DLNA 播放比较好的是:腾讯视频。
刚才反编了一下他们的代码,发现使用了一个开源库,
地址:https://github.com/FuruyamaTakeshi/DLNA
并且在这个库的基础了做了一层封装,包含如下几个类:
DLNAController:
1 @class CGUpnpAvController, CGUpnpAvRenderer, QLUpnpAVVolumeInfo, NSMutableArray, QLUpnpAVPositionInfo, NSString, NSTimer;
2 @protocol DLNAControllerDelegate;
3
4 @inte易做图ce 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 @inte易做图ce 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;
@inte易做图ce DLNAPlayBkgView : XXUnknownSuperclass {
@private
UILabel* _tmpLabel; // 48 = 0x30
UIActivityIndicatorView* _tIndicator; // 52 = 0
补充:移动开发 , IOS ,