tencent cloud

Video on Demand

Release Notes and Announcements
Release Notes
Announcements
Product Introduction
Overview
Product Features
Features
Strengths
Scenarios
Solutions
Professional Edition
Introduction to Video On Demand Professional Edition
Quick Start
Console Guide
Development Guide
Purchase Guide
Billing Overview
Billing Modes
Purchase Guide
Viewing Bills
Renewal
Overdue Policy
Refund Policy
Getting Started
Console Guide
Console Overview
Service Overview
Application Management
Media Management
Package Management
License Management
Real-Time Log Analysis
Practical Tutorial
Media Upload
Smart Cold Storage of VOD Media Asset Files
Video Processing
Distribution and Playback
How to Receive Event Notification
How to Migrate Files from Origin Server to VOD
Live Recording
How to Pull from Custom Origin Servers
How to Use EdgeOne to Distribute Content in VOD
Development Guide
Media Upload
Media Processing
Video AI
Event Notification
Video Playback
Media Encryption and Copyright Protection
Broadcast Channel
CAM
Media File Download
Subapplication System
Error Codes
Player SDK
Overview
Basic Concepts
Features
Free Demo
Free Trial License
Purchase Guide
SDK Download
Licenses
Player Guide
Integration (UI Included)
Integration (No UI)
Advanced Features
API Documentation
Player Adapter
Player SDK Policy
Server APIs
History
Introduction
API Category
Other APIs
Media Processing APIs
Parameter Template APIs
Task Management APIs
Media Upload APIs
Media Management APIs
Event Notification Relevant API
Media Categorization APIs
Domain Name Management APIs
Distribution APIs
AI-based Sample Management APIs
Region Management APIs
Data Statistics APIs
Carousel-Related APIs
Just In Time Transcode APIs
No longer recommended APIs
Making API Requests
AI-based image processing APIs
Task Flow APIs
Data Types
Error Codes
Video on Demand API 2024-07-18
FAQs
Mobile Playback
Fees
Video Upload
Video Publishing
Video Playback
Web Playback
Full Screen Playback
Statistics
Access Management
Cold Storage
Agreements
Service Level Agreement
VOD Policy
Privacy Policy
Data Processing And Security Agreement
Contact Us
Glossary

TXVodDownloadManager

PDF
Focus Mode
Font Size
Last updated: 2025-05-30 14:55:49

TXDownloadError

Download Error Code.
Value
Parameter Name
Description
0
TXDownloadSuccess
Download success.
-5001
TXDownloadAuthFaild
File ID authentication failure.
-5003
TXDownloadNoFile
No file with this resolution.
-5004
TXDownloadFormatError
Unsupported format.
-5005
TXDownloadDisconnet
Network disconnection.
-5006
TXDownloadHlsKeyError
Failed to retrieve the HLS decryption key.
-5007
TXDownloadPathError
Download directory access failure.
-5008
TXDownload403Forbidden
Authentication information not approved, such as signature expiration or invalid request.

TXVodDownloadManager API Introduction

on-demand video player download API class
Video download supports downloading MP4 and HLS videos, corresponds to nested HLS videos, requires specifying preferred resolution (preferredResolution)

API Overview

API
Description
Retrieve the TXVodDownloadManager instance object in singleton mode.
Set the root directory for downloading files. If it does not exist, it will be automatically created.
Start the download using the URL method.
Start the download using the fileId method.
Start the download using the URL method, and specify the preferred clarity and account name.
Start the download using the Drm method.
Stop download, stopped successfully when [TXVodDownloadDelegate onDownloadStop:] callback is triggered.
Delete download information.
Delete files generated during download.
Retrieve download list information for all users, time-consuming API, do not call on the main thread.
Retrieve download information.
Retrieve download information.
Encrypt.
headers
Set the HTTP request header for downloading.
delegate
Set the download callback proxy object. It must be configured before downloading.
Set whether private encryption mode is supported (set to NO for system player, YES for custom player). By default, it is set to YES.

API Detail

shareInstance

Retrieve the TXVodDownloadManager instance object in singleton mode.
+ (TXVodDownloadManager *)shareInstance;

setDownloadPath:

Set the root directory for downloading files. The download directory set here takes precedence over the one set via [TXPlayerGlobalSetting setCacheFolderPath:].
- (void)setDownloadPath:(NSString *)path;

startDownload:

Start the download using the Tencent Cloud Video fileId method.
- (TXVodDownloadMediaInfo *)startDownload:(TXVodDownloadDataSource *)source;
Parameter Description
Parameter Name
Type
Description
source
Download a resource object.

startDownload:url:

Start the download using the URL method.
- (TXVodDownloadMediaInfo *)startDownload:(NSString *)username url:(NSString *)url;
Parameter Description
Parameter Name
Type
Description
url
NSString
Download address, required.
username
NSString
Account name, optional parameter, defaults to "default" if not provided.
Return Value
Video information and download status, see TXVodDownloadMediaInfo for details.

