tencent cloud

TXVodPlayConfig
Last updated: 2025-05-30 14:48:52
TXVodPlayConfig
Last updated: 2025-05-30 14:48:52

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 720X1280.
1080 * 1920
VIDEO_RESOLUTION_1080X1920
Resolution 1080X1920.
1440 * 2560
VIDEO_RESOLUTION_1440X2560
Resolution 1440X2560.
2160 * 3840
VIDEO_RESOLUTION_2160X3840
Resolution 2160X3840.

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
timeout
Set the player connection timeout period.
Video format for video rendering object callback.
Retain the last frame after playback stops, default is NO.
Initial buffer data duration, unit ms, default value 100ms.
Maximum buffer duration caused by insufficient buffer data or drag buffer during seek, unit ms, default value 250ms.
Set playe
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.

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

Retain the last frame after the player stops, default is NO.
@property(nonatomic, assign) BOOL keepLastFrameWhenStop;

firstStartPlayBufferTime

Initial buffer data duration, unit ms. Default value 100ms.
@property(nonatomic, assign) int firstStartPlayBufferTime;
Parameter Description
Parameter Name
Type
Description
firstStartPlayBufferTime
int
Duration size.

nextStartPlayBufferTime

Minimum buffer duration required to end buffering due to insufficient buffer data or drag buffer during seek, unit ms, default value 250ms.
@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 MP4 playback and storage encryption levels, 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 there are multiple Hls programs, select the optimal Program for startup based on the configured `preferredResolution`, which is the product of width and height. The valid value for configuration is an integer >= -1, with a default of -1. The playback kernel interprets this as using lower-priority information for configuration and will match the Program with the arithmetic distance closest to a value less than this one.
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

Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback