BSYDownloadSessionManager Class Reference

Inherits from NSObject
Declared in BSYDownloadSessionManager.h

  downloadTaskList

下载的所有任务队列

@property (nonatomic, strong, readonly) NSArray<BSYDownloadModel*> *downloadTaskList

Declared In

BSYDownloadSessionManager.h

  delegate

代理

@property (nonatomic, weak) id<BSYDownloadSessionManagerDelegate> delegate

Declared In

BSYDownloadSessionManager.h

  allowsCellular

是否允许使用移动流量 YES支持 NO不支持 默认支持

@property (nonatomic, assign) BOOL allowsCellular

Declared In

BSYDownloadSessionManager.h

  isBatchDownload

全部并发,默认YES, 当YES时,忽略maxDownloadCount

@property (nonatomic, assign) BOOL isBatchDownload

Declared In

BSYDownloadSessionManager.h

  maxDownloadCount

允许同时下载的最大并发数,默认为1,最大为10

@property (nonatomic, assign) NSInteger maxDownloadCount

Declared In

BSYDownloadSessionManager.h

+ sharedInstance

初始化BSYDownloadSessionManager

+ (instancetype)sharedInstance

Return Value

BSYDownloadSessionManager对象

Discussion

@method

初始化BSYDownloadSessionManager

Declared In

BSYDownloadSessionManager.h

– configBaseStorePath:

配置下载数据存储目录,作为多用户下载数据区分

- (void)configBaseStorePath:(NSString *)path

Parameters

path

存储目录

Discussion

@method

Declared In

BSYDownloadSessionManager.h

– addDownloadTask:

开始下载任务

- (void)addDownloadTask:(BSYDownloadModel *)downloadModel

Parameters

downloadModel

BSYDownloadModel对象

Discussion

@method

开始下载任务

Declared In

BSYDownloadSessionManager.h

– addDownloadTask:progress:state:

开始下载任务

- (void)addDownloadTask:(BSYDownloadModel *)downloadModel progress:(BSYDownloadProgressBlock __nullable)progressBlock state:(BSYDownloadStateBlock __nullable)stateBlock

Parameters

downloadModel

BSYDownloadModel对象

progressBlock

下载进度回调

stateBlock

下载状态变动回调

Discussion

@method

所有回调均已回到主线程中

Declared In

BSYDownloadSessionManager.h

– suspendDownloadTask:

暂停下载任务

- (void)suspendDownloadTask:(BSYDownloadModel *)downloadModel

Parameters

downloadModel

BSYDownloadModel对象

Discussion

@method

暂停下载任务

Declared In

BSYDownloadSessionManager.h

– resumeDownloadTask:

恢复下载任务

- (void)resumeDownloadTask:(BSYDownloadModel *)downloadModel

Parameters

downloadModel

BSYDownloadModel对象

Discussion

@method

恢复下载任务

Declared In

BSYDownloadSessionManager.h

– deleteDownloadTask:

删除下载任务以及本地缓存

- (void)deleteDownloadTask:(BSYDownloadModel *)downloadModel

Parameters

downloadModel

BSYDownloadModel对象

Discussion

@method

删除下载任务以及本地缓存

Declared In

BSYDownloadSessionManager.h

– suspendAllDownloadTask

暂停全部任务

- (void)suspendAllDownloadTask

Discussion

@method

暂停全部任务

Declared In

BSYDownloadSessionManager.h

– deleteAllDownloadTask

删除全部任务

- (void)deleteAllDownloadTask

Discussion

@method

删除全部任务

Declared In

BSYDownloadSessionManager.h

+ createVideoDownloadModel:withResolution:

初始化BSYDownloadModel

+ (BSYDownloadModel *)createVideoDownloadModel:(BSYVodVideoModel *)videoModel withResolution:(NSString *)resolution

Parameters

videoModel

点播视频model,非空

resolution

媒体品质,非空 resolution:lud、lhd、lsd 分辨率:lud:超清,lhd:高清,lsd:标清

Return Value

创建成功返回BSYDownloadModel对象,如果失败,返回nil

Discussion

@method

初始化BSYDownloadModel

Declared In

BSYDownloadSessionManager.h

– getDownLoadVideoModelWithMediaId:

获取下载模型

- (NSArray<BSYDownloadModel*> *)getDownLoadVideoModelWithMediaId:(NSString *)mediaId

Parameters

mediaId

视频id,非空

Return Value

BSYDownloadModel对象

Discussion

@method

获取下载模型

Declared In

BSYDownloadSessionManager.h

– getDownLoadVideoModelWithMediaId:withResolution:

获取下载模型

- (BSYDownloadModel *)getDownLoadVideoModelWithMediaId:(NSString *)mediaId withResolution:(NSString *)resolution

Parameters

mediaId

视频id,非空

resolution

媒体品质,非空 resolution:lud、lhd、lsd 分辨率:lud:超清,lhd:高清,lsd:标清

Return Value

BSYDownloadModel对象

Discussion

@method

获取下载模型

Declared In

BSYDownloadSessionManager.h

– checkLocalResourceWithMediaId:withResolution:

判断当前资源是已在下载队列中

- (BOOL)checkLocalResourceWithMediaId:(NSString *)mediaId withResolution:(NSString *)resolution

Parameters

mediaId

视频id,非空

resolution

媒体品质,非空 resolution:lud、lhd、lsd 分辨率:lud:超清,lhd:高清,lsd:标清

Return Value

查询结果

Discussion

@method

判断当前资源是已在下载队列中

Declared In

BSYDownloadSessionManager.h

– setVideoToken:

设置请求视频数据Token

- (void)setVideoToken:(NSString *)token

Parameters

token

视频Token,非空

Discussion

@method

设置请求视频数据Token

Declared In

BSYDownloadSessionManager.h