tencent cloud

마지막 업데이트 시간:2025-06-23 11:43:05
Flutter
마지막 업데이트 시간: 2025-06-23 11:43:05

SuperPlayerPlugin Class

setGlobalLicense

Description
This API is used to set the license.
After you apply for and get a license, you can use the following API to initialize it. We recommend you call this API during application start. Video playback will fail if the license is not set.
API
static Future<void> setGlobalLicense(String licenceUrl, String licenceKey) async;
Parameter description
Parameter
Type
Description
licenceUrl
String
The license URL
licenceKey
String
The license key
Return values
Unlimited

createVodPlayer

Description
This API is used to create a VOD player instance at the native layer. If you use TXVodPlayerController, as it already integrates an instance, you don't need to create another.
API
static Future<int?> createVodPlayer() async;
Parameter description
Unlimited
Return values
Returned Value
Type
Description
playerId
int
The player ID

createLivePlayer

Description
This API is used to create a live player instance at the native layer. If you use TXVodPlayerController, as it already integrates an instance, you don't need to create another.
API
static Future<int?> createLivePlayer() async;
Parameter description
Unlimited
Return values
Returned Value
Type
Description
playerId
int
The player ID

setConsoleEnabled

Description
This API is used to enable/disable player native log output.
API
static Future<int?> setConsoleEnabled() async;
Parameter description
Parameter
Type
Description
enabled
bool
Enables/Disables player log
Return values
Unlimited

releasePlayer

Description
This API is used to release the player resources.
API
static Future<int?> releasePlayer(int? playerId) async;
Parameter description
Unlimited
Return values
Unlimited

setGlobalMaxCacheSize

Description
This API is used to set the maximum cache size of the player engine. After setting, the backend will clear files in the cache directory automatically according to the set value.
API
static Future<void> setGlobalMaxCacheSize(int size) async;
Parameter description
Parameter
Type
Description
size
int
The maximum cache size in MB
Return values
Unlimited

setGlobalCacheFolderPath

Description
This API is used to set the cache path, which is set to the application's sandbox directory by default. You only need to pass in the relative cache directory instead of the entire absolute path to the parameter.
API
static Future<bool> setGlobalCacheFolderPath(String postfixPath) async;
Parameter description
Parameter
Type
Description
postfixPath
String
The cache path, which is set to the application's sandbox directory by default. You only need to pass in the relative cache directory instead of the entire absolute path to postfixPath.
On Android, videos will be cached to the Android/data/your-pkg-name/files/testCache directory on the SD card.
On iOS, videos will be cached to the Documents/testCache directory in the sandbox.
Return values
Unlimited

setLogLevel

Description
This API is used to set the log output level.
API
static Future<void> setLogLevel(int logLevel) async;
Parameter description
Parameter
Type
Description
logLevel
int
0: Logs at all levels;
1: DEBUG, INFO, WARNING, ERROR, and FATAL logs;
2: INFO, WARNING, ERROR, and FATAL logs;
3: WARNING, ERROR, and FATAL logs;
4: ERROR and FATAL logs;
5: Only FATAL logs;
6: No SDK logs.
Return values
Unlimited

setBrightness

Description
This API is used to set the brightness. It is applicable only to the current application.
API
static Future<void> setBrightness(double brightness) async;
Parameter description
Parameter
Type
Description
brightness
double
The brightness level. Value range: 0.0–1.0
Return values
Unlimited

restorePageBrightness

Description
This API is used to reset the UI brightness. It is applicable only to the current application.
API
static Future<void> restorePageBrightness() async;
Parameter description
Unlimited
Return values
Unlimited

getBrightness

Description
This API is used to get the brightness level of the current UI.
API
static Future<double> getBrightness() async;
Parameter description
Unlimited
Return values
Parameter
Type
Description
brightness
double
The brightness level. Value range: 0.0–1.0

setSystemVolume

Description
This API is used to set the volume level of the current system.
API
static Future<void> setSystemVolume(double volume) async;
Parameter description
Parameter
Type
Description
volume
double
The volume level. Value range: 0.0–1.0
Return values
Unlimited

getSystemVolume

Description
This API is used to set the volume level of the current system.
API
static Future<double> getSystemVolume() async;
Parameter description
Unlimited
Returned value description
Parameter
Type
Description
volume
double
The volume level. Value range: 0.0–1.0

abandonAudioFocus

Description
This API is used to release the audio focus. It is applicable only to Android.
API
static Future<double> abandonAudioFocus() async;
Parameter description
Unlimited
Return values
Unlimited

requestAudioFocus

Description
This API is used to request the audio focus. It is applicable only to Android.
API
static Future<void> requestAudioFocus() async ;
Parameter description
Unlimited
Return values
Unlimited

isDeviceSupportPip

Description
This API is used to check whether the current device supports the picture-in-picture (PiP) mode.
API
static Future<int> isDeviceSupportPip() async;
Parameter description
Unlimited
Returned value description
Parameter
Type
Description
isDeviceSupportPip
int
0: The PiP mode can be enabled;
-101: The Android version is too early;
-102: The PiP permission is disabled or the device doesn't support PiP;
-103: The current UI has been terminated.

getLiteAVSDKVersion

