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.V2TXLivePusher(V2TXLiveMode liveMode)
Parameter | Type | Description |
liveMode | V2TXLiveMode | Publishing protocol: RTMP (default) or ROOM |
V2TXLivePusher, including publisher status, volume, statistics, warning and error messages, etc.void addListener(V2TXLivePusherObserver func)
Parameter | Type | Description |
observer | V2TXLivePusherObserver |
Future<V2TXLiveCode> setRenderViewID(int viewID)
Parameter | Type | Description |
viewID | int | The view ID, which is returned by V2TXLiveVideoWidget.onViewCreated(int viewID). |
V2TXLIVE_OK: successfulFuture<V2TXLiveCode> startPush(String url)
Parameter | Type | Description |
url | String | The 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: you cannot use the same stream ID for publishing and playback on the same device.Future<V2TXLiveCode> stopPush()
V2TXLIVE_OK: successfulFuture<V2TXLiveCode> isPushing()
1: yes0: noFuture<V2TXLiveCode> setVideoQuality(V2TXLiveVideoEncoderParam param)
Parameter | Type | Description |
param | Video encoding parameters |
Future<V2TXLiveCode> setRenderRotation(V2TXLiveRotation rotation)
Parameter | Type | Description |
rotation | The 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 |
Future<V2TXLiveCode> setRenderMirror(V2TXLiveMirrorType mirrorType)
Parameter | Type | Description |
mirrorType | The 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 APIs are mutually exclusive when you use them with the same pusher instance. For example, if you call startCamera first and then call startVirtualCamera, the SDK will stop publishing camera data and publish an image instead.Future<V2TXLiveCode> startCamera(bool frontCamera)
V2TXLIVE_OK: successfulFuture<void> stopCamera()
V2TXLIVE_OK: successfulstartVirtualCamera, startCamera, and startScreenCapture APIs are mutually exclusive when you use them with the same pusher instance. For example, if you call startCamera first and then call startVirtualCamera, the SDK will stop publishing camera data and publish an image instead.Future<V2TXLiveCode> startVirtualCamera(String type, String imageUrl)
V2TXLIVE_OK: successfulParameter | Type | Description |
type | String | Valid values: network (an image from the internet), file (a local image). |
imageUrl | String | Image URL |
Future<V2TXLiveCode> stopVirtualCamera()
V2TXLIVE_OK: successfulstartVirtualCamera, startCamera, and startScreenCapture APIs are mutually exclusive when you use them with the same pusher instance. For example, if you call startCamera first and then call startVirtualCamera, the SDK will stop publishing camera data and publish an image instead.enableCustomVideoCapture to enable custom capturing. sendCustomVideoFrame to send the screen images captured by Broadcast Upload Extension.Future<V2TXLiveCode> startScreenCapture(String appGroup)
Parameter | Type | Description |
appGroup | String | The App Group ID shared by the host app and Broadcast Upload Extension. You can set it to nil, but for better reliability, we recommend you set it as instructed in our documentation. |
V2TXLIVE_OK: successfulFuture<V2TXLiveCode> stopScreenCapture()
V2TXLIVE_OK: successfulV2TXLIVE_OK is returned, you can get the screenshot taken in the V2TXLivePusherObserver.onSnapshotComplete callback.Future<V2TXLiveCode> snapshot()
V2TXLIVE_OK: successfulV2TXLIVE_ERROR_REFUSED: failed to take a screenshot because publishing has stopped.Future<V2TXLiveCode> setWatermark(String type, String image, double x,double y, double scale)
Parameter | Type | Description |
type | String | Valid values: network (an image from the internet), file (a local image). |
image | String | Image URL |
x | double | Watermark coordinate |
y | double | Watermark coordinate |
scale | double | Percentage by which the image is resized |
Future<V2TXLiveCode> setEncoderMirror(bool mirror)
Parameter | Type | Description |
mirror | Boolean | Whether to mirror encoded images. Default value: false. |
Future<V2TXLiveCode> enableCustomVideoCapture(bool enable)
Parameter | Type | Description |
enable | bool | Whether to enable custom video capturing. Default value: false. |
Future<V2TXLiveCode> sendCustomVideoFrame(V2TXLiveVideoFrame videoFrame)
Parameter | Type | Description |
videoFrame | V2TXLiveVideoFrame | Video frames 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.Future<V2TXLiveCode> enableCustomVideoProcess(bool enable,V2TXLivePixelFormat pixelFormat, V2TXLiveBufferType bufferType)
Parameter | Type | Description |
enable | bool | Whether to enable custom video processing. Default value: false. |
pixelFormat | V2TXLivePixelFormat | Pixel format of video frames |
bufferType | V2TXLiveBufferType | Buffer type of video data |
V2TXLivePixelFormat enumerated valuesValue | Description |
v2TXLivePixelFormatUnknown | Unknown |
v2TXLivePixelFormatI420 | YUV420P (I420) |
v2TXLivePixelFormatTexture2D | OpenGL 2D texture |
V2TXLiveBufferType enumerated valuesValue | Description |
v2TXLiveBufferTypeUnknown | Unknown |
v2TXLiveBufferTypeByteBuffer | Direct buffers. This type is for I420 and other buffers and is used at the native layer. |
v2TXLiveBufferTypeByteArray | Byte arrays. This type is for I420 and other buffers 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 of V2TXLivePlayerObserver.Future<V2TXLiveCode> sendSeiMessage(int payloadType, Uint8List data)
Parameter | Type | Description |
payloadType | int | Data type. Valid values: 5, 242 (recommended). |
data | Uint8List | Data to be sent |
V2TXLIVE_OK: successfulTXBeautyManager getBeautyManager()
Future<V2TXLiveCode> startMicrophone()
V2TXLIVE_OK: successfulFuture<V2TXLiveCode> stopMicrophone()
V2TXLIVE_OK: successfulFuture<V2TXLiveCode> 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 call scenarios such as online conferencing and audio calls. |
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 callback.Future<V2TXLiveCode> 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:TXAudioEffectManager getAudioEffectManager()
TXDeviceManager:TXDeviceManager getDeviceManager()
V2TXLivePusher.Future<V2TXLiveCode> setProperty(String key, String value)
Parameter | Type | Description |
key | String | Key of the advanced API to call |
value | String | Parameters required by the advanced API |
V2TXLIVE_OK: successfulV2TXLIVE_ERROR_INVALID_PARAMETER: operation failed because key is empty.Future<V2TXLiveCode> setMixTranscodingConfig(V2TXLiveTranscodingConfig? config)
Parameter | Type | Description |
config | V2TXLiveTranscodingConfig | On-Cloud MixTranscoding configuration |
Value | Description |
v2TXLiveBufferTypeUnknown | Unknown |
v2TXLiveBufferTypeByteBuffer | Direct buffers. This type is for I420 and other buffers and is used at the native layer. |
v2TXLiveBufferTypeByteArray | Byte arrays. This type is for I420 and other buffers 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. |
Future<V2TXLiveCode> showDebugView(bool isShow)
Parameter | Type | Description |
isShow | bool | Whether to display the dashboard. Default value: false. |
Feedback