V2TXLivePusher encodes local audio/video and publishes the encoded data to a specified URL. It supports any publishing server.
It has the following capabilities:V2TXLivePusher integrates multiple retouching algorithms (natural & smooth) and color space filters (custom filters are supported).V2TXLivePusher can adapt automatically to different upstream network conditions by controlling audio/video traffic in real time based on the network conditions of hosts.V2TXLivePusher supports animated widgets and fine-tuning of facial features, such as eye enlarging, face slimming, and nose reshaping. You need to purchase a YouTu license to use these live streaming effects.public abstract void setObserver(V2TXLivePusherObserver observer);
Parameter | Type | Description |
observer | V2TXLivePusherObserver | Target object for the publisher’s callbacks. For more information, please see V2TXLivePusherObserver. |
public abstract int setRenderView(TXCloudVideoView view);
Parameter | Type | Description |
view | TXCloudVideoView | View for local camera preview |
V2TXLIVE_OK: successfulpublic abstract int setRenderView(SurfaceView view);
Parameter | Type | Description |
view | SurfaceView | View for local camera preview |
V2TXLIVE_OK: successfulpublic abstract int setRenderView(TextureView view);
Parameter | Type | Description |
view | TextureView | View for local camera preview |
V2TXLIVE_OK: successfulpublic abstract int startPush(String url);
Parameter | Type | Description |
url | String | URL to which data is published. Any publishing server is supported. |
V2TXLIVE_OK: successfulV2TXLIVE_ERROR_INVALID_PARAMETER: operation failed because the URL is invalid.V2TXLIVE_ERROR_REFUSED: RTC does not support using the same stream ID for publishing and playback on the same device.public abstract int stopPush();
V2TXLIVE_OK: successfulpublic abstract int isPushing();
1: yes0: nopublic abstract int setVideoQuality(V2TXLiveVideoEncoderParam param);
Parameter | Type | Description |
param | Video encoding parameters |
public abstract int setRenderRotation(V2TXLiveRotation rotation);
Parameter | Type | Description |
rotation | Degrees by which the image is rotated. Default value: V2TXLiveRotation0 |
V2TXLIVE_OK: successfulV2TXLiveRotation enumerated valuesValue | Description |
V2TXLiveRotation0 | No rotation |
V2TXLiveRotation90 | Rotate 90 degrees clockwise |
V2TXLiveRotation180 | Rotate 180 degrees clockwise |
V2TXLiveRotation270 | Rotate 270 degrees clockwise |
public abstract int setRenderMirror(V2TXLiveMirrorType mirrorType);
Parameter | Type | Description |
mirrorType | Mirror mode of the camera. Default value: V2TXLiveMirrorTypeAuto |
V2TXLIVE_OK: successfulV2TXLiveMirrorType enumerated valuesValue | Description |
V2TXLiveMirrorTypeAuto | The default value. In this mode, the front camera is mirrored, but the rear camera is not. |
V2TXLiveMirrorTypeEnable | Both the front and rear cameras are mirrored. |
V2TXLiveMirrorTypeDisable | Neither the front nor rear camera is mirrored. |
startVirtualCamera, startCamera, and startScreenCapture, only one can be used to publish data under the same pusher instance. If, for example, startCamera is called first and then startVirtualCamera, the SDK will pause the publishing of camera data and start image publishing.public abstract int startCamera(boolean frontCamera);
V2TXLIVE_OK: successfulpublic abstract int stopCamera();
V2TXLIVE_OK: successfulstartVirtualCamera, startCamera, and startScreenCapture, only one can be used to publish data under the same pusher instance. If, for example, startCamera is called first and then startVirtualCamera, the SDK will pause the publishing of camera data and start image publishing.public abstract int startVirtualCamera(Bitmap image);
V2TXLIVE_OK: successfulpublic abstract int stopVirtualCamera();
V2TXLIVE_OK: successfulstartVirtualCamera, startCamera, and startScreenCapture, only one can be used to publish data under the same pusher instance. If, for example, startCamera is called first and then startVirtualCamera, the SDK will pause the publishing of camera data and start image publishing.public abstract int startScreenCapture();
V2TXLIVE_OK: successfulpublic abstract int stopScreenCapture();
V2TXLIVE_OK: successfulV2TXLIVE_OK is returned, you can get the screenshot taken in the V2TXLivePusherObserver.onSnapshotComplete callback.public abstract int snapshot();
V2TXLIVE_OK: successfulV2TXLIVE_ERROR_REFUSED: failed to take a screenshot because publishing has stopped.public abstract int setWatermark(Bitmap image, float x, float y, float scale);
Parameter | Type | Description |
image | Bitmap | Watermark image. If this parameter is null, it means watermarks are disabled. |
x | float | Horizontal coordinate of the watermark |
y | float | Vertical coordinate of the watermark |
scale | float | Scale ratio of the watermark image |
public abstract int setEncoderMirror(boolean mirror);
Parameter | Type | Description |
mirror | Boolean | Whether to mirror encoded images. Default value: false |
public abstract int enableCustomVideoCapture(boolean enable);
Parameter | Type | Description |
enable | Boolean | Whether to enable custom video capturing. Default value: false. |
public abstract int sendCustomVideoFrame(V2TXLiveVideoFrame videoFrame);
Parameter | Type | Description |
videoFrame | V2TXLiveVideoFrame | Video frame sent to the SDK |
V2TXLIVE_OK: successfulV2TXLIVE_ERROR_INVALID_PARAMETER: operation failed because the video data is invalid.V2TXLIVE_ERROR_REFUSED: failed. You must call enableCustomVideoCapture to enable custom video capturing first.public abstract int enableCustomVideoProcess(boolean enable, V2TXLivePixelFormat pixelFormat, V2TXLiveBufferType bufferType);
Parameter | Type | Description |
enable | Boolean | Whether to enable custom video processing. Default value: false |
pixelFormat | Pixel format of video frames | |
bufferType | Video data buffer type |
V2TXLivePixelFormat enumerated valuesValue | Description |
V2TXLivePixelFormatUnknown | Unknown |
V2TXLivePixelFormatI420 | YUV420P (I420) |
V2TXLivePixelFormatTexture2D | OpenGL 2D texture |
V2TXLiveBufferType enumerated valuesValue | Description |
V2TXLiveBufferTypeUnknown | Unknown |
V2TXLiveBufferTypeByteBuffer | DirectBuffer, which carries buffers in the format of I420 and others and is used at the native layer. |
V2TXLiveBufferTypeByteArray | byte[], which carries buffers in the format of I420 and others and is used at the Java layer. |
V2TXLiveBufferTypeTexture | Texture ID, which allows direct operation. It delivers the best performance and has the smallest impact on video quality. |
onReceiveSeiMessage callback in V2TXLivePlayerObserver.public abstract int sendSeiMessage(int payloadType, byte[] data);
Parameter | Type | Description |
payloadType | int | Data type. Valid values: 5, 242 (recommended) |
data | byte[] | Data to send |
V2TXLIVE_OK: successfulTXBeautyManager:public TXBeautyManager getBeautyManager()
public abstract int startMicrophone();
V2TXLIVE_OK: successfulpublic abstract int stopMicrophone();
V2TXLIVE_OK: successfulpublic abstract int setAudioQuality(V2TXLiveAudioQuality quality);
Parameter | Type | Description |
quality | V2TXLiveAudioQuality | Audio quality |
V2TXLiveAudioQuality enumerated valuesValue | Description |
V2TXLiveAudioQualitySpeech | Speech. Audio sample rate: 16 kHz; sound channel: mono; bitrate: 16 Kbps This is designed for speech-based call scenarios such as online conferencing and audio call. |
V2TXLiveAudioQualityDefault | Default. Audio sample rate: 48 kHz; sound channel: mono; bitrate: 50 Kbps This is the default audio quality of the SDK and is recommended. |
V2TXLiveAudioQualityMusic | Music. Audio sample rate: 48 kHz; sound channel: dual; bitrate: 128 Kbps This is designed for music-oriented scenarios with hi-fi requirements, such as karaoke and live music streaming. |
V2TXLIVE_OK: successfulV2TXLIVE_ERROR_REFUSED: you cannot change audio quality settings when streams are being published.V2TXLivePusherObserver#onMicrophoneVolumeUpdate(int) callback.public abstract int enableVolumeEvaluation(int intervalMs);
Parameter | Type | Description |
intervalMs | int | Interval (ms) for volume callbacks. The minimum interval allowed is 100 ms. If the value is 0 (default) or smaller, the callback is disabled. 300 is recommended. |
V2TXLIVE_OK: successfulTXAudioEffectManager:public TXAudioEffectManager getAudioEffectManager()
TXDeviceManager:public abstract TXDeviceManager getDeviceManager();
V2TXLivePusher.public abstract int setProperty(String key, Object value);
Parameter | Type | Description |
key | String | Key of the advanced API to call |
value | Object | Parameters required by the advanced API |
V2TXLIVE_OK: successfulV2TXLIVE_ERROR_INVALID_PARAMETER: operation failed because key is empty.public abstract int setMixTranscodingConfig(V2TXLiveTranscodingConfig config);
Parameter | Type | Description |
config | On-Cloud MixTranscoding configuration |
Value | Description |
V2TXLiveBufferTypeUnknown | Unknown |
V2TXLiveBufferTypeByteBuffer | DirectBuffer, which carries buffers in the format of I420 and others and is used at the native layer. |
V2TXLiveBufferTypeByteArray | byte[], which carries buffers in the format of I420 and others and is used at the Java layer. |
V2TXLiveBufferTypeTexture | Texture ID, which allows direct operation. It delivers the best performance and has the smallest impact on video quality. |
public abstract void showDebugView(boolean isShow);
Parameter | Type | Description |
isShow | boolean | Whether to display the dashboard. Default value: false |
Feedback