Description
This API is used to get the version number of the current native-layer player SDK.
API
static Future<String?> getLiteAVSDKVersion() async;
Parameter description
Unlimited
Returned value description
Parameter
Type
Description
sdkVersion
String
The version of the current player SDK.

startVideoOrientationService

Description
Start monitoring the device's rotation direction. Once enabled, if the device's auto-rotate feature is turned on, the player will automatically rotate the video direction based on the current device orientation. This interface currently only applies to the Android platform. The iOS platform will automatically enable this feature.
Note
Before calling this interface, please be sure to inform the user of the privacy risks.
API
static Future<bool> startVideoOrientationService() async
Parameter description
Unlimited
Returned value description
Parameter
Type
Description
result
bool
true means the feature was successfully enabled, while false means it failed to enable. Possible reasons for failure include premature activation before the context is initialized or failure to obtain the sensor.

registerSysBrightness

Description
Enable or disable the monitoring of system brightness. If enabled, when the system brightness changes, it will change the current window brightness and callback the brightness to the Flutter layer. This interface needs to be used in conjunction with setBrightness and onExtraEventBroadcast.
API
static Future<void>registerSysBrightness(bool isRegister) async
Parameter description
Parameter
Type
Description
isRegister
bool
true:Turn on listening.
false:Turns off monitoring.
Returned value description
Unlimited

setUserId

Description
Set the userId, generally used for console data tracking.
API
static Future<void> setUserId(String userId) async
Parameter description
Parameter
Type
Description
userId
String
userId
Returned value description
Unlimited

setSDKListener

Description
Set up SDK monitoring, currently supports callback listening for license status settings.
API
void setSDKListener({FTXLicenceLoadedListener? licenceLoadedListener})
Parameter description
Parameter
Type
Description
licenceLoadedListener
FTXLicenceLoadedListener
The parameters include result and reason. A result of 0 indicates that the license verification was successful, while the result contains the verification message.
Returned value description
Unlimited

setLicenseFlexibleValid

Description
Enable flexible license verification for the player. Once enabled, the first two playback verifications will be automatically passed after the player is launched for the first time.
API
static Future<void> setLicenseFlexibleValid(bool enabled) async
Parameter description
Parameter
Type
Description
enabled
bool
Whether to enable flexible verification.
Returned value description
Unlimited

setDrmProvisionEnv

Description
Configure the DRM certificate environment.
API
static Future<void> setDrmProvisionEnv(TXDrmProvisionEnv env) async
Parameter description
Parameter
Type
Description
env
TXDrmProvisionEnv
DRM_PROVISION_ENV_COM: COM domain certificate provider.
DRM_PROVISION_ENV_CN: CN domain certificate provider.
Returned value description
Unlimited


TXVodPlayerController Class

initialize

Description
This API is used to initialize the controller and request assignment of shared textures.
Note:
Versions 12.3.1 and later no longer require this call.
API
Future<void> initialize({bool? onlyAudio}) async;
Parameter description
Parameter
Type
Description
onlyAudio
bool
Whether the player is an audio-only player. This parameter is optional.
Returned value description
Unlimited

startVodPlay

