enableVirtualBackground method

FutureOr<int> enableVirtualBackground(
  1. NSString backgroundStickerPath,
  2. ByteRTCVirtualBackgroundSource source
)

@detail api @author zhushufan.ref @brief 将摄像头采集画面中的人像背景替换为指定图片或纯色背景。 @param backgroundStickerPath 背景贴纸特效素材绝对路径。 @param source 背景贴纸对象,参看 ByteRTCVirtualBackgroundSource{@link #ByteRTCVirtualBackgroundSource}。 @return - 0: 调用成功。 - –1000: 未集成特效 SDK。 - –1001: 特效 SDK 不支持该功能。 - –1002: 特效 SDK 版本不兼容。 - < 0: 调用失败,错误码对应具体描述参看 错误码表。 @note - 调用本方法前,必须先调用 initCVResource:withAlgoModelDir:{@link #ByteRTCVideoEffect#initCVResource:withAlgoModelDir} 进行初始化。 - 调用 disableVirtualBackground{@link #ByteRTCVideoEffect#disableVirtualBackground} 关闭虚拟背景。

Implementation

FutureOr<int> enableVirtualBackground(NSString backgroundStickerPath,
    ByteRTCVirtualBackgroundSource source) async {
  return await nativeCall(
      'enableVirtualBackground:withSource:', [backgroundStickerPath, source]);
}