tencent cloud

Video on Demand

TXVodPlayConfig

Download
Focus Mode
Font Size
Last updated: 2026-11-17 09:40:31
AI-Translated & Reviewed

TXVodPlayConfig API Introduct

on-demand player playback configuration, need to be set before playback.

TX_Enum_MP4EncryptionLevel (MP4 Encrypted Playback Level)

Value
Parameter Name
Description
0
MP4_ENCRYPTION_LEVEL_NONE
Unencrypted.
1
MP4_ENCRYPTION_LEVEL_L1
L1 (Online Encryption)
2
MP4_ENCRYPTION_LEVEL_L2
L2 (Local Encryption)

TX_Enum_PlayerType (Player Type Definition)

Value
Parameter Name
Description
0
PLAYER_AVPLAYER
system player.
1
PLAYER_THUMB_PLAYER
Based on FFmpeg, supports software decoding, with better compatibility.

TX_Enum_VideoResolution (Player Preferred Resolution)

Value
Parameter Name
Description
720 * 1280
VIDEO_RESOLUTION_720X1280
Resolution 720×1280.
1080 * 1920
VIDEO_RESOLUTION_1080X1920
Resolution 1080×1920.
1440 * 2560
VIDEO_RESOLUTION_1440X2560
Resolution 1440×2560.
2160 * 3840
VIDEO_RESOLUTION_2160X3840
Resolution 2160×3840.

TX_Enum_MediaType (Media Asset Type)

Value
Parameter Name
Description
0
MEDIA_TYPE_AUTO
AUTO type (default value, adaptive bit rate playback not supported).
1
MEDIA_TYPE_HLS_VOD
HLS VOD media.
2
MEDIA_TYPE_HLS_LIVE
HLS live media.
3
MEDIA_TYPE_FILE_VOD
Common file VOD media such as MP4.
4
MEDIA_TYPE_DASH_VOD
DASH VOD media.

TX_Enum_Video_Pixel_Format (Video Frame Output Type)

Value
Parameter Name
Description
0
TX_VIDEO_PIXEL_FORMAT_NONE
Invalid type.
1
TX_VIDEO_PIXEL_FORMAT_VideoToolbox
VIDEO TOOL BOX, direct original video format output.
2
TX_VIDEO_PIXEL_FORMAT_RGBA
RGBA format (Since Apple does not recommend using RGBA, please use BGRA format as an alternative).
3
TX_VIDEO_PIXEL_FORMAT_BGRA
BGRA format.

API Overview

API
Description
Set the player's reconnection attempts in abnormal scenarios.
Player connection retry interval, in seconds. Minimum value is 3, maximum value is 30. Default value is 3.
timeout
Set the player connection timeout period.
Video format for video rendering object callback.
Retain the last frame after playback stops, default is NO.
Data duration to load for the first buffer, in ms. The default value is 200ms.
Maximum duration of buffering (secondary buffering caused by insufficient buffered data, or seek-induced buffering), in ms. The default value is 4000ms.
Set player type.
headers
Set Http header.
Set whether to seek accurately. The default is YES.
Set whether to automatically rotate the angle when playing MP4. The default is YES.
Set whether to smoothly switch between multiple bitrates for HLS. The default is NO.
Set the interval for progress callbacks. The default is 500ms.
Set the maximum playback buffer size for the player.
Set the maximum preload buffer size.
Set encryption key.
overlayIv
Encryption Iv.
Set whether the player is allowed to load post-processing services. Default is NO.
Set the optimal HLS stream for playback.
Set MP4 encrypted playback.
mediaType
Set the media asset type for player playback.
Set player expansion parameters.
Set the preferred audio track for startup playback.
Enable/disable automatic refresh upon URL authentication expiration.
Set the pending wait time for automatic refresh upon URL authentication expiration (in milliseconds). Default is 10000ms.

API Detail

connectRetryCount

