tencent cloud

All product documents
Mobile Live Video Broadcasting
V2TXLivePlayerObserver
Last updated: 2025-04-09 15:18:04
V2TXLivePlayerObserver
Last updated: 2025-04-09 15:18:04
Copyright (c) 2021 Tencent. All rights reserved.

Module: V2TXLivePlayerObserver @ TXLiteAVSDK

Function: Tencent Cloud live player callback notification


Function

Player callback notification for Tencent Cloud Live.

Introduce

You can receive some callback notifications from the V2TXLivePlayer player, including player status, playback volume callback, audio and video first frame callback, statistical data, warning and error messages, etc.

V2TXLivePlayerObserver

V2TXLivePlayerObserver

FuncList
DESC
live player error notification, which is called back when the player encounters an error
live player warning notification
live player resolution change notification
live player has successfully connected to the server notification
Video playback event
Audio playback event
Video loading event
Audio loading event
Player playback volume callback
Live player statistics callback
Screenshot callback
Custom video rendering callback
Audio Data callback
Callback of receiving an SEI message. The sender calls sendSeiMessage in V2TXLivePusher to send an SEI
Resolution stream switch callback
The SDK returns this callback when you call startLocalRecording to start local recording.
The SDK returns this callback when you call startLocalRecording to start local recording, which means recording task in progress.
The SDK returns this callback when you call stopLocalRecording to start local recording.

onError

onError
void onError
(V2TXLivePlayer player

int code

String msg

Bundle extraInfo)

live player error notification, which is called back when the player encounters an error

Param
DESC
code
Error code V2TXLiveCode.
extraInfo
Extended information.
msg
Error message.
player
Player object that calls back this notification.

onWarning

onWarning
void onWarning
(V2TXLivePlayer player

int code

String msg

Bundle extraInfo)

live player warning notification

Param
DESC
code
Warning code V2TXLiveCode.
extraInfo
Extended information.
msg
Warning message.
player
Player object that calls back this notification.

onVideoResolutionChanged

onVideoResolutionChanged
void onVideoResolutionChanged
(V2TXLivePlayer player

int width

int height)

live player resolution change notification

Param
DESC
height
Video height.
player
Player object that calls back this notification.
width
Video width.

onConnected

onConnected
void onConnected
(V2TXLivePlayer player

Bundle extraInfo)

live player has successfully connected to the server notification

Param
DESC
extraInfo
Extended information.
player
Player object that calls back this notification.

onVideoPlaying

onVideoPlaying
void onVideoPlaying
(V2TXLivePlayer player

boolean firstPlay

Bundle extraInfo)

Video playback event

Param
DESC
extraInfo
Extended information.
firstPlay
Play for the first time.
player
Player object that calls back this notification.

onAudioPlaying

onAudioPlaying
void onAudioPlaying
(V2TXLivePlayer player

boolean firstPlay

Bundle extraInfo)

Audio playback event

Param
DESC
extraInfo
Extended information.
firstPlay
Play for the first time.
player
Player object that calls back this notification.

onVideoLoading

onVideoLoading
void onVideoLoading
(V2TXLivePlayer player

Bundle extraInfo)

Video loading event

Param
DESC
extraInfo
Extended information.
player
Player object that calls back this notification.

onAudioLoading

onAudioLoading
void onAudioLoading
(V2TXLivePlayer player

Bundle extraInfo)

Audio loading event

Param
DESC
extraInfo
Extended information.
player
Player object that calls back this notification.

onPlayoutVolumeUpdate

onPlayoutVolumeUpdate
void onPlayoutVolumeUpdate
(V2TXLivePlayer player

int volume)

Player playback volume callback

Param
DESC
player
Player object that calls back this notification.
volume
Current playback volume.
Note
This callback notification is received after enableVolumeEvaluation is called to enable playback volume display.

onStatisticsUpdate

onStatisticsUpdate
void onStatisticsUpdate
(V2TXLivePlayer player

V2TXLivePlayerStatistics statistics)

