All Products
Search
Document Center

Apsara Video SDK:Integrate Queen SDK for Android

Last Updated:Mar 22, 2024

Queen SDK is a smart retouching SDK developed by the video cloud team of Alibaba. This SDK provides a wide range of features including image retouching, face retouching, chroma key, stickers, makeup, gesture recognition, body shaping, hairdressing, and augmented reality (AR) writing. You can use these features in live streaming, video conferencing, and short video production scenarios. This topic describes how to integrate Queen SDK for Android to help you implement retouching features.

Prerequisites

A development environment is set up. The following table describes the requirements for the development environment.

Item

Description

Android

Android 4.3 or later.

Java

Java 1.7 or later.

API LEVEL

Android API level 18 or later.

Android Studio

Android Studio 2.3 or later. To download Android Studio, visit Android Studio.

Integrate the SDK by using Maven dependencies

  1. Add the Alibaba Cloud Maven repository to the build.gradle file of your project.

    allprojects {
     repositories {
     google()
     jcenter()
     maven { url "https://maven.aliyun.com/repository/releases" }
     }
    }
  2. Add Queen SDK dependencies to the build.gradle file of your application.

    // The Queen SDK package.
    implementation "com.aliyun.maliang.android:queen:6.1.0-official-pro"
    
    // Optional. The menu component of Queen SDK.
    implementation "com.aliyun.maliang.android:queen_menu:6.1.0-official-pro-tiny" // Download the menu resources.
    implementation "com.aliyun.maliang.android:queen_menu:6.1.0-official-pro" // Package the menu resources on your on-premises machine.
Note

The libraries of retouching features and the libraries of Alibaba Cloud SDKs such as Alibaba Cloud Real-Time Communication (RTC) SDK may contain duplicate files. As a result, your application may fail to be packaged. In this case, add the packagingOptions parameter to the build.gradle file of your project to avoid file conflicts, as shown in the following code. If no duplicate files exist, you do not need to add this parameter.

android { 
 ...
 compileSdkVersion ... 
 ...
 packagingOptions {
 pickFirst '**/libMNN.so' // If duplicate libMNN.so files exist, add this line of code.
 pickFirst '**/libMNN_CL.so' // If duplicate libMNN_CL.so files exist, add this line of code.
 pickFirst '**/libc++_shared.so' // If duplicate libc++_shared.so files exist, add this line of code.
 }
 ...
}

Integrate the SDK by importing .aar files

  1. Download the Queen SDK package and decompress the package.

  2. Copy the .aar files extracted from the SDK package to the libs folder of your project.

Configure the license

Make sure that you have obtained a license for Queen SDK in advance. For more information, see Obtain a license of Queen SDK. After you obtain a license, perform the following operations to configure the license key and license file in your project:

Note
  • If you integrate Queen SDK of ApsaraVideo Live and the short video SDK of ApsaraVideo VOD at the same time, the two SDKs use the same license key and license file. You need to configure the license only once. Take note that the latest license file must be used.

  • If the SDK that you purchase is updated or needs to be renewed, you must also update the license. Perform the following steps to update the license:

    1. Obtain the latest license. For more information, see Obtain a license of Queen SDK.

    2. After you obtain the latest license, configure the license again.

Import the license to the assets folder of your project, and then add two meta-data entries under the application node in the AndroidManifest.xml file. The following sample code provides an example:

com.aliyun.alivc_license.licensekey is the metadata entry that specifies the license key.

<application
 android:icon="@drawable/icon"
 android:label="@string/app_name" >
 <meta-data
 android:name="com.aliyun.alivc_license.licensekey" 
 android:value="Your LicenseKey"/> // Enter the license key that you obtain.
 <meta-data
 android:name="com.aliyun.alivc_license.licensefile"
 android:value="Your LicenseFile Path"/> // Enter the path of the license file relative to the assets folder. Example: alivc_license/AliVideoCert.crt.
 ...
</application>

References

Item

References

Sample project

Sample project

In the sample project, the assets folder contains all the image resources of the demo.

Demo project on GitHub

Demo project

The demo project provides integration examples of the following SDKs: Alibaba Cloud Push SDK, Qiniu Cloud Live Video Cloud SDK, and Tencent Real-Time Communication SDK.

Quick start

Quick start package

The quick start package improves the efficiency of integrating Queen SDK. You can use the latest version of the quick start package to integrate the latest version of Queen SDK. The quick start package also provides guidance to help you troubleshoot common issues.

Code for integration with SDKs from common vendors