Data Structures | |
class | TXVodDownloadDataSource |
class | TXVodDownloadMediaInfo |
protocol | <TXVodDownloadDelegate> |
class | TXVodDownloadManager |
Enumerations | |
enum | TXVodQuality : NSInteger |
enum | TXDownloadError : NSInteger |
enum | TXVodDownloadMediaInfoState : NSInteger |
class TXVodDownloadDataSource |
The download source through fileid
Properties | |
TXPlayerAuthParams * | auth |
TXVodQuality | quality |
NSString * | token |
NSString * | templateName |
NSString * | fileId |
NSString * | pSign |
int | appId |
NSString * | userName |
NSString * | overlayKey |
NSString * | overlayIv |
|
readwritenonatomicassign |
The application's appId
, which is required.
|
readwritenonatomicassign |
The fileid
information.
|
readwritenonatomiccopy |
The file ID.
|
readwritenonatomiccopy |
|
readwritenonatomiccopy |
The HLS EXT-X-KEY encryption and decryption parameters.
|
readwritenonatomiccopy |
The signature information.
|
readwritenonatomicassign |
The download definition, which is the original resolution by default.
|
readwritenonatomiccopy |
The definition template. If the backend performs transcoding with a custom template, enter the template name here. If both templateName
and quality
are set, templateName
will prevail.
|
readwritenonatomiccopy |
Enter the token if the address is encrypted.
|
readwritenonatomiccopy |
The account name.
class TXVodDownloadMediaInfo |
The file object to be downloaded.
Instance Methods | |
(BOOL) | - isDownloadFinished |
Properties | |
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 |
The download object specified byfileid
, which is optional.
|
readwritenonatomicassign |
The number of downloaded segments.
|
readwritenonatomicassign |
The size of the downloaded part in bytes.
|
readwritenonatomicassign |
|
readwritenonatomicassign |
The duration.
|
readwritenonatomicassign |
The playable duration.
|
readwritenonatomiccopy |
The playback path, which can be passed in to TXVodPlayer
for playback.
|
readwritenonatomicassign |
The progress.
|
readwritenonatomicassign |
The total number of segments.
|
readwritenonatomicassign |
The total file size in bytes.
|
readwritenonatomicassign |
The download speed in B/s.
|
readwritenonatomiccopy |
The download URL.
|
readwritenonatomiccopy |
The account name.
protocol TXVodDownloadDelegate-p |
The download callback.
Instance Methods | |
(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 | |
Send the decryption key to the player for verification if the HLS file to be downloaded is encrypted.
mediaInfo | The download object |
url | The URL |
data | The server response |
- (void) onDownloadError: | (TXVodDownloadMediaInfo *) | mediaInfo | |
errorCode: | (TXDownloadError) | code | |
errorMsg: | (NSString *) | msg | |
Download error.
- (void) onDownloadFinish: | (TXVodDownloadMediaInfo *) | mediaInfo |
Download was completed.
- (void) onDownloadProgress: | (TXVodDownloadMediaInfo *) | mediaInfo |
The download progress.
- (void) onDownloadStart: | (TXVodDownloadMediaInfo *) | mediaInfo |
Download started.
- (void) onDownloadStop: | (TXVodDownloadMediaInfo *) | mediaInfo |
Download stopped.
class TXVodDownloadManager |
The download manager.
Instance Methods | |
(void) | - setDownloadPath: |
(TXVodDownloadMediaInfo *) | - startDownload: |
(TXVodDownloadMediaInfo *) | - startDownload:url: |
(void) | - stopDownload: |
(BOOL) | - deleteDownloadFile: |
(void) | - deleteDownloadMediaInfo: |
(NSArray< TXVodDownloadMediaInfo * > *) | - getDownloadMediaInfoList |
(TXVodDownloadMediaInfo *) | - getDownloadMediaInfo: |
(NSString *) | - getOverlayKeyIv:userName:fileId:qualityId: |
Class Methods | |
(TXVodDownloadManager *) | + shareInstance |
(NSString *) | + genRandomHexStringForHls |
(NSString *) | + encryptHexStringHls: |
Properties | |
id< TXVodDownloadDelegate > | delegate |
NSDictionary * | headers |
- (BOOL) deleteDownloadFile: | (NSString *) | playPath |
Delete the file generated by download.
NO
will be returned if the file is being downloaded and cannot be deleted. - (void) deleteDownloadMediaInfo: | (TXVodDownloadMediaInfo *) | downloadMediaInfo |
Delete the download information.
downloadMediaInfo | downloadMediaInfo |
+ (NSString *) encryptHexStringHls: | (NSString *) | originHexStr |
Perform encryption
originHexStr | originHexStr |
+ (NSString *) genRandomHexStringForHls |
The encryption configuration Get the random number for encryption.
- (TXVodDownloadMediaInfo *) getDownloadMediaInfo: | (TXVodDownloadMediaInfo *) | media |
Get the download information.
media | media |
- (NSArray<TXVodDownloadMediaInfo *> *) getDownloadMediaInfoList |
Get the download list. You must set the download meta before calling this API. For more information, see the setDownloadMeta
method.
- (NSString *) getOverlayKeyIv: | (int) | appId | |
userName: | (NSString *) | userName | |
fileId: | (NSString *) | fileId | |
qualityId: | (int) | qualityId | |
Get the overlayKey
and overlayIv
for HLS EXT-X-KEY encryption and decryption.
appId | appId |
userName | userName |
fileId | fileId |
qualityId | qualityId |
- (void) setDownloadPath: | (NSString *) | path |
Set the root directory for downloaded files
path | The directory path. If it doesn't exist, it will be created automatically. |
+ (TXVodDownloadManager *) shareInstance |
The global singleton API
- (TXVodDownloadMediaInfo *) startDownload: | (TXVodDownloadDataSource *) | source |
The downloaded file
source | The download source |
nil
will be returned.- (TXVodDownloadMediaInfo *) startDownload: | (NSString *) | username | |
url: | (NSString *) | url | |
Download a file
username | username |
url | url |
- (void) stopDownload: | (TXVodDownloadMediaInfo *) | media |
Stop download
media | The object for which download stopped |
|
readwritenonatomicweak |
The download task callback
|
readwritenonatomicstrong |
Set the httpHeader
enum TXDownloadError : NSInteger |
The download error code
enum TXVodDownloadMediaInfoState : NSInteger |
enum TXVodQuality : NSInteger |