enableAlphaChannelVideoEncode method
@hidden(macOS)
@valid since 3.58
@detail api
@author zhuhongshuyu
@brief 开启自定义采集视频帧的 Alpha 通道编码功能。
适用于需要分离推流端视频主体与背景,且在拉流端可自定义渲染背景的场景。
@param alphaLayout 分离后的 Alpha 通道相对于 RGB 通道信息的排列位置。当前仅支持 ByteRTCAlphaLayout.ByteRTCAlphaLayoutTop,即置于 RGB 通道信息上方。
@return 方法调用结果:
- 0: 调用成功。
- < 0 : 调用失败。查看 ByteRTCReturnStatus{@link #ByteRTCReturnStatus} 获得更多错误说明。
@note
- 该接口仅作用于自定义采集的 ByteRTCVideoPixelFormat.ByteRTCVideoPixelFormatCVPixelBuffer 格式视频帧。
- 该接口须在发布视频流之前调用。
- 调用本接口开启 Alpha 通道编码后,你需调用 pushExternalVideoFrame:{@link #ByteRTCEngine#pushExternalVideoFrame} 把自定义采集的视频帧推送至 RTC SDK。若推送了不支持的视频帧格式,则调用 pushExternalVideoFrame:{@link #ByteRTCEngine#pushExternalVideoFrame} 时会返回错误码 ByteRTCReturnStatus.ByteRTCReturnStatusParameterErr。
Implementation
FutureOr<int> enableAlphaChannelVideoEncode(
ByteRTCAlphaLayout alphaLayout) async {
return await nativeCall(
'enableAlphaChannelVideoEncode:', [alphaLayout.$value]);
}