Note
Starting from v10.7, startPlay is replaced by startVodPlay, and playback will succeed only after you use {@link SuperPlayerPlugin#setGlobalLicense} to set the license; otherwise, playback will fail (black screen occurs). The license needs to be set only once globally. You can use the license for CSS, UGSV, or video playback. If you have no such licenses, you can quickly apply for a trial license or purchase an official license.
Description
This API is used to play back a video via URL.
API
Future<bool> startVodPlay(String url) async;
Parameter description
Parameter
Type
Description
url
String
The URL of the video to be played back.
Returned value description
Parameter
Type
Description
result
bool
Whether creation succeeded.

startVodPlayWithParams

Note
Starting from v10.7, startPlay is replaced by startVodPlay, and playback will succeed only after you use {@link SuperPlayerPlugin#setGlobalLicense} to set the license; otherwise, playback will fail (black screen occurs). The license needs to be set only once globally. You can use the license for CSS, UGSV, or video playback. If you have no such licenses, you can quickly apply for a trial license or purchase an official license.
Description
This API is used to play back a video via fileId.
API
Future<void> startVodPlayWithParams(TXPlayInfoParams params) async;
Parameter description
Parameter
Type
Description
appId
int
The application's appId, which is required.
fileId
String
The file ID, which is required.
sign
String
The hotlink protection signature. For more information, see Overview.
url
String
Video url, either this field or fileId can be filled.
Returned value description
Unlimited

pause

Description
This API is used to pause a video during playback.
API
Future<void> pause() async;
Parameter description
Unlimited
Returned value description
Unlimited

resume

Description
This API is used to resume the playback of a paused video.
API
Future<void> resume() async;
Parameter description
Unlimited
Returned value description
Unlimited

stop

Description
This API is used to stop a video during played back.
API
Future<bool> stop({bool isNeedClear = false}) async;
Parameter description
Parameter
Type
Description
isNeedClear
bool
Whether to clear the last-frame image.
Returned value description
Parameter
Type
Description
result
bool
Whether stop succeeded.

setIsAutoPlay

Description
This API is used to set whether to automatically play back the video after calling startVodPlay to load the video URL.
API
Future<void> setIsAutoPlay({bool? isAutoPlay}) async;
Parameter description
Parameter
Type
Description
isAutoPlay
bool
Whether to play back the video automatically.
Returned value description
Unlimited

isPlaying

Description
This API is used to query whether the player is currently playing a video.
API
Future<bool> isPlaying() async;
Parameter description
Unlimited
Returned value description
Parameter
Type
Description
isPlaying
bool
Whether playback is ongoing.

setMute

Description
This API is used to set whether to mute the current playback.
API
Future<void> setMute(bool mute) async;
Parameter description
Parameter
Type
Description
mute
bool
Whether to mute the playback.
Returned value description
Unlimited

setLoop

Description
This API is used to specify whether to loop the video after the video playback ends.
API
Future<void> setLoop(bool loop) async;
Parameter description
Parameter
Type
Description
loop
bool
Whether to loop the video.
Returned value description
Unlimited

seek

Description
This API is used to adjust the playback progress to the specified time.
API
_controller.seek(progress);
Parameter description
Parameter
Type
Description
progress
double
Target playback time in seconds.
Returned value description
Unlimited

setRate

Description
This API is used to set the playback rate.
API
Future<void> setRate(double rate) async;
Parameter description
Parameter
Type
Description
rate
double
Video playback rate. Default value: 1.0
Returned value description
Unlimited

getSupportedBitrates

Description
This API is used to get the bitrates supported by the video being played back.
API
Future<List?> getSupportedBitrates() async;
Parameter description
Unlimited
Returned value description
Returned Value
Type
Description
index
int
Bitrate number
width
int
The video width for the bitrate
height
int
Video height for the bitrate
bitrate
int
Bitrate value

getBitrateIndex

Description
This API is used to get the set bitrate number.
API
Future<int> getBitrateIndex() async;
Parameter description
Unlimited
Returned value description
Returned Value
Type
Description
index
int
Bitrate number

setBitrateIndex

Description
This API is used to set the current bitrate by bitrate number.
API
Future<void> setBitrateIndex(int index) async;
Parameter description
Returned Value
Type
Description
index
int
The bitrate number. -1 indicates to enable adaptive bitrate streaming.
Returned value description
Unlimited

setStartTime

Description
This API is used to specify the playback start time.
API
Future<void> setStartTime(double startTime) async;
Parameter description
Returned Value
Type
Description
startTime
double
The playback start time in seconds.
Returned value description
Unlimited

setAudioPlayoutVolume

Description
This API is used to set the video volume level.
API
Future<void> setAudioPlayoutVolume(int volume) async;
Parameter description
Parameter
Type
Description
volume
int
Video volume level. Value range: 0–100
Returned value description
Unlimited

setRequestAudioFocus

Description
This API is used to set the audio focus. It is applicable only to Android.
API
Future<bool> setRequestAudioFocus(bool focus) async;
Parameter description
Parameter
Type
Description
focus
bool
Whether to set the audio focus.
Returned value description
Parameter
Type
Description
result
bool
Whether the focus is set successfully.

setConfig

Description
This API is used to configure the player.
API
Future<void> setConfig(FTXVodPlayConfig config) async ;
Parameter description
Parameter
Type
Description
config
FTXVodPlayConfig
For more information, see the FTXVodPlayConfig class.
Returned value description
Unlimited

getCurrentPlaybackTime

Description
This API is used to get the current playback time in seconds.
API
Future<double> getCurrentPlaybackTime() async;
Parameter description
Unlimited
Returned value description
Parameter
Type
Description
playbackTime
double
The current playback time in seconds.

getBufferDuration

Description
This API is used to get the currently buffered video duration in seconds.
API
Future<double> getBufferDuration();
Parameter description
Unlimited
Returned value description
Parameter
Type
Description
playbackTime
double
The currently buffered video duration in seconds.

getPlayableDuration

Description
This API is used to get the playable duration of the video being played back in seconds.
API
Future<double> getPlayableDuration() async;
Parameter description
Unlimited
Returned value description
Parameter
Type
Description
playableDuration
double
The currently playable video duration in seconds.

getWidth

Description
This API is used to get the width of the video being played back.
API
Future<int> getWidth() async;
Parameter description
Unlimited
Returned value description
Parameter
Type
Description
width
int
The current video width

getHeight

Description
This API is used to get the height of the video being played back.
API
Future<int> getHeight() async;
Parameter description
Unlimited
Returned value description
Parameter
Type
Description
height
int
The current video height.

setToken

Description
This API is used to set the token for HLS encryption. After the token is set, the player will automatically add voddrm.token before the filename in the URL.
API
Future<void> setToken(String? token) async;
Parameter description
Parameter
Type
Description
token
String
The token for video playback.
Returned value description
Unlimited

isLoop

Description
This API is used to get the current playback loop status of the player.
API
Future<bool> isLoop() async;
Parameter description
Unlimited
Returned value description
Parameter
Type
Description
isLoop
bool
Whether the player is in loop status.

enableHardwareDecode

Description
This API is used to enable/disable playback based on hardware decoding. After the value is set, it will not take effect until the video playback is restarted.
API
Future<bool> enableHardwareDecode(bool enable);
Parameter description
Parameter
Type
Description
enable
bool
Whether to enable hardware decoding.
Returned value description
Parameter
Type
Description
result
bool
The hardware/software decoding setting result.

dispose

Description
This API is used to terminate the controller. After it is called, all notification events will be terminated, and the player will be released.
API
Future<void> dispose() async;
Parameter description
Unlimited
Returned value description
Unlimited

getDuration

Description
This API is used to get the total video duration.
API
Future<double> getDuration() async;
Parameter description
Unlimited
Returned value description
Parameter
Type
Description
duration
double
The total video duration in seconds.

enterPictureInPictureMode

Description
This API is used to enter the PiP mode.
API
Future<int> enterPictureInPictureMode({String? backIconForAndroid, String? playIconForAndroid, String? pauseIconForAndroid, String? forwardIconForAndroid}) async;
Parameter description
The parameters are applicable only to Android.
Parameter
Type
Description
backIcon
String
The seek backward icon, which can be up to 1 MB in size as limited by Android. It is optional, and if it is not set, the system icon will be used.
playIcon
String
The playback icon, which can be up to 1 MB in size as limited by Android. It is optional, and if it is not set, the system icon will be used.
pauseIcon
String
The pause icon, which can be up to 1 MB in size as limited by Android. It is optional, and if it is not set, the system icon will be used.
forwardIcon
String
The fast forward icon, which can be up to 1 MB in size as limited by Android. It is optional, and if it is not set, the system icon will be used.
Returned value description
Parameter
Code
Description
NO_ERROR
0
Started successfully with no errors.
ERROR_PIP_LOWER_VERSION
-101
The Android version is too early and doesn't support the PiP mode.
ERROR_PIP_DENIED_PERMISSION
-102
The PiP mode permission wasn't enabled, or the current device doesn't support PiP.
ERROR_PIP_ACTIVITY_DESTROYED
-103
The current UI was terminated.
ERROR_IOS_PIP_DEVICE_NOT_SUPPORT
-104
The device model or system version doesn't support PiP (only supported on iPadOS 9+ and iOS 14+). This error is applicable only to iOS.
ERROR_IOS_PIP_PLAYER_NOT_SUPPORT
-105
The player doesn't support PiP. This error is applicable only to iOS.
ERROR_IOS_PIP_VIDEO_NOT_SUPPORT
-106
The video doesn't support PiP. This error is applicable only to iOS.
ERROR_IOS_PIP_IS_NOT_POSSIBLE
-107
The PiP controller was unavailable. This error is applicable only to iOS.
ERROR_IOS_PIP_FROM_SYSTEM
-108
The PiP controller reported an error. This error is applicable only to iOS.
ERROR_IOS_PIP_PLAYER_NOT_EXIST
-109
The player object doesn’t exist. This error is applicable only to iOS.
ERROR_IOS_PIP_IS_RUNNING
-110
The PiP feature was running. This error is applicable only to iOS.
ERROR_IOS_PIP_NOT_RUNNING
-111
The PiP feature didn't start. This error is applicable only to iOS.
ERROR_IOS_PIP_START_TIME_OUT
-112
PIP launch timeout, applicable only to iOS.
ERROR_PIP_AUTH_DENIED
-201
Insufficient permissions, currently only occurs in live streaming Picture-in-Picture, applicable to iOS.
ERROR_PIP_CAN_NOT_ENTER
-120
PIP error, currently cannot enter PIP mode.

initImageSprite

Description
Initialize video sprite image
API
Future<void> initImageSprite(String? vvtUrl, List<String>? imageUrls) async;
Parameter description
Parameter
Type
Description
vvtUrl
String
Sprite Image web VTT description file download URL.
imageUrls
List<String>
Sprite image download URL.
Returned value description
Unlimited

getImageSprite

Description
Get the loaded sprite Image.
API
Future<Uint8List?> getImageSprite(double time) async;
Parameter description
Parameter
Type
Description
time
double
Time point, in seconds.
Returned value description
Parameter
Type
Description
thumb
Uint8List
Sprite Image

exitPictureInPictureMode

Description
Exit picture-in-picture mode if the player is currently in picture-in-picture mode.
API
Future<void> exitPictureInPictureMode() async;
Parameter description
Unlimited
Returned value description
Unlimited

addSubtitleSource

Description
Add external subtitles.
Note: This feature requires Player Premium version 11.7 to be supported.
API
Future<void> addSubtitleSource(String url, String name, {String? mimeType}) async;
Parameter description
Parameter
Type
Description
url
String
subtitle url
name
String
subtitle name
mimeType
String
Subtitle type, supports SRT (TXVodPlayEvent.VOD_PLAY_MIMETYPE_TEXT_SRT) and VVT (TXVodPlayEvent.VOD_PLAY_MIMETYPE_TEXT_VTT) formats

getSubtitleTrackInfo

Description
Returns the subtitle track information list.
Note: This feature requires Player Premium version 11.7 to be supported.
API
Future<List<TXTrackInfo>> getSubtitleTrackInfo() async;
Parameter description
TXTrackInfo class:
Parameter
Type
Description
trackType
int
Track type. The values are:<br />
Video track: TX_VOD_MEDIA_TRACK_TYPE_VIDEO = 1
Audio track: TX_VOD_MEDIA_TRACK_TYPE_AUDIO = 2
Subtitle track: TX_VOD_MEDIA_TRACK_TYPE_SUBTITLE = 3
trackIndex
int
track index
name
String
track name
isSelected
bool
Whether the current track is selected
isExclusive
bool
If it is true, only one track of this type can be selected at each time. If it is false, multiple tracks of this type can be selected at the same time.
isInternal
bool
Whether the current track is an internal original track.

getAudioTrackInfo

Description
Returns the subtitle track information list.
Note: This feature requires Player Premium version 11.7 to be supported.
API
Future<List<TXTrackInfo>> getAudioTrackInfo() async;
Parameter description
Reference TXTrackInfo class

selectTrack

Description
Select track.
Note: This feature requires Player Premium version 11.7 to be supported.
API
Future<void> selectTrack(int trackIndex) async;
Parameter description
Parameter
Type
Description
trackIndex
int
Track index, trackIndex track index, obtained through the trackIndex of [TXTrackInfo].

deselectTrack

Description
Deselect the track.
Note: This feature requires Player Premium version 11.7 to be supported.
API
Future<void> deselectTrack(int trackIndex) async;
Parameter description
Parameter
Type
Description
trackIndex
int
Track index, trackIndex track index, obtained through the trackIndex of [TXTrackInfo].

setStringOption

Description
Set extended parameters.
API
Future<void> setStringOption(String key, Object value) async
Parameter description
Parameter
Type
Description
key
String
Extended parameter key-value pairs.
value
Object
Extended parameter values.

setPlayerView

Description
Bind Video Rendering Texture.
API
Future<void>setPlayerView(int renderViewId) async
Parameter description
Parameter
Type
Description
renderViewId
int
The viewId returned by the onRenderViewCreatedListener callback of TXPlayerVideo.

setRenderMode

Description
Set the screen tiling mode.
API
Future<void> setRenderMode(FTXPlayerRenderMode renderMode) async
Parameter description
Parameter
Type
Description
renderMode
FTXPlayerRenderMode
Set the screen tiling mode: one is FTXPlayerRenderMode.ADJUST_RESOLUTION that prioritizes displaying the complete video frame while maintaining the aspect ratio, and the other is FTXPlayerRenderMode.FULL_FILL_CONTAINER that fills the container while preserving the aspect ratio.

reDraw

Description
Force a screen redraw, Android only.
API
Future<void> reDraw() async



FTXVodPlayConfig Class

Attribute configuration description

Parameter
Type
Description
connectRetryCount
int
The number of player reconnections. If the SDK is disconnected from the server due to an exception, the SDK will attempt to reconnect to the server.
connectRetryInterval
int
The interval between two player reconnections. If the SDK is disconnected from the server due to an exception, the SDK will attempt to reconnect to the server.
timeout
int
Player connection timeout period
playerType
int
Player type. Valid values: 0: VOD; 1: live streaming; 2: live stream replay.
headers
Map
Custom HTTP headers
enableAccurateSeek
bool
Whether to enable accurate seek. Default value: true.
autoRotate
bool
If it is set to true, the MP4 file will be automatically rotated according to the rotation angle set in the file, which can be obtained from the PLAY_EVT_CHANGE_ROTATION event. Default value: true.
smoothSwitchBitrate
bool
Whether to enable smooth multi-bitrate HLS stream switch. If it is set to false (default), multi-bitrate URLs are opened faster. If it is set to true, the bitrate can be switched smoothly when IDR frames are aligned.
cacheMp4ExtName
String
The cached MP4 filename extension. Default value: mp4.
progressInterval
int
The progress callback interval in milliseconds. If it is not set, the SDK will call back the progress once every 0.5 seconds.
maxBufferSize
int
The maximum size of playback buffer in MB. The setting will affect playableDuration. The greater the value, the more the data that is buffered in advance.
maxPreloadSize
int
Maximum preload buffer size in MB
firstStartPlayBufferTime
int
Duration of the video data that needs to be loaded during the first buffering in ms. Default value: 100 ms
nextStartPlayBufferTime
int
Minimum buffered data size to stop buffering (secondary buffering for insufficient buffered data or progress bar drag buffering caused by seek) in ms. Default value: 250 ms
overlayKey
String
The HLS security enhancement encryption and decryption key
overlayIv
String
The HLS security enhancement encryption and decryption IV
extInfoMap
Map
Some special configuration items
enableRenderProcess
bool
Whether to allow the postrendering and postproduction feature, which is enabled by default. If the super-resolution plugin exists after it is enabled, the plugin will be loaded by default
preferredResolution
int
Resolution of the video used for playback preferably. preferredResolution = width * height
mediaType
int
Set the media type, with AUTO as the default value. Optional values are:
TXVodConstants#MEDIA_TYPE_AUTO, AUTO type (default value, adaptive bit rate playback is not supported for now);
TXVodConstants#MEDIA_TYPE_HLS_VOD, HLS VOD media;
TXVodConstants#MEDIA_TYPE_HLS_LIVE, HLS live media;
TXVodConstants#MEDIA_TYPE_HLS_VOD, MP4 and other common file VOD media (supported starting from version 11.7);
TXVodConstants#MEDIA_TYPE_DASH_VOD, DASH VOD media (supported starting from version 11.7);

TXLivePlayerController Class

initialize

Description
This API is used to initialize the controller and request assignment of shared textures.
Note:
Versions 12.3.1 and later no longer require this call.
API
Future<void> initialize({bool? onlyAudio}) async;
Parameter description
Parameter
Type
Description
onlyAudio
bool
Whether the player is an audio-only player. This parameter is optional.
Returned value description
Unlimited

startLivePlay

Note
Starting from v10.7, startPlay is replaced by startLivePlay, and playback will succeed only after you use {@link SuperPlayerPlugin#setGlobalLicense} to set the license; otherwise, playback will fail (black screen occurs). The license needs to be set only once globally. You can use the license for CSS, UGSV, or video playback. If you have no such licenses, you can quickly apply for a trial license or purchase an official license.
Description
This API is used to play back a video via URL.
API
Future<bool> play(String url) async;
Parameter description
Parameter
Type
Description
url
String
The URL of the video to be played back.
Returned value description
Parameter
Type
Description
result
bool
Whether creation succeeded.

pause

Description
This API is used to pause a video during playback.
API
Future<void> pause() async;
Parameter description
Unlimited
Returned value description
Unlimited

resume

Description
This API is used to resume the playback of a paused video.
API
Future<void> resume() async;
Parameter description
Unlimited
Returned value description
Unlimited

stop

Description
This API is used to stop a video during played back.
API
Future<bool> stop({bool isNeedClear = false}) async;
Parameter description
Parameter
Type
Description
isNeedClear
bool
Whether to clear the last-frame image.
Returned value description
Parameter
Type
Description
result
bool
Whether stop succeeded.

isPlaying

Description
This API is used to query whether the player is currently playing a video.
API
Future<bool> isPlaying() async;
Parameter description
Unlimited
Returned value description
Parameter
Type
Description
isPlaying
bool
Whether playback is ongoing.

setMute

Description
This API is used to set whether to mute the current playback.
API
Future<void> setMute(bool mute) async;
Parameter description
Parameter
Type
Description
mute
bool
Whether to mute the playback.
Returned value description
Unlimited

setVolume

Description
This API is used to set the video volume level.
API
Future<void> setVolume(int volume);
Parameter description
Parameter
Type
Description
volume
int
Video volume level. Value range: 0–100
Returned value description
Unlimited

setLiveMode

Description
This API is used to set the live streaming mode.
API
Future<void> setLiveMode(TXPlayerLiveMode mode) async;
Parameter description
Parameter
Type
Description
mode
int
Live streaming mode, which can be set to auto, expedited, or smooth mode.
Returned value description
Unlimited

setAppID

Description
This API is used to set the appID for cloud-based control.
API
Future<void> setAppID(int appId) async;
Parameter description
Parameter
Type
Description
appId
int
The application ID.
Returned value description
Unlimited

enableHardwareDecode

Description
This API is used to enable/disable playback based on hardware decoding. After the value is set, it will not take effect until the video playback is restarted.
API
Future<bool> enableHardwareDecode(bool enable);
Parameter description
Parameter
Type
Description
enable
bool
Whether to enable hardware decoding.
Returned value description
Parameter
Type
Description
result
bool
The hardware/software decoding setting result.

enterPictureInPictureMode

Description
This API is used to enter the PiP mode. It is applicable only to Android. Currently, live streaming on iOS doesn't support the PiP mode.
API
Future<int> enterPictureInPictureMode({String? backIconForAndroid, String? playIconForAndroid, String? pauseIconForAndroid, String? forwardIconForAndroid}) async;
Parameter description
The parameters are applicable only to Android.
Parameter
Type
Description
backIcon
String
The seek backward icon, which can be up to 1 MB in size as limited by Android. It is optional, and if it is not set, the system icon will be used.
playIcon
String
The playback icon, which can be up to 1 MB in size as limited by Android. It is optional, and if it is not set, the system icon will be used.
pauseIcon
String
The pause icon, which can be up to 1 MB in size as limited by Android. It is optional, and if it is not set, the system icon will be used.
forwardIcon
String
The fast forward icon, which can be up to 1 MB in size as limited by Android. It is optional, and if it is not set, the system icon will be used.
Returned value description
Parameter
Code
Description
NO_ERROR
0
Started successfully with no errors.
ERROR_PIP_LOWER_VERSION
-101
The Android version is too early and doesn't support the PiP mode.
ERROR_PIP_DENIED_PERMISSION
-102
The PiP mode permission wasn't enabled, or the current device doesn't support PiP.
ERROR_PIP_ACTIVITY_DESTROYED
-103
The current UI was terminated.
ERROR_IOS_PIP_DEVICE_NOT_SUPPORT
-104
The device model or system version doesn't support PiP (only supported on iPadOS 9+ and iOS 14+). This error is applicable only to iOS.
ERROR_IOS_PIP_PLAYER_NOT_SUPPORT
-105
The player doesn't support PiP. This error is applicable only to iOS.
ERROR_IOS_PIP_VIDEO_NOT_SUPPORT
-106
The video doesn't support PiP. This error is applicable only to iOS.
ERROR_IOS_PIP_IS_NOT_POSSIBLE
-107
The PiP controller was unavailable. This error is applicable only to iOS.
ERROR_IOS_PIP_FROM_SYSTEM
-108
The PiP controller reported an error. This error is applicable only to iOS.
ERROR_IOS_PIP_PLAYER_NOT_EXIST
-109
The player object doesn’t exist. This error is applicable only to iOS.
ERROR_IOS_PIP_IS_RUNNING
-110
The PiP feature was running. This error is applicable only to iOS.
ERROR_IOS_PIP_NOT_RUNNING
-111
The PiP feature didn't start. This error is applicable only to iOS.

dispose

Description
This API is used to terminate the controller. After it is called, all notification events will be terminated, and the player will be released.
API
Future<void> dispose() async;
Parameter description
Unlimited
Returned value description
Unlimited

switchStream

Description
This API is used to switch the stream played back.
API
Future<int> switchStream(String url) async;
Parameter description
Parameter
Type
Description
url
String
The video source to be switched to.
Returned value description
Parameter
Type
Description
result
int
The switch result.

enableReceiveSeiMessage

Description
Enable reception of SEI messages.
API
Future<int> enableReceiveSeiMessage(bool isEnabled, int payloadType) async
Parameter description
Parameter
Type
Description
isEnabled
bool
Whether to enable reception of SEI messages, default is off.
payloadType
int
Specify the payloadType for receiving SEI messages, supporting 5, 242, 243. Please ensure it matches the payloadType of the sender.
Returned value description
Parameter
Type
Description
result
int
The result of enabling.

showDebugView

Description
Display debug information layer.
API
Future<void> showDebugView(bool isShow) async
Parameter description
Parameter
Type
Description
isShow
bool
Whether to display the debug information layer.

setProperty

Description
Call the advanced API interface of V2TXLivePlayer.
API
Future<int> setProperty(String key, Object value) async
Parameter description
Parameter
Type
Description
key
String
Extended parameter key-value pairs.
value
Object
Extended parameter values.
Returned value description
Parameter
Type
Description
result
int
The result of the setting.

getSupportedBitrate

Description
Get stream information.
API
Future<List<FSteamInfo>> getSupportedBitrate() async

setCacheParams

Description
Set the minimum and maximum time (in seconds) for automatic adjustment of the player's cache.
API
Future<int> setCacheParams(double minTime, double maxTime) async
Parameter description
Parameter
Type
Description
minTime
double
Minimum time for automatic cache adjustment.
maxTime
double
Maximum time for automatic cache adjustment.
Returned value description
Parameter
Type
Description
result
int
The result of the setting.

setPlayerView

Description
Bind Video Rendering Texture.
API
Future<void>setPlayerView(int renderViewId) async
Parameter description
Parameter
Type
Description
renderViewId
int
The viewId returned by the onRenderViewCreatedListener callback of TXPlayerVideo.

setRenderMode

Description
Set the screen tiling mode.
API
Future<void> setRenderMode(FTXPlayerRenderMode renderMode) async
Parameter description
Parameter
Type
Description
renderMode
FTXPlayerRenderMode
Set the screen tiling mode: one is FTXPlayerRenderMode.ADJUST_RESOLUTION that prioritizes displaying the complete video frame while maintaining the aspect ratio, and the other is FTXPlayerRenderMode.FULL_FILL_CONTAINER that fills the container while preserving the aspect ratio.

FTXLivePlayConfig Class

Attribute configuration description

Parameter
Type
Description
maxAutoAdjustCacheTime
double
The maximum time for automatic cache time adjustment in seconds. The value must be greater than 0. Default value: 5.
minAutoAdjustCacheTime
double
The minimum time for automatic cache time adjustment in seconds. The value must be greater than 0. Default value: 1.
connectRetryCount
int
The default number of times the SDK tries reconnecting when the player is disconnected. Value range: 1–10. Default value: 3
connectRetryInterval
int
The interval between network reconnections in seconds. Value range: 3–30. Default value: 3

TXVodDownloadController Class

startPreLoad

Description
Start preloading. Before starting preloading, please set the cache directory [SuperPlayerPlugin.setGlobalCacheFolderPath] and cache size [SuperPlayerPlugin.setGlobalMaxCacheSize] of the playback engine. This setting is a global configuration and needs to be consistent with the player to avoid invalidating the playback cache.
API
Future<int> startPreLoad(
final String playUrl,
final int preloadSizeMB,
final int preferredResolution, {
FTXPredownloadOnCompleteListener? onCompleteListener,
FTXPredownloadOnErrorListener? onErrorListener,
}) async
Future<void> startPreload(TXPlayInfoParams txPlayInfoParams,
final int preloadSizeMB,
final int preferredResolution, {
FTXPredownloadOnCompleteListener? onCompleteListener,
FTXPredownloadOnErrorListener? onErrorListener,
FTXPredownloadOnStartListener? onStartListener,
}) async
Parameter description
Parameter
Type
Description
playUrl
String
The URL to be preloaded
preloadSizeMB
int
Size of preloaded data (unit: MB).
preferredResolution
int
Expected resolution, with the value in the format of height x width. For example, 720x1080. If multiple resolutions are not supported or not specified, pass -1.
onCompleteListener
FTXPredownloadOnCompleteListener?
Preloading successful callback, global.
onErrorListener
FTXPredownloadOnErrorListener
Preloading failed callback, global.
TXPlayInfoParams:
Parameter
Type
Description
appId
int
The application's appId, which is required.
fileId
String
The file ID, which is required.
url
String
Only one of the video url and fileId needs to be filled in. If both are filled in, the url takes priority.
sign
String
Hotlink protection signature, see Hotlink protection product documentation.
Returned value description
Parameter
Type
Description
taskId
int
task ID

stopPreLoad

Description
Stop preloading.
API
Future<void> stopPreLoad(final int taskId) async
Parameter description
Parameter
Type
Description
taskId
int
task ID
Returned value description
Unlimited

startDownload

Description
Start downloading the video.
API
Future<void> startDownload(TXVodDownloadMediaInfo mediaInfo) async
Parameter description
Parameter
Type
Description
mediaInfo
TXVodDownloadMediaInfo
Download task information.
TXVodDownloadMediaInfo
Parameter
Type
Description
playPath
String?
Cache address. This value is obtained when accessing the video cache and does not need to be assigned when starting the download.
progress
double?
Cache progress. This value is obtained when accessing the video cache and does not need to be assigned when starting the download.
downloadState
int?
Cache status. This value is obtained when accessing the video cache and does not need to be assigned when starting the download.
userName
String?
Download account name used to distinguish downloads from different accounts. Pass an empty string to use "default".
duration
int?
Total duration of cached video. The unit is milliseconds on Android and seconds on iOS. This value is obtained when accessing the video cache and does not need to be assigned when starting the download.
playableDuration
int?
Cached duration of the video. The unit is milliseconds on Android and seconds on iOS. This value is obtained when accessing the video cache and does not need to be assigned when starting the download.
size
int?
Total file size, in bytes. This value is obtained when accessing the video cache and does not need to be assigned when starting the download.
downloadSize
int?
Downloaded file size, in bytes. This value is obtained when accessing the video cache and does not need to be assigned when starting the download.
url
String?
The URL of the video to be downloaded. This is a required field for downloading URLs. Nesting m3u8 and mp4 downloads is not supported.
dataSource
TXVodDownloadDataSource?
File ID information of the video to be downloaded. Either the URL or this parameter can be used, but at least one is required.
speed
int?
Download speed, in units of KBytes/second.
isResourceBroken
bool?
Whether the resource is corrupted, e.g. the resource has been deleted.
TXVodDownloadDataSource
Parameter
Type
Description
appId
int?
The App ID corresponding to the downloaded file. This is a required field.
fileId
String?
The ID of the downloaded file. This is a required field.
pSign
String?
Encryption signature. This is a required field for encrypted videos.
quality
int?
The ID of the video quality. This is a required field.
token
String?
Encryption token.
userName
String?
Download account name used to distinguish downloads from different accounts. Pass an empty string to use "default".
Returned value description
Unlimited

stopDownload

Description
Stop downloading.
API
Future<void> stopDownload(TXVodDownloadMediaInfo mediaInfo) async
Parameter description
Parameter
Type
Description
mediaInfo
TXVodDownloadMediaInfo
Task information.
Returned value description
Unlimited

setDownloadHeaders

Description
Set the request header for the download task.
API
Future<void> setDownloadHeaders(Map<String, String> headers) async
Parameter descriptions
Parameter
Type
Description
headers
Map<String, String>
request heade information
Returned value description
Unlimited

getDownloadList

Description
Get all download tasks, including completed, in-progress, and failed tasks.
API
Future<List<TXVodDownloadMediaInfo>> getDownloadList() async
Parameter descriptions
Unlimited
Returned value description
Parameter
Type
Description
mediaInfoList
List<TXVodDownloadMediaInfo>
Task list. Different users' downloads can be distinguished by comparing the user name.

getDownloadInfo

Description
Get download task information.
API
Future<TXVodDownloadMediaInfo> getDownloadInfo(TXVodDownloadMediaInfo mediaInfo) async
Parameter descriptions
Parameter
Type
Description
mediaInfo
TXVodDownloadMediaInfo
task information
Returned value description
Parameter
Type
Description
mediaInfo
TXVodDownloadMediaInfo
Cached task details.

setDownloadObserver

Description
Get download task information.
API
void setDownloadObserver(FTXDownloadOnStateChangeListener downloadOnStateChangeListener, FTXDownloadOnErrorListener downloadOnErrorListener)
Parameter descriptions
Parameter
Type
Description
downloadOnStateChangeListener
FTXDownloadOnStateChangeListener
Task download status callback.
downloadOnErrorListener
FTXDownloadOnErrorListener
Task download error callback.
Returned value description
Unlimited

deleteDownloadMediaInfo

Description
Delete downloaded video.
API
Future<bool> deleteDownloadMediaInfo(TXVodDownloadMediaInfo mediaInfo) async
Parameter descriptions
Parameter
Type
Description
mediaInfo
TXVodDownloadMediaInfo
Cached task details.
Returned value description
Parameter
Type
Description
result
bool
Deletion result.

문제 해결에 도움이 되었나요?
더 자세한 내용은 문의하기 또는 티켓 제출 을 통해 문의할 수 있습니다.
아니오

피드백