Using the retouching plugin

更新时间:
复制 MD 格式

ApsaraVideo Real-time Communication (ARTC) uses plug-ins to provide audio and video enhancement capabilities and special effects. You can download plug-ins from the Publish logs topic. For information about how to integrate the Queen SDK plug-in into the RTC engine, see Integration.

Enable the retouching plugin

For more information about the Queen SDK, see Obtaining the Queen SDK License.

enablePlugin(plug-in instance, initialization parameters)

import AliRtcBeautyPlugin from 'aliyun-rtc-sdk/dist/plugins/beautyPlugin';

aliRtcEngine.enablePlugin(
  new AliRtcBeautyPlugin(),
  {
    /** The license key for the Queen SDK. */
    licenseKey: '',
    /** The basic retouching settings. */
    basicBeauty: {
      /** The skin whitening coefficient. */
      whitening: 1,
    },
  }
);

Configure plug-in parameters

setPluginOption(plug-in name, plug-in parameters)

/** Configure background bokeh. */
aliRtcEngine.setPluginOption(  
  'AliRtcBeauty',
  {
    segmentBackgroundProcess: {
      enable: true,
      type: 0,
    },
  },
);

/** Configure background replacement. */
aliRtcEngine.setPluginOption(
  'AliRtcBeauty',
  {
    setSegmentBackgroundImage: {
      backgroundImgUrl:
        'https://img.alicdn.com/imgextra/i1/O1CN01vZZv8a1NCA0JTSY0j_!!6000000001533-2-tps-600-648.png',
    },
  },
);

Obtain plug-in parameters

aliRtcEngine.getPluginOption(
  /** Parameter 1: plug-in name. */
  'AliRtcBeauty',
)

Remove the plug-in

aliRtcEngine.removePlugin(
  /** Parameter 1: plug-in name. */
  'AliRtcBeauty',
)