Set the player's reconnection attempts in abnormal scenarios.
When the SDK is disconnected from the server due to an exception, it will attempt to reconnect. Use this function to set the SDK's reconnection attempts, with a default value of 3.
@property(nonatomic, assign) int connectRetryCount;

connectRetryInterval

Set the player's reconnection interval duration in abnormal scenarios.
in seconds, minimum value is 3, maximum value is 30, default value is 3.
@property(nonatomic, assign) int connectRetryInterval;

timeout

Set the player connection timeout period, with a default value of 10 seconds.
@property(nonatomic, assign) NSTimeInterval timeout;

videoFrameFormatType

Set the video format for video rendering object callback. The default value is TX_VIDEO_PIXEL_FORMAT_NONE.
@property(nonatomic, assign) TX_Enum_Video_Pixel_Format videoFrameFormatType;
Parameter Description
Parameter Name
Type
Description
videoFrameFormatType
TX_Enum_Video_Pixel_Format
Video frame callback type. For details, see TX_Enum_Video_Pixel_Format.

keepLastFrameWhenStop

Whether to retain the last frame after the player stops. The default value is NO.
@property(nonatomic, assign) BOOL keepLastFrameWhenStop;

firstStartPlayBufferTime

The duration of data to be loaded for initial buffering, in ms. The default value is 200 ms.
@property(nonatomic, assign) int firstStartPlayBufferTime;
Parameter Description
Parameter Name
Type
Description
firstStartPlayBufferTime
int
Duration size.

nextStartPlayBufferTime

The minimum duration of data to be buffered before buffering ends, in ms. The default value is 4000 ms. This applies to secondary buffering caused by insufficient buffered data or buffering triggered by seeking.
@property(nonatomic, assign) int nextStartPlayBufferTime;

playerType

Set the player type. The default is Tencent Cloud's proprietary player.
@property(nonatomic, assign) NSInteger playerType;
Parameter Description
Parameter Name
Type
Description
playerType
int
Player type, valid values:
PLAYER_AVPLAYER: iOS system player.
PLAYER_THUMB_PLAYER: Tencent Cloud's proprietary player (default).

headers

Customize configuration for the player to play Http headers carried during the online process.
@property(nonatomic, strong) NSDictionary *headers;
Parameter Description
Parameter Name
Type
Description
headers
NSDictionary <NSString *, NSString *>
Custom Http header content.

enableAccurateSeek

Set whether to seek accurately. The default is true.
@property(nonatomic, assign) BOOL enableAccurateSeek;
Parameter Description
Parameter Name
Type
Description
enableAccurateSeek
BOOL
Set whether to seek accurately.

autoRotate

When playing an MP4 file, if set to YES, it will automatically rotate according to the rotation angle in the file. The rotation angle can be obtained in the VOD_PLAY_EVT_CHANGE_ROTATION event. The default value is YES.
@property(nonatomic, assign) BOOL autoRotate;
Parameter Description
Parameter Name
Type
Description
autoRotate
BOOL
Whether to automatically rotate based on the rotation angle during playback.

smoothSwitchBitrate

Set whether to smoothly switch between multiple bitrates for HLS. Default is NO.
@property(nonatomic, assign) BOOL smoothSwitchBitrate;
Parameter Description
Parameter Name
Type
Description
smoothSwitchBitrate
BOOL
Set whether to smoothly switch between multiple bitrates for HLS.

progressInterval

Set the interval for progress callbacks, in milliseconds. The default interval is 500 milliseconds.
@property(nonatomic, assign) NSTimeInterval progressInterval;
Parameter Description
Parameter Name
Type
Description
progressInterval
NSTimeInterval
Interval time, in milliseconds.

maxBufferSize

Maximum cache size, unit MB. This setting impacts playableDuration. The larger the setting, the more content is cached in advance.
@property(nonatomic, assign) float maxBufferSize;
Parameter Description
Parameter Name
Type
Description
maxBufferSize
float
Playback buffer size.