startDownloadUrl:resolution:userName:

Start the download using the URL method.
- (TXVodDownloadMediaInfo *)startDownloadUrl:(NSString *)url resolution:(long)resolution userName:(NSString *)username;
Parameter Description
Parameter Name
Type
Description
url
NSString
Download address, required.
resolution
long
Preference for clarity, multiple resolutions url is a required parameter, with the value being preference clarity width × height (e.g., 720p input 921600 = 1280 × 720), single clarity input -1.
username
NSString
Account name, optional parameter, defaults to "default" if not provided.
Return Value
Video information and download status, see TXVodDownloadMediaInfo for details.

startDownloadDrm:resolution:userName:

Download a DRM video.
- (TXVodDownloadMediaInfo *)startDownloadDrm:(TXPlayerDrmBuilder *)drmBuilder resolution:(long)resolution userName:(NSString *)username;
Parameter Description
Parameter Name
Type
Description
drmBuilder
TXPlayerDrmBuilder
Download DRM object, refer to TXPlayerDrmBuilder.
resolution
long
Preference clarity, multiple resolutions URL is a required parameter, with the value being preference clarity width * height (e.g., 720p input 921600 = 1280 * 720), single clarity input -1.
username
NSString
Account name, optional parameter, defaults to "default" if not provided.
Return Value
Video information and download status, see TXVodDownloadMediaInfo for details.

stopDownload:

Stop download, stopped successfully when -[id<TXVodDownloadDelegate> onDownloadStop:] callback is triggered.
- (void)stopDownload:(TXVodDownloadMediaInfo *)media;
Parameter Description
Parameter Name
Type
Description
downloadMediaInfo
Download video information.

deleteDownloadMediaInfo:

Delete download information.
- (BOOL)deleteDownloadMediaInfo:(TXVodDownloadMediaInfo *)downloadMediaInfo;
Parameter Description
Parameter Name
Type
Description
downloadMediaInfo
Download video information.
Return Value
Whether the deletion is successful. YES: Successfully deleted; NO: Deletion failed. Files being downloaded cannot be deleted.

getDownloadMediaInfoList

Retrieve download list information for all users.
- (NSArray<TXVodDownloadMediaInfo *> *)getDownloadMediaInfoList;
Return Value
Video download information list: NSArray<TXVodDownloadMediaInfo>.

getDownloadMediaInfo:fileId:qualityId:userName:

Retrieve download information.
Call this API to ensure that a download task has been created earlier via startDownload:, startDownload:url:, or startDownloadDrm:resolution:userName:.
- (TXVodDownloadMediaInfo *)getDownloadMediaInfo:(int)appId fileId:(NSString *)fileId qualityId:(int)qualityId userName:(NSString *)userName;
Parameter Description
Parameter Name
Type
Description
appId
int
Tencent Cloud Video on Demand (VOD) application appId.
fileId
NSString
Tencent Cloud Video on Demand (VOD) video fileId.
qualityId
int
Video quality Id, refer to the constant TXVodQuality.
userName
NSString
Account name must be consistent with the account name passed in during download. If not passed in during download, pass in the empty character "".
Return Value
Video download information TXVodDownloadMediaInfo.

getDownloadMediaInfo:resolution:userName:

Retrieve download information.
- (TXVodDownloadMediaInfo *)getDownloadMediaInfo:(NSString *)url resolution:(long)preferredResolution userName:(NSString *)userName;
Parameter Description
Parameter Name
Type
Description
url
NSString
Download address, required parameter, otherwise download fails.
preferredResolution
long
Download preferred clarity, multiple resolutions URL is a required parameter, with the value being preferred clarity width × height (e.g., 720p input 921600 = 1280 × 720), single clarity input -1.
userName
userName
Account name, optional parameter, defaults to "default" if not provided.
Return Value
Video download information TXVodDownloadMediaInfo.

encryptHexStringHls:

Encrypt.

+ (NSString *)encryptHexStringHls:(NSString *)originHexStr
Parameter Name
Type
Description
originHexStr
NSString
Initial hexadecimal string.
Return Value
Encrypted string: NSString

headers

Set the http request header.

@property(nonatomic, strong) NSDictionary *headers;
Parameter Name
Type
Description
headers
NSDictionary
http request header.

delegate

Set the download task callback object.

@property(nonatomic, weak) id<TXVodDownloadDelegate> delegate;
Parameter Name
Type
Description
delegate
Download task callback object.

supportPrivateEncryptMode

Set whether private encryption mode is supported (set to NO for system player, YES for custom player). Default is YES.

@property(nonatomic, assign) BOOL supportPrivateEncryptMode;
Parameter Name
Type
Description
supportPrivateEncryptMode
BOOL
Whether private encryption mode is supported.


Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback