tencent cloud

All product documents
Mobile Live Video Broadcasting
V2TXLivePlayerObserver
Last updated: 2025-04-09 15:18:03
V2TXLivePlayerObserver
Last updated: 2025-04-09 15:18:03
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
Picture-in-Picture state change 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:code:message:extraInfo:

onError:code:message:extraInfo:
- (void)onError:
(id<V2TXLivePlayer>)player
code:
(V2TXLiveCode)code
message:
(NSString *)msg
extraInfo:
(NSDictionary *)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:code:message:extraInfo:

onWarning:code:message:extraInfo:
- (void)onWarning:
(id<V2TXLivePlayer>)player
code:
(V2TXLiveCode)code
message:
(NSString *)msg
extraInfo:
(NSDictionary *)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:width:height:

onVideoResolutionChanged:width:height:
- (void)onVideoResolutionChanged:
(id<V2TXLivePlayer>)player
width:
(NSInteger)width
height:
(NSInteger)height

live player resolution change notification

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

onConnected:extraInfo:

onConnected:extraInfo:
- (void)onConnected:
(id<V2TXLivePlayer>)player
extraInfo:
(NSDictionary *)extraInfo

live player has successfully connected to the server notification

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

onVideoPlaying:firstPlay:extraInfo:

onVideoPlaying:firstPlay:extraInfo:
- (void)onVideoPlaying:
(id<V2TXLivePlayer>)player
firstPlay:
(BOOL)firstPlay
extraInfo:
(NSDictionary *)extraInfo

Video playback event

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

onAudioPlaying:firstPlay:extraInfo:

onAudioPlaying:firstPlay:extraInfo:
- (void)onAudioPlaying:
(id<V2TXLivePlayer>)player
firstPlay:
(BOOL)firstPlay
extraInfo:
(NSDictionary *)extraInfo

Audio playback event

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

onVideoLoading:extraInfo:

onVideoLoading:extraInfo:
- (void)onVideoLoading:
(id<V2TXLivePlayer>)player
extraInfo:
(NSDictionary *)extraInfo

Video loading event

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

onAudioLoading:extraInfo:

onAudioLoading:extraInfo:
- (void)onAudioLoading:
(id<V2TXLivePlayer>)player
extraInfo:
(NSDictionary *)extraInfo

Audio loading event

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

onPlayoutVolumeUpdate:volume:

onPlayoutVolumeUpdate:volume:
- (void)onPlayoutVolumeUpdate:
(id<V2TXLivePlayer>)player
volume:
(NSInteger)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:statistics:

onStatisticsUpdate:statistics:
- (void)onStatisticsUpdate:
(id<V2TXLivePlayer>)player
statistics:
(V2TXLivePlayerStatistics *)statistics

Live player statistics callback

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

onSnapshotComplete:image:

onSnapshotComplete:image:
- (void)onSnapshotComplete:
(id<V2TXLivePlayer>)player
image:
(nullable TXImage *)image

Screenshot callback

Param
DESC
image
Captured video image.
player
Player object that calls back this notification.
Note
This callback notification is received after snapshot is called to snapshot.

onRenderVideoFrame:frame:

onRenderVideoFrame:frame:
- (void)onRenderVideoFrame:
(id<V2TXLivePlayer>)player
frame:
(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:frame:

onPlayoutAudioFrame:frame:
- (void)onPlayoutAudioFrame:
(id<V2TXLivePlayer>)player
frame:
(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:payloadType:data:

onReceiveSeiMessage:payloadType:data:
- (void)onReceiveSeiMessage:
(id<V2TXLivePlayer>)player
payloadType:
(int)payloadType
data:
(NSData *)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:url:code:

onStreamSwitched:url:code:
- (void)onStreamSwitched:
(id<V2TXLivePlayer>)player
url:
(NSString *)url
code:
(NSInteger)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.

onPictureInPictureStateUpdate:state:message:extraInfo:

onPictureInPictureStateUpdate:state:message:extraInfo:
- (void)onPictureInPictureStateUpdate:
(id<V2TXLivePlayer>)player
state:
message:
(NSString *)msg
extraInfo:
(NSDictionary *)extraInfo

Picture-in-Picture state change callback

Param
DESC
extraInfo
Extended information.
player
Player object that calls back this notification.
state
Picture-in-Picture state。
Note
This callback notification is received after enablePictureInPicture is called to enable Picture-in-Picture.

onLocalRecordBegin:errCode:storagePath:

onLocalRecordBegin:errCode:storagePath:
- (void)onLocalRecordBegin:
(id<V2TXLivePlayer>)player
errCode:
(NSInteger)errCode
storagePath:
(NSString *)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:durationMs:storagePath:

onLocalRecording:durationMs:storagePath:
- (void)onLocalRecording:
(id<V2TXLivePlayer>)player
durationMs:
(NSInteger)durationMs
storagePath:
(NSString *)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:errCode:storagePath:

onLocalRecordComplete:errCode:storagePath:
- (void)onLocalRecordComplete:
(id<V2TXLivePlayer>)player
errCode:
(NSInteger)errCode
storagePath:
(NSString *)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