maxPreloadSize

Set the maximum preload buffer size, in MB.
@property(nonatomic, assign) float maxPreloadSize;
Parameter Description
Parameter Name
Type
Description
maxPreloadSize
float
Preload size.

overlayKey

Set encryption key.
@property(nonatomic, copy) NSString *overlayKey;

overlayIv

Set Encryption Iv.
@property(nonatomic, copy) NSString *overlayIv;

encryptedMp4Level

Set MP4 encrypted playback.
@property(nonatomic, assign) TX_Enum_MP4EncryptionLevel encryptedMp4Level;
Parameter Description
Parameter Name
Type
Description
encryptedMp4Level

TX_Enum_MP4EncryptionLevel

Set the MP4 playback and storage encryption level. This feature is supported starting from Player Premium 12.2. For details, see TX_Enum_MP4EncryptionLevel.

enableRenderProcess

Set the Render display post-processing flag, including features such as super-resolution and VR playback. Using these features requires setting this flag. The default is NO.
@property(nonatomic, assign) BOOL enableRenderProcess;
Parameter Description
Parameter Name
Type
Description
enableRenderProcess
BOOL
Whether loading post-rendering post-processing services is allowed.

preferredResolution

When an HLS stream has multiple programs, the player selects the optimal program for playback based on the configured preferredResolution. preferredResolution is the product of width and height. The valid configuration value is an integer >= -1, with a default of -1. The playback core interprets this as using lower-priority information for configuration and matches the program with the closest arithmetic distance among programs smaller than this value.
Priority is bitrateIndex > preferredBitrate > preferredResolution.
@property(nonatomic, assign) long preferredResolution;
Parameter Description
Parameter Name
Type
Description
preferredResolution
long
Product of video width and height (width × height).

mediaType

Set the media asset type. If adaptive bit rate playback is used, a specific type must be specified. For example, when using adaptive playback for HLS live streaming resources, the MEDIA_TYPE_HLS_LIVE type must be imported.
@property(nonatomic, assign) TX_Enum_MediaType mediaType;
Parameter Description
Parameter Name
Type
Description
mediaType
TX_Enum_MediaType
Media asset type. For details, see TX_Enum_MediaType.

extInfoMap

Set the player's special configuration.
@property(nonatomic, strong) NSDictionary *extInfoMap;
Parameter Description
Parameter Name
Type
Description
extInfoMap
NSDictionary
Expansion parameters

preferAudioTrack

Set the preferred audio track name to load at startup. Only the player premium supports this.
@property(nonatomic, copy) NSString *preferAudioTrack;
Parameter Description
Parameter Name
Type
Description
preferAudioTrack
NSString
audio track name

enableUrlRefresh

Whether to enable the fallback capability for automatic refresh upon URL authentication expiration.
Note:
After this feature is enabled, when dataproxy receives a 401/403 authentication failure, it no longer fails directly. Instead, it suspends the current request and throws the VOD_PLAY_EVT_URL_DENIED(2033) event, waiting for the business side to call [TXVodPlayer refreshUrlQuery:] to obtain a new URL. The default value is NO (disabled).
@property(nonatomic, assign) BOOL enableUrlRefresh;
Parameter Description
Parameter Name
Type
Description
enableUrlRefresh
BOOL
YES: Enable.
NO: Disable.

urlRefreshHangMs

The suspension duration for URL authentication refresh fallback, in milliseconds. During the suspension, if the business does not call refreshUrlQuery, the original authentication failure path is used after a timeout. The default value is 10000 ms.
@property(nonatomic, assign) int urlRefreshHangMs;
Parameter Description
Parameter Name
Type
Description
urlRefreshHangMs
int
Pending wait duration, in milliseconds. Recommended range: 3000 to 15000, default: 10000.

Help and Support

Was this page helpful?

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

Feedback