Live player statistics callback

Param
DESC
player
Player object that calls back this notification.
statistics
Player statistics V2TXLivePlayerStatistics.

onSnapshotComplete

onSnapshotComplete
void onSnapshotComplete
(V2TXLivePlayer player

Bitmap image)

Screenshot callback

Param
DESC
image
Captured video image.
player
Player object that calls back this notification.

onRenderVideoFrame

onRenderVideoFrame
void onRenderVideoFrame
(V2TXLivePlayer player

V2TXLiveVideoFrame videoFrame)

Custom video rendering callback

Param
DESC
player
Player object that calls back this notification.
videoFrame
Video frame data V2TXLiveVideoFrame.
Note
Need you call enableObserveVideoFrame to turn on the callback switch.

onPlayoutAudioFrame

onPlayoutAudioFrame
void onPlayoutAudioFrame
(V2TXLivePlayer player

V2TXLiveAudioFrame audioFrame)

Audio Data callback

Param
DESC
aduioFrame
Audio frame data V2TXLiveAudioFrame.
player
Player object that calls back this notification.
Note
Need you call enableObserveAudioFrame to turn on the callback switch. Please use the data of audioFrame in the current callback.

onReceiveSeiMessage

onReceiveSeiMessage
void onReceiveSeiMessage
(V2TXLivePlayer player

int payloadType

byte[] data)

Callback of receiving an SEI message. The sender calls `sendSeiMessage` in {@link V2TXLivePusher} to send an SEI

Param
DESC
data
sei message data.
payloadType
The payload type of the received SEI message.
player
Player object that calls back this notification.
Note
You will receive this callback after calling enableReceiveSeiMessage in V2TXLivePlayer to enable the receiving of SEI.

onStreamSwitched

onStreamSwitched
void onStreamSwitched
(V2TXLivePlayer player

String url

int code)

Resolution stream switch callback

Param
DESC
code
Status code, 0:success, -1:timeout, -2:failed, server error, -3:failed, client error.
player
Player object that calls back this notification.
url
Switched playback address.
Note
This callback notification is received after switchStream is called to switch stream.

onLocalRecordBegin

onLocalRecordBegin
void onLocalRecordBegin
(V2TXLivePlayer player

int code

String storagePath)

The SDK returns this callback when you call {@link startLocalRecording} to start local recording.

Param
DESC
code
status.
0: successful.
-1: failed.
-2: unsupported format.
-6: recording has been started. Stop recording first.
-7: recording file already exists and needs to be deleted.
-8: recording directory does not have the write permission. Please check the directory permission.
player
Player object that calls back this notification.
storagePath
recording filePath.

onLocalRecording

onLocalRecording
void onLocalRecording
(V2TXLivePlayer player

long durationMs

String storagePath)

The SDK returns this callback when you call {@link startLocalRecording} to start local recording, which means recording task in progress.

Param
DESC
durationMs
recording duration.
player
Player object that calls back this notification.
storagePath
recording filePath.

onLocalRecordComplete

onLocalRecordComplete
void onLocalRecordComplete
(V2TXLivePlayer player

int code

String storagePath)

The SDK returns this callback when you call {@link stopLocalRecording} to start local recording.

Param
DESC
code
status
0: successful.
-1: failed.
-2: Switching resolution or horizontal and vertical screen causes the recording to stop.
-3: recording duration is too short or no video or audio data is received. Check the recording duration or whether audio or video capture is enabled.
player
Player object that calls back this notification.
storagePath
recording filePath.
Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback

Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 available.

7x24 Phone Support
Hong Kong, China
+852 800 906 020 (Toll Free)
United States
+1 844 606 0804 (Toll Free)
United Kingdom
+44 808 196 4551 (Toll Free)
Canada
+1 888 605 7930 (Toll Free)
Australia
+61 1300 986 386 (Toll Free)
EdgeOne hotline
+852 300 80699
More local hotlines coming soon