PLVVodDownloadManager Class Reference
Inherits from | NSObject |
---|---|
Declared in | PLVVodDownloadManager.h |
downloadDir
下载目录,默认为 Library/Caches/PolyvVodCache。修改下载目录后,上一个目录的离线视频将无法索引。
@property (nonatomic, copy) NSString *downloadDir
Declared In
PLVVodDownloadManager.h
allowsCellularAccess
是否允许使用蜂窝移动网络进行下载,默认 YES
@property (nonatomic, assign) BOOL allowsCellularAccess
Declared In
PLVVodDownloadManager.h
enableBackgroundDownload
是否启用后台下载,默认 YES
@property (nonatomic, assign) BOOL enableBackgroundDownload
Declared In
PLVVodDownloadManager.h
autoStart
添加任务后是否自动启动,默认 NO
@property (nonatomic, assign) BOOL autoStart
Declared In
PLVVodDownloadManager.h
backgroundCompletionHandler
保存的后台下载会话block
@property (nonatomic, copy) void ( ^ ) ( void ) backgroundCompletionHandler
Declared In
PLVVodDownloadManager.h
completeBlock
完成所有下载回调
@property (nonatomic, copy) void ( ^ ) ( void ) completeBlock
Declared In
PLVVodDownloadManager.h
downloadErrorHandler
下载错误回调
@property (nonatomic, copy) void ( ^ ) ( PLVVodVideo *video , NSError *error ) downloadErrorHandler
Declared In
PLVVodDownloadManager.h
+ sharedManager
PLVVodDownloadManager 共享的静态对象
+ (instancetype)sharedManager
Return Value
PLVVodDownloadManager 共享的静态对象
Declared In
PLVVodDownloadManager.h
– setDownloadDir:skipBackup:error:
设置下载目录
- (BOOL)setDownloadDir:(NSString *)downloadDir skipBackup:(BOOL)skipBackup error:(NSError **)error
Parameters
downloadDir |
设置的下载目录 |
---|---|
skipBackup |
是否忽略 iCloud 的备份 |
error |
错误回调 |
Return Value
是否成功
Declared In
PLVVodDownloadManager.h
– downloadVideo:quality:
添加至下载队列
- (PLVVodDownloadInfo *)downloadVideo:(PLVVodVideo *)video quality:(PLVVodQuality)quality
Parameters
video |
PLVVodVideo 视频对象 |
---|---|
quality |
视频画质 |
Return Value
下载信息
Discussion
添加下载器,仅当 video 错误时,才会报错,quality 错误时,只会警告,并切换到最近的质量进行下载。
Declared In
PLVVodDownloadManager.h
– downloadVideo:
使用后台设置的默认画质添加至下载队列
- (PLVVodDownloadInfo *)downloadVideo:(PLVVodVideo *)video
Parameters
video |
PLVVodVideo 视频对象 |
---|
Return Value
下载信息
Declared In
PLVVodDownloadManager.h
– removeDownloadWithVid:error:
移除下载任务,并删除对应文件
- (void)removeDownloadWithVid:(NSString *)vid error:(NSError **)error
Parameters
vid |
vid |
---|---|
error |
错误回调 |
Declared In
PLVVodDownloadManager.h
– requestDownloadInfosWithCompletion:
获取所有下载任务信息
- (void)requestDownloadInfosWithCompletion:(void ( ^ ) ( NSArray<PLVVodDownloadInfo*> *downloadInfos ))completion
Parameters
completion |
完成回调 |
---|
Declared In
PLVVodDownloadManager.h
+ removeVideoWithVid:error:
删除指定视频
+ (void)removeVideoWithVid:(NSString *)vid error:(NSError **)error
Parameters
vid |
vid |
---|---|
error |
错误回调 |
Discussion
删除视频,会删除包含 vid 的所有离线资源(与下载任务无关)。
Declared In
PLVVodDownloadManager.h
+ removeAllVideoWithError:
删除下载目录下所有资源
+ (void)removeAllVideoWithError:(NSError **)error
Parameters
error |
错误回调 |
---|
Discussion
删除下载目录下所有离线资源(与下载任务无关)。
Declared In
PLVVodDownloadManager.h
– localVideos
获取已下载的本地视频
- (NSArray<PLVVodLocalVideo*> *)localVideos
Return Value
一组 PLVVodLocalVideo 对象
Declared In
PLVVodDownloadManager.h
+ videoExist:
判断指定视频是否存在本地
+ (PLVVodQuality)videoExist:(NSString *)vid
Parameters
vid |
vid |
---|
Return Value
指定视频的画质
Discussion
指定 vid 视频是否已下载,返回指定 vid 的清晰度,返回 0 则不存在该视频。
Declared In
PLVVodDownloadManager.h