Parameter Name | Type | Value | Description |
TXVodDownloadManager#DOWNLOAD_SUCCESS | int | 0 | Download success. |
TXVodDownloadManager#DOWNLOAD_AUTH_FAILED | int | -5001 | File ID download authentication failure. |
TXVodDownloadManager#DOWNLOAD_NO_FILE | int | -5003 | File does not exist for download. |
TXVodDownloadManager#DOWNLOAD_FORMAT_ERROR | int | -5004 | Unsupported download format. |
TXVodDownloadManager#DOWNLOAD_DISCONNECT | int | -5005 | Network error. |
TXVodDownloadManager#DOWNLOAD_HLS_KEY_ERROR | int | -5006 | Failed to retrieve HLS decryption Key. |
TXVodDownloadManager#DOWNLOAD_PATH_ERROR | int | -5007 | Download directory access failure. |
TXVodDownloadManager#DOWNLOAD_403FORBIDDEN | int | -5008 | Signature expired or invalid request. |
API | Description |
Retrieve the TXVodDownloadManager instance object in singleton mode. | |
Set the HTTP request header for downloading. | |
Set the download callback method, which must be configured before downloading. | |
Start the download using the URL method. | |
Start the download using the fileId method. | |
Start the download using the Drm method. | |
Stop downloading, stopped successfully when ITXVodDownloadListener.onDownloadStop callback is triggered. | |
Delete download information. | |
Retrieve download list information for all users, time-consuming API, do not call on the main thread. | |
Retrieve download information, time-consuming API, do not call on the main thread. | |
Retrieve download information, time-consuming API, do not call on the main thread. |
public static TXVodDownloadManager getInstance()
public void setHeaders(Map<String, String> headers)
public void setListener(ITXVodDownloadListener listener)
Parameter Name | Type | Description |
listener | Download listening status callback. |
TXPlayerGlobalSetting#setCacheFolderPath.public TXVodDownloadMediaInfo startDownloadUrl(String url, long preferredResolution, String userName)
Parameter Name | Type | Description |
url | String | Download address, mandatory parameter; otherwise, the download will fail. |
preferredResolution | long | Download preference resolution, multiple resolution URLs are mandatory parameters, with values being the width * height of the preferred resolution (e.g., for 720p, input 921600 = 1280*720), and -1 for single resolution. |
userName | String | Account name, optional parameter; defaults to "default" if not provided. |
public TXVodDownloadMediaInfo startDownloadUrl(String url, String userName)
public TXVodDownloadMediaInfo startDownloadUrl(String url)
public TXVodDownloadMediaInfo startDownload(final TXVodDownloadDataSource dataSource)
Parameter Name | Type | Description |
dataSource | Download a resource object. |
public TXVodDownloadMediaInfo startDownloadDrm(final TXPlayerDrmBuilder drmBuilder, long preferredResolution, String userName)
Parameter Name | Type | Description |
drmBuilder | Construct a Drm resource. | |
preferredResolution | long | Download preference resolution. Multiple resolution URLs are required parameters, with values being the width * height of the preferred resolution (e.g., for 720p, input 921600 = 1280*720). For single resolution, input -1. |
userName | String | Account name, optional parameter; defaults to "default" if not provided. |
public void stopDownload(TXVodDownloadMediaInfo downloadMediaInfo)
Parameter Name | Type | Description |
downloadMediaInfo | Video download information. |
public boolean deleteDownloadFile(String playPath)
Parameter Name | Type | Description |
playPath | String | File path. |
public boolean deleteDownloadMediaInfo(TXVodDownloadMediaInfo downloadMediaInfo)
Parameter Name | Type | Description |
downloadMediaInfo | Video download information. |
public List<TXVodDownloadMediaInfo> getDownloadMediaInfoList()
TXVodDownloadDataSource(int, String, int, String, String) beforehand.TXVodDownloadMediaInfo#getDataSource and TXVodDownloadDataSource#getUserName.public TXVodDownloadMediaInfo getDownloadMediaInfo(int appId, String fileId, int qualityId, String userName)
Parameter Name | Type | Description |
appId | int | Tencent Cloud Video on Demand (VOD) application appId. |
fileId | String | Tencent Cloud Video on Demand (VOD) video fileId. |
qualityId | int | Video QUALITY Id, refer to the constant TXVodDownloadDataSource#QUALITY_240P. |
userName | String | Account name, must match the account name passed in during download. If not passed in during download, pass in an empty string "" here. |
public TXVodDownloadMediaInfo getDownloadMediaInfo(String url, long preferredResolution, String userName)
Parameter Name | Type | Description |
url | String | Download address, mandatory parameter; otherwise, the download will fail. |
preferredResolution | long | Download preference resolution. Multiple resolution URLs are required parameters, with values being the width * height of the preferred resolution (e.g., for 720p, input 921600 = 1280*720). For single resolution, input -1. |
userName | String | Account name, optional parameter; defaults to "default" if not provided. |
public TXVodDownloadMediaInfo getDownloadMediaInfo(String url)
public TXVodDownloadMediaInfo getDownloadMediaInfo(int appId, String fileId, int qualityId)
Feedback