Skip to main content

Hive

This page introduces how to use Hive Visual Moderation API in Agora SDK to empower your app with accurate content moderation for live video streams.

Hive Visual Moderation API and Agora SDK work together as follows:

  1. When enableContentInspect is called, Agora SDK takes screenshots of the local user's video and uploads the screenshots to the Agora server.
  2. Agora server sends the screenshots to Hive Visual Moderation API.
  3. Hive returns the classification result of the local user's video to the callback URL specified in enableContentInspect.

Prerequisites

Integrate Hive Visual Moderation API

1. Client-side: Enable content moderation

To use Hive Visual Moderation API in Agora SDK, you need to call the enableContentInspect method.

You can use the following sample code:


_10
ContentInspectConfig config = new ContentInspectConfig();
_10
config.extraInfo = "try Hive";
_10
config.moduleCount = 1;
_10
config.ContentWorkType = ContentInspectConfig.CONTENT_INSPECT_TYPE_WORK_DEVICE_CLOUD;
_10
config.DeviceWorkType = ContentInspectConfig.CONTENT_INSPECT_DEVICE_AGORA;
_10
config.modules[0].type = ContentInspectConfig.CONTENT_INSPECT_TYPE_MODERATION; // Be sure to set type as MODERATION
_10
config.modules[0].vendor = ContentInspectConfig.CONTENT_INSPECT_VENDOR_HIVE; // Set Hive as the content moderation service provider
_10
config.modules[0].callbackUrl = "Add your callback URL"; // Add the URL to receive the callbacks sent from Hive
_10
config.modules[0].frequency = 2; // Set content moderation to run every 2 seconds
_10
mRtcEngine.enableContentInspect(true, config);

2. Server-side: Receive HTTP response from Hive

After Agora server sends the screenshots to Hive, Hive returns the results to your callback URL in the form of an HTTP response. For full details, see Hive response formats.

Reference

Hive configuration email

Your email must include the following information:

NameDescription
AppIdAgora App ID
desc(Optional) Description of your project
callback_urlYour callback URL to receive classification results from Hive
moderation_upload_policySet it to one of the following:
  • Any combination of "porn", "sexy", and "neutral". For example: ["porn", "sexy"] means to save screenshots classified as "porn" or "sexy".
  • [""], which means do not save any screenshot. Agora does not recommend this option because you would not be able to verify the classification results.
  • oss_vendor(Optional) If moderation_upload_policy is not [""], set it to "aws" or "aliyun", and provide your OSS configuration (see below).

    OSS configuration

    • If your OSS provider is AWS:
      KeyDescription
      aws_oss_access_key_idAWS AccessKeyId
      aws_oss_access_key_secretAWS AccessKeySecret
      aws_oss_bucket_nameAWS bucket name. See Bucket
      aws_oss_endpointAWS endpoint. See Endpoint
      aws_oss_fileName_prefixBucket folder path prefix delimited by "/"
      aws_oss_regionAWS region. See Region
    • If your OSS provider is Aliyun:
      KeyDescription
      aliyun_oss_access_key_idAliyun AccessKeyId
      aliyun_oss_access_key_secreAliyun AccessKeySecret
      aliyun_oss_bucket_nameAliyun OSS bucket name. See Bucket
      aliyun_oss_endpointAliyun endpoint. See Endpoint
      aliyun_oss_fileName_prefixBucket folder path prefix delimited by "/"

    The following is an example of the configuration e-mail:


    _15
    Title:
    _15
    Hive Extension Activation Request
    _15
    _15
    Body:
    _15
    AppId: 12345678
    _15
    desc: Video conference moderation results
    _15
    callback_url: https://webhook.site/moderation-results
    _15
    moderation_upload_policy: ["porn", "sexy"]
    _15
    oss_vendor: aws
    _15
    aws_oss_access_key_id: 12345678
    _15
    aws_oss_access_key_secret: abcd123
    _15
    aws_oss_bucket_name: moderated-pictures
    _15
    aws_oss_endpoint: s3.cn-north-1.amazonaws.com.cn
    _15
    aws_oss_region: cn-north-1
    _15
    aws_oss_fileName_prefix: compliance/content-moderation/

    Page Content