enableAlphaChannelVideoEncode method
@valid since 3.58
@detail api
@hiddensdk(audiosdk)
@region Video Management
@brief Enables the Alpha channel encoding feature for custom captured video frames.
Suitable for scenarios where the video subject and background need to be separated at the push stream end, and the background can be custom rendered at the pull stream end.
@param alphaLayout The relative position of the separated Alpha channel to the RGB channel information. Currently, only AlphaLayout.TOP is supported, which means it is placed above the RGB channel information.
@return Method call result:
- 0: Success.
- < 0: Failure. See ReturnStatus{@link #ReturnStatus} for more details.
@note
- This API only applies to custom captured video frames that use the RGBA color model, including VideoPixelFormat.TEXTURE_2D, VideoPixelFormat.TEXTURE_OES, VideoPixelFormat.RGBA.
- This API must be called before publishing the video stream.
- After calling this API to enable Alpha channel encoding, you must call pushExternalVideoFrame{@link #RTCEngine#pushExternalVideoFrame} to push the custom captured video frames to the RTC SDK. If a video frame format that is not supported is pushed, calling pushExternalVideoFrame{@link #RTCEngine#pushExternalVideoFrame} will return the error code ReturnStatus.RETURN_STATUS_PARAMETER_ERR.
Implementation
Future<int?> enableAlphaChannelVideoEncode(
{required AlphaLayout alphaLayout}) async {
$a() => ($instance as $p_a.RTCEngine).enableAlphaChannelVideoEncode(
t_AlphaLayout.code_to_android(alphaLayout));
$i() => ($instance as $p_i.ByteRTCEngine)
.enableAlphaChannelVideoEncode(t_AlphaLayout.code_to_ios(alphaLayout));
if (Platform.isAndroid) {
return $a();
} else if (Platform.isIOS) {
return $i();
} else {
throw UnsupportedError(
'Not Support Platform ${Platform.operatingSystem}');
}
}