class TXVodDownloadDataSource |
属性 | |
TXPlayerAuthParams * | auth |
TXVodQuality | quality |
NSString * | token |
NSString * | templateName |
NSString * | fileId |
NSString * | pSign |
int | appId |
NSString * | userName |
NSString * | overlayKey |
NSString * | overlayIv |
|
readwritenonatomicassign |
应用appId。必填
|
readwritenonatomicassign |
fileid信息
|
readwritenonatomiccopy |
文件Id
|
readwritenonatomiccopy |
加解密参数 overlayIv
|
readwritenonatomiccopy |
HLS EXT-X-KEY 加解密参数
|
readwritenonatomiccopy |
签名信息
|
readwritenonatomicassign |
下载清晰度,默认原画
|
readwritenonatomiccopy |
清晰度模板。如果后台转码是自定义模板,请在这里填写模板名。templateName和quality同时设置时,以templateName为v准
|
readwritenonatomiccopy |
如地址有加密,请填写token
|
readwritenonatomiccopy |
账户名称
class TXVodDownloadMediaInfo |
构造函数 | |
(BOOL) | - isDownloadFinished |
属性 | |
TXVodDownloadDataSource * | dataSource |
NSString * | url |
NSString * | userName |
int | duration |
int | playableDuration |
int | size |
int | downloadSize |
int | segments |
int | downloadSegments |
float | progress |
NSString * | playPath |
int | speed |
TXVodDownloadMediaInfoState | downloadState |
- (BOOL) isDownloadFinished |
是否下载完成
|
readwriteatomic |
fileid下载对象(可选)
|
readwritenonatomicassign |
已下载的分段数
|
readwritenonatomicassign |
已下载大小,单位:byte
|
readwritenonatomicassign |
下载状态
|
readwritenonatomicassign |
时长
|
readwritenonatomicassign |
可播放时长
|
readwritenonatomiccopy |
播放路径,可传给TXVodPlayer播放
|
readwritenonatomicassign |
进度
|
readwritenonatomicassign |
分段总数
|
readwritenonatomicassign |
文件总大小,单位:byte
|
readwritenonatomicassign |
下载速度,byte每秒
|
readwritenonatomiccopy |
下载地址
|
readwritenonatomiccopy |
账户名称
protocol TXVodDownloadDelegate-p |
构造函数 | |
(void) | - onDownloadStart: |
(void) | - onDownloadProgress: |
(void) | - onDownloadStop: |
(void) | - onDownloadFinish: |
(void) | - onDownloadError:errorCode:errorMsg: |
(int) | - hlsKeyVerify:url:data: |
- (int) hlsKeyVerify: | (TXVodDownloadMediaInfo *) | mediaInfo | |
url: | (NSString *) | url | |
data: | (NSData *) | data | |
下载HLS,遇到加密的文件,将解密key给外部校验
mediaInfo | 下载对象 |
url | Url地址 |
data | 服务器返回 |
- (void) onDownloadError: | (TXVodDownloadMediaInfo *) | mediaInfo | |
errorCode: | (TXDownloadError) | code | |
errorMsg: | (NSString *) | msg | |
下载错误
- (void) onDownloadFinish: | (TXVodDownloadMediaInfo *) | mediaInfo |
下载完成
- (void) onDownloadProgress: | (TXVodDownloadMediaInfo *) | mediaInfo |
下载进度
- (void) onDownloadStart: | (TXVodDownloadMediaInfo *) | mediaInfo |
下载开始
- (void) onDownloadStop: | (TXVodDownloadMediaInfo *) | mediaInfo |
下载停止
class TXVodDownloadManager |
构造函数 | |
(void) | - setDownloadPath: |
(TXVodDownloadMediaInfo *) | - startDownload: |
(TXVodDownloadMediaInfo *) | - startDownload:url: |
(void) | - stopDownload: |
(BOOL) | - deleteDownloadFile: |
(void) | - deleteDownloadMediaInfo: |
(NSArray< TXVodDownloadMediaInfo * > *) | - getDownloadMediaInfoList |
(TXVodDownloadMediaInfo *) | - getDownloadMediaInfo: |
(NSString *) | - getOverlayKeyIv:userName:fileId:qualityId: |
类方法 | |
(TXVodDownloadManager *) | + shareInstance |
(NSString *) | + genRandomHexStringForHls |
(NSString *) | + encryptHexStringHls: |
属性 | |
id< TXVodDownloadDelegate > | delegate |
NSDictionary * | headers |
- (BOOL) deleteDownloadFile: | (NSString *) | playPath |
删除下载产生的文件
- (void) deleteDownloadMediaInfo: | (TXVodDownloadMediaInfo *) | downloadMediaInfo |
删除下载信息
downloadMediaInfo | downloadMediaInfo |
+ (NSString *) encryptHexStringHls: | (NSString *) | originHexStr |
加密
originHexStr | originHexStr |
+ (NSString *) genRandomHexStringForHls |
加密相关 获取加密随机数
- (TXVodDownloadMediaInfo *) getDownloadMediaInfo: | (TXVodDownloadMediaInfo *) | media |
获取下载信息
media | media |
- (NSArray<TXVodDownloadMediaInfo *> *) getDownloadMediaInfoList |
获取下载列表,调用前必须设置download meta,具体见setDownloadMeta方法
- (NSString *) getOverlayKeyIv: | (int) | appId | |
userName: | (NSString *) | userName | |
fileId: | (NSString *) | fileId | |
qualityId: | (int) | qualityId | |
获取HLS EXT-X-KEY 加解密的overlayKey和overlayIv
appId | appId |
userName | userName |
fileId | fileId |
qualityId | qualityId |
- (void) setDownloadPath: | (NSString *) | path |
设置下载文件的根目录。
path | 目录地址,如不存在,将自动创建 |
+ (TXVodDownloadManager *) shareInstance |
全局单例接口
- (TXVodDownloadMediaInfo *) startDownload: | (TXVodDownloadDataSource *) | source |
下载文件
source | 下载源。 |
- (TXVodDownloadMediaInfo *) startDownload: | (NSString *) | username | |
url: | (NSString *) | url | |
下载文件
username | username |
url | url |
- (void) stopDownload: | (TXVodDownloadMediaInfo *) | media |
停止下载
media | 停止下载对象 |
|
readwritenonatomicweak |
下载任务回调
|
readwritenonatomicstrong |
设置 HTTP 头
enum TXDownloadError : NSInteger |
enum TXVodDownloadMediaInfoState : NSInteger |
enum TXVodQuality : NSInteger |