|
|
# 开发指南
|
|
|
|
|
|
## 1.播放功能
|
|
|
|
|
|
### 1.1 DWVodVideoModel数据模型的使用
|
... | ... | @@ -943,6 +945,257 @@ DWVideoExercisesQuestionAnswerModel数据及含义如下: |
|
|
@property (nonatomic, strong) NSString * answerContent;
|
|
|
```
|
|
|
|
|
|
## 1.13 视频投屏
|
|
|
|
|
|
### 1.13.1 投屏设备的搜索
|
|
|
DWUPnPSearch是设备搜索类,负责搜索可投放视频的设备。
|
|
|
|
|
|
具体的属性及方法如下:
|
|
|
```
|
|
|
@property (nonatomic, weak) id<DWUPnPSearchDelegate>delegate;
|
|
|
|
|
|
/**
|
|
|
开始搜索
|
|
|
*/
|
|
|
- (void)start;
|
|
|
|
|
|
/**
|
|
|
销毁对象
|
|
|
*/
|
|
|
- (void)destroy;
|
|
|
|
|
|
/**
|
|
|
重新搜索
|
|
|
*/
|
|
|
- (void)refresh;
|
|
|
```
|
|
|
|
|
|
DWUPnPSearchDelegate方法如下:
|
|
|
```
|
|
|
/**
|
|
|
搜索结果
|
|
|
|
|
|
@param devices 设备数组
|
|
|
*/
|
|
|
- (void)upnpSearchChangeWithResults:(NSArray <DWUPnPDevice *>*)devices;
|
|
|
|
|
|
@optional
|
|
|
/**
|
|
|
搜索失败
|
|
|
|
|
|
@param error error
|
|
|
*/
|
|
|
- (void)upnpSearchErrorWithError:(NSError *)error;
|
|
|
```
|
|
|
|
|
|
### 1.13.2 投屏以及控制设备的事件
|
|
|
DWUPnPRenderer是设备控制类,可以控制设备的播放链接,开始暂停等等一些列功能。
|
|
|
|
|
|
DWUPnPRenderer的具体属性与方法如下:
|
|
|
```
|
|
|
//设备model
|
|
|
@property (nonatomic, strong) DWUPnPDevice *model;
|
|
|
|
|
|
@property (nonatomic, strong) id<DWUPnPResponseDelegate>delegate;
|
|
|
|
|
|
/**
|
|
|
初始化
|
|
|
@param model 搜索得到的UPnPModel
|
|
|
@return self
|
|
|
*/
|
|
|
- (instancetype)initWithModel:(DWUPnPDevice *)model;
|
|
|
|
|
|
/**
|
|
|
设置投屏地址
|
|
|
@param urlStr 视频url
|
|
|
*/
|
|
|
- (void)setAVTransportURL:(NSString *)urlStr;
|
|
|
|
|
|
/**
|
|
|
设置下一个播放地址
|
|
|
@param urlStr 下一个视频url
|
|
|
*/
|
|
|
- (void)setNextAVTransportURI:(NSString *)urlStr;
|
|
|
|
|
|
/**
|
|
|
播放
|
|
|
*/
|
|
|
- (void)play;
|
|
|
|
|
|
/**
|
|
|
暂停
|
|
|
*/
|
|
|
- (void)pause;
|
|
|
|
|
|
/**
|
|
|
结束
|
|
|
*/
|
|
|
- (void)stop;
|
|
|
|
|
|
/**
|
|
|
下一个
|
|
|
*/
|
|
|
- (void)next;
|
|
|
|
|
|
/**
|
|
|
前一个
|
|
|
*/
|
|
|
- (void)previous;
|
|
|
|
|
|
/**
|
|
|
跳转进度
|
|
|
@param relTime 进度时间(单位秒)
|
|
|
*/
|
|
|
- (void)seek:(float)relTime;
|
|
|
|
|
|
/**
|
|
|
跳转至特定进度或视频
|
|
|
@param target 目标值,可以是 00:02:21 格式的进度或者整数的 TRACK_NR。
|
|
|
@param unit REL_TIME(跳转到某个进度)或 TRACK_NR(跳转到某个视频)。
|
|
|
*/
|
|
|
- (void)seekToTarget:(NSString *)target Unit:(NSString *)unit;
|
|
|
|
|
|
/**
|
|
|
获取播放进度,可通过协议回调使用
|
|
|
*/
|
|
|
- (void)getPositionInfo;
|
|
|
|
|
|
/**
|
|
|
获取播放状态,可通过协议回调使用
|
|
|
*/
|
|
|
- (void)getTransportInfo;
|
|
|
|
|
|
/**
|
|
|
获取音频,可通过协议回调使用
|
|
|
*/
|
|
|
- (void)getVolume;
|
|
|
|
|
|
/**
|
|
|
设置音频值
|
|
|
@param value 值—>整数
|
|
|
*/
|
|
|
- (void)setVolumeWith:(NSString *)value;
|
|
|
```
|
|
|
|
|
|
DWUPnPResponseDelegate对应DWUPnPRenderer的事件回调,设置成功后会被调用。以下是具体的方法含义:
|
|
|
```
|
|
|
@required
|
|
|
|
|
|
/// 设置url响应
|
|
|
- (void)upnpSetAVTransportURIResponse;
|
|
|
|
|
|
/// 获取播放状态
|
|
|
- (void)upnpGetTransportInfoResponse:(DWUPnPTransportInfo *)info;
|
|
|
|
|
|
@optional
|
|
|
|
|
|
/**
|
|
|
未定义的响应/错误
|
|
|
|
|
|
@param resXML 响应XML
|
|
|
@param postXML 请求的动作
|
|
|
*/
|
|
|
- (void)upnpUndefinedResponse:(NSString *)resXML postXML:(NSString *)postXML;
|
|
|
|
|
|
/// 播放响应
|
|
|
- (void)upnpPlayResponse;
|
|
|
|
|
|
/// 暂停响应
|
|
|
- (void)upnpPauseResponse;
|
|
|
|
|
|
/// 停止投屏
|
|
|
- (void)upnpStopResponse;
|
|
|
|
|
|
/// 跳转响应
|
|
|
- (void)upnpSeekResponse;
|
|
|
|
|
|
/// 以前的响应
|
|
|
- (void)upnpPreviousResponse;
|
|
|
|
|
|
/// 下一个响应
|
|
|
- (void)upnpNextResponse;
|
|
|
|
|
|
/// 设置音量响应
|
|
|
- (void)upnpSetVolumeResponse;
|
|
|
|
|
|
/// 设置下一个url响应
|
|
|
- (void)upnpSetNextAVTransportURIResponse;
|
|
|
|
|
|
/// 获取音频信息
|
|
|
- (void)upnpGetVolumeResponse:(NSString *)volume;
|
|
|
|
|
|
/// 获取播放进度
|
|
|
- (void)upnpGetPositionInfoResponse:(DWUPnPAVPositionInfo *)info;
|
|
|
```
|
|
|
|
|
|
DWUPnPDevice设备类,包含了一些设备的属性。以下是属性及含义:
|
|
|
```
|
|
|
///设备ID
|
|
|
@property(nonatomic,copy)NSString * uuid;
|
|
|
|
|
|
///设备loactionURL
|
|
|
@property(nonatomic,strong)NSURL * loaction;
|
|
|
|
|
|
///设备地址
|
|
|
@property(nonatomic,copy)NSString * URLHeader;
|
|
|
|
|
|
///友好的设备名称
|
|
|
@property(nonatomic,copy) NSString * friendlyName;
|
|
|
|
|
|
//设备名称
|
|
|
@property(nonatomic,copy) NSString * modelName;
|
|
|
|
|
|
@property(nonatomic,strong) DWServiceModel * AVTransport;
|
|
|
|
|
|
@property(nonatomic,strong) DWServiceModel * RenderingControl;
|
|
|
```
|
|
|
|
|
|
## 1.13.3 接收投屏设备的回调
|
|
|
DWUPnPSubscription是设备订阅类,主要负责订阅设备以及接收设备事件。
|
|
|
|
|
|
具体的方法及含义如下:
|
|
|
```
|
|
|
//设备model
|
|
|
@property(nonatomic,strong)DWUPnPDevice *model;
|
|
|
|
|
|
@property(nonatomic,weak)id <DWUPnPSubscriptionDelegate> delegate;
|
|
|
|
|
|
/**
|
|
|
初始化
|
|
|
@param model 搜索得到的UPnPModel
|
|
|
@return self
|
|
|
*/
|
|
|
- (instancetype)initWithModel:(DWUPnPDevice *)model;
|
|
|
|
|
|
/**
|
|
|
开始订阅
|
|
|
*/
|
|
|
-(void)startSubscribe;
|
|
|
|
|
|
/**
|
|
|
结束订阅
|
|
|
*/
|
|
|
-(void)cancelSubscribe;
|
|
|
```
|
|
|
|
|
|
DWUPnPSubscriptionDelegate是接收到回调事件,以下是它方法的具体含义:
|
|
|
```
|
|
|
///视频传输中
|
|
|
-(void)upnpSubscriptionTransition;
|
|
|
|
|
|
///设备播放投屏
|
|
|
-(void)upnpSubscriptionPlay;
|
|
|
|
|
|
///设备暂停投屏
|
|
|
-(void)upnpSubscriptionPause;
|
|
|
|
|
|
///设备退出投屏
|
|
|
-(void)upnpSubscriptionStop;
|
|
|
|
|
|
///error回调
|
|
|
-(void)upnpSubscriptionWithError:(NSError *)error;
|
|
|
```
|
|
|
|
|
|
# 2.下载功能
|
|
|
|
|
|
## 2.1 下载功能的快速集成,请详见2.集成指南
|
... | ... | |