Copyright (c) 2021 Tencent. All rights reserved.
Module: V2TXLivePremier @ TXLiteAVSDK
Function: V2TXLive High-level interface
V2TXLivePremierObserver
|
| Custom Log output callback interface |
| setLicence result callback interface |
| Raw audio data captured locally |
| Data mixed from each channel before being submitted to the system for playback |
| In-ear monitoring data |
V2TXLivePremier
|
| Get the SDK version number |
| Set V2TXLivePremier callback interface |
| Set Log configuration information |
| Set up SDK access environment |
| Set SDK authorization license |
| Set SDK socks5 proxy config |
| Enables/Disables audio capture callback |
| Enables/Disables audio playout callback |
| Enables/Disables in-ear monitoring callback |
| Set user id |
| Call experimental APIs |
onLog
Custom Log output callback interface
onLicenceLoaded
setLicence result callback interface
|
reason | the reason for failure. |
result | the result of setLicence interface, 0 succeeds, negative number fails. |
onCaptureAudioFrame
| (V2TXLiveDef.V2TXLiveAudioFrame frame) |
Raw audio data captured locally
|
frame | Audio frames in PCM format. |
Note
1. Please avoid time-consuming operations in this callback function. The SDK processes an audio frame every 20 ms, so if your operation takes more than 20 ms, it will cause audio exceptions.
2. The audio data returned via this callback can be read and modified, but please keep the duration of your operation short.
3. The audio data returned via this callback does not include pre-processing effects like background music, audio effects, or reverb, and therefore has a very short delay.
onPlayoutAudioFrame
| (V2TXLiveDef.V2TXLiveAudioFrame frame) |
Data mixed from each channel before being submitted to the system for playback
After you configure the callback of custom audio processing, the SDK will return to you via this callback the data (PCM format) mixed from each channel before it is submitted to the system for playback.
The audio data returned via this callback is in PCM format and has a fixed frame length (time) of 0.02s.
The formula to convert a frame length in seconds to one in bytes is sample rate * frame length in seconds * number of sound channels * audio bit depth.
Assume that the audio is recorded on a single channel with a sample rate of 48,000 Hz and audio bit depth of 16 bits, which are the default settings of SDK. The frame length in bytes will be 48000 * 0.02s * 1 * 16 bits = 15360 bits = 1920 bytes.
|
frame | Audio frames in PCM format. |
Note
1. Please avoid time-consuming operations in this callback function. The SDK processes an audio frame every 20 ms, so if your operation takes more than 20 ms, it will cause audio exceptions.
2. The audio data returned via this callback can be read and modified, but please keep the duration of your operation short.
3. The audio data returned via this callback is the audio data mixed from each channel before it is played. It does not include the in-ear monitoring data.
onVoiceEarMonitorAudioFrame
onVoiceEarMonitorAudioFrame
void onVoiceEarMonitorAudioFrame | (V2TXLiveDef.V2TXLiveAudioFrame frame) |
In-ear monitoring data
After you configure the callback of custom audio processing, the SDK will return to you via this callback the in-ear monitoring data (PCM format) before it is submitted to the system for playback.
The audio returned is in PCM format and has a not-fixed frame length (time).
The formula to convert a frame length in seconds to one in bytes is sample rate * frame length in seconds * number of sound channels * audio bit depth.
Assume that the audio is recorded on a single channel with a sample rate of 48,000 Hz and audio bit depth of 16 bits, which are the default settings of TRTC. The length of 0.02s frame in bytes will be 48000 * 0.02s * 1 * 16 bits = 15360 bits = 1920 bytes.
|
frame | Audio frames in PCM format |
Note
1. Please avoid time-consuming operations in this callback function, or it will cause audio exceptions.
2. The audio data returned via this callback can be read and modified, but please keep the duration of your operation short.
getSDKVersionStr
Get the SDK version number
setObserver
Set V2TXLivePremier callback interface
setLogConfig
Set Log configuration information
setEnvironment
Set up SDK access environment
|
env | currently supports two parameters "default" and "GDPR". default: In the default environment, the SDK will find the best access point in the world for access. GDPR: All audio and video data and quality statistics will not pass through servers in mainland China. |
Note
If your application has no special requirements, please do not call this interface for setting.
setLicence
Set SDK authorization license
Try and Purchase a License: https://www.tencentcloud.com/document/product/1071/38546.
|
context |
|
key | the key of licence. |
url | the url of licence. |
setSocks5Proxy
Set SDK socks5 proxy config
|
config | protocol configured with socks5 proxy. |
host | socks5 proxy host. |
password | socks5 proxy password. |
port | socks5 proxy port. |
username | socks5 proxy username. |
enableAudioCaptureObserver
enableAudioCaptureObserver
void enableAudioCaptureObserver | |
| |
Enables/Disables audio capture callback
|
enable | true : enable; false (default): disable.
|
format | audio frame format. |
Note
This API works only if you call it before startPush. enableAudioPlayoutObserver
enableAudioPlayoutObserver
void enableAudioPlayoutObserver | |
| |
Enables/Disables audio playout callback
|
enable | true : enable; false (default): disable.
|
format | audio frame format. |
enableVoiceEarMonitorObserver
enableVoiceEarMonitorObserver
void enableVoiceEarMonitorObserver | |
Enables/Disables in-ear monitoring callback
|
enable | true : enable; false (default): disable.
|
setUserId
Set user id
|
userId | User/device id maintained by the service side itself. |
callExperimentalAPI
Call experimental APIs
|
jsonStr | JSON string describing interface and parameters. |
Return Desc:
V2TXLIVE_OK: successful.
V2TXLIVE_ERROR_INVALID_PARAMETER: operation failed because of illegal parameter.
Was this page helpful?