Talk to us
Talk to us
menu

How to Choose Avatar SDK for Developers

How to Choose Avatar SDK for Developers

Avatar SDK allows users to automatically construct 3D representations of themselves that are recognizably based on their images.

Best Avatar SDK for Metaverse is Now Available

ZEGOCLOUD AI and computer graphics experts want to let everyone look and feel like they’re in a virtual environment. Its Avatar SDK can turn selfies into lifelike avatars. Therefore, OpenCV’s designers founded ZEGOCLOUD to train deep neural networks. These networks create your 3D avatar for metaverses, games, and other 3D experiences.

Virtual avatars combine virtual reality with the natural world using AI-powered facial expression mirroring, speech simulation, hand gesture detection, and body position identification. As a result, these technologies let people organically express emotions in virtual settings.

Features

  • automatic creation of avatars
  • Manually creating avatars
  • Styles and clothing
  • mirroring of facial expressions
  • Language simulation
how to use avatar sdk

How to Create a Virtual Avatar for iOS

ZEGOCLOUD is committed to increasing the value of its services by utilizing innovative cloud communication technology. During product delivery, it provides the fundamental technical assistance required for integration and development, and specialized consulting services. Additionally, one-on-one VIP technical support to meet a wide range of customer demands.

Three steps before going onto the main page:

  • Please navigate the ZEGOCLOUD Admin Console to acquire your project’s appID and Sign.
  • Indicate the userID and userName for the Call Kit service to connect correctly.
  • To make the call, you wish to make, you must first create a callID.

Implementation

1: Request Authentication

ZEGO Avatar gets the license file online. First, give ZegoAvatar exclusive usage of everything. Create a project in the ZEGOCLOUD Admin Console after you have permission. Contact ZEGOCLOUD’s technical support to enable the required privileges and provide your project’s Bundle ID. Find the reference code afterward. You can find a sample source code in the SDK’s LicenseHelper subdirectory. Edit ZegoAvatarConfig.h. Format your AppID and AppSign. Install needed libraries. Obtaining the authentication license requires a network call through the ZGAvatarLicenseHelper API.

2: Initialize Avatar Service

Before running the AvatarService, ensure that the header file has been imported. To construct the AvatarService, after importing the header files and supplying the obtained authentication license, you must first call the initWithConfig method. Watch for the on-state change callback to ensure you are notified of important event alerts regarding the startup state.

3: Create a virtual avatar

After the AvatarService has been initialized, you must construct a ZegoCharacterHelper object. Add appearance data for the virtual avatar by including things like facial features, clothing materials, and cosmetics, and configure view parameters by having something like width, height, and position.

- (void) initAvatar{
    // Create a ZegoCharacterHelper class and introduce the basic resource path.
    NSString *resourcePath = [[[NSBundle mainBundle] bundlePath] stringByAppendingString:@"/assets/base.bundle"];
    _characterHelper = [[ZegoCharacterHelper alloc] init:resourcePath];

    // Set the resource package address. If resources are downloaded dynamically, introduce the target directory for downloading.
    NSString *packagesPath = [[[NSBundle mainBundle] bundlePath] stringByAppendingString:@"/assets/Packages"];
    [_characterHelper setExtendPackagesPath:packagesPath];

    // Use the default avatar. The male role is used as an example.
    [_characterHelper setDefaultAvatar:MODEL_ID_MALE];
    /// Create AvatarView.
    _avatarView = [[ZegoAvatarService sharedInstance] createAvatarView:CGRectMake(0, 0, 200, 200)];
    [self.view addSubview:_avatarView];
    // Display the avatar on the screen.
    [_characterHelper setCharacterView:_avatarView];
}

How to Create a Virtual Avatar for Android

ZEGOCLOUD’s high-quality avatar maker services have been used by more than 200 countries and regions. Thus, earning the trust and satisfaction of several top clients in the social, gaming, live streaming, finance, education, medical, and intelligent hardware domains. ZEGOCLOUD’s services have also been praised for their affordability.

A Virtual Avatar with meta avatar SDK on an Android device can be done by following these instructions.

Three steps before going onto the main page:

  • Please navigate the ZEGOCLOUD Admin Console to acquire your project’s appID and Sign.
  • Indicate the userID and userName for the Call Kit service to connect correctly.
  • To make the call, you wish to make, you must first create a callID.

Steps for implementation

1: Apply for authentication

Start authentication. Online authentication lets ZEGO Avatar get the licensing file. First, set ZegoAvatar to on. Next, build a project in the ZEGOCLOUD Admin Console and get it AppID and AppSign. Contact ZEGOCLOUD’s technical support with your project’s package name. This grants the rights. Next, copy the sample source code from the SDK downloads, im.zego.zegoavatarexample.licensehelper, into your project. Then Import libraries. Edit ZegoAvatarConfig.java. Enter the right AppID and AppSign. The example code can’t be changed. applicationId can be updated under the app directory, the Gradle package name for AppID.

2: Get the license

To acquire the authentication license at this stage, you must initiate a network request using the get license API provided by ZegoLicenseHelper.

3: Start the ZegoAvatarService:

Before you can proceed with starting the AvatarService, you will need to import the scripts listed below at this stage.  

import com.zego.avatar.OnRecordStartCallback;
import com.zego.avatar.OnRecordStopCallback;
import com.zego.avatar.ZegoAvatarService;
import com.zego.avatar.ZegoAvatarView;
import com.zego.avatar.bean.ZegoGenderType;
import com.zego.avatar.bean.ZegoAvatarQualityLevel;
import com.zego.avatar.bean.ZegoAvatarServiceState;
import com.zego.avatar.bean.ZegoExpressionDetectMode;
import com.zego.avatar.bean.ZegoModelType;
import com.zego.avatar.bean.ZegoServiceConfig;

Call the init method after importing the codes, then introduce the acquired authentication license to start the AvatarService. Watch for the callback to receive relevant event alerts for the initialization state.

Consequently, call the init function and present the newly acquired authentication license to start the AvatarService. Watch for the on-state change callback to ensure you are notified of important event notifications regarding the initialization state.

4: Make a digital avatar.

After the AvatarService has been initialized, you will need to construct a ZegoCharacterHelper object, add appearance data for the virtual avatar by including things like facial features, clothing materials, and cosmetics, and configure view parameters by having something like width, height, and position. This will allow you to create a virtual avatar. You can create a digital persona using the services offered by ZEGOCLOUD, which are of the highest quality.


public class AvatarMainActivity extends BaseActivity implements ZegoAvatarServiceDelegate {
    private ZegoAvatarView mZegoAvatarView;
    private IZegoInteractEngine mZegoInteractEngine;
    private ZegoCharacterHelper mCharacterHelper;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // Wait for ZegoAvatarService initialization to complete.
        ZegoAvatarService.addServiceObserver(this);
        mZegoAvatarView = findViewById(R.id.zego_avatar_view);
    }
    @Override
    public void onStateChange(ZegoAvatarServiceState state) {
    if (state == ZegoAvatarServiceState.InitSucceed) {
            AvatarMainActivity.this.runOnUiThread(() -> {
                // Create a ZegoCharacterHelper class to simply the implementation process for API call.
                mCharacterHelper = new ZegoCharacterHelper(getFilesDir().getAbsolutePath() + "/assets/base.bundle"); // The absolute path of basic resources.

                mCharacterHelper.setExtendPackagePath(getFilesDir().getAbsolutePath() + "/assets/Packages"); // Set the directory where the makeup, hair, glass, and other resource packages are stored.
                // Set the default avatar. The options include "male" and "female".
                mCharacterHelper.setDefaultAvatar("female");
                // Display the avatar on the screen and call the API on a UI thread.
                mCharacterHelper.setCharacterView(mZegoAvatarView);
                // Create the facial expression mirroring model.
                // !!! Note: Obtain the camera or voice permission from users if required.
                mZegoInteractEngine = ZegoAvatarService.getInteractEngine();
                if (mZegoInteractEngine != null) {
                    // Enable facial expression mirroring.
                    mZegoInteractEngine.startDetectExpression(ZegoExpressionDetectMode.Camera,expression -> {
                        zegoCharacter.setExpression(expression);
                    });
                }
            });
            ZegoAvatarService.removeServiceObserver(this);
        }
    }
}

Conclusion

ZEGOCLOUD is committed to increasing the value of its services for making an avatar by utilizing the most advanced cloud communication technologies as the best mete avatar SDK. To satisfy various needs, it provides high-quality consulting services and personalized VIP technical assistance while providing essential development and technical integration assistance during product delivery.

Read More

Talk to Expert

Learn more about our solutions and get your question answered.

Talk to us

Take your apps to the next level with our video APIs

Free Trial
  • 10,000 minutes for free
  • 4,000+ corporate clients
  • 3 Billion daily call minutes

Stay updated with us by signing up for our newsletter!

Don't miss out on important news and updates from ZEGOCLOUD!

* You may unsubscribe at any time using the unsubscribe link in the digest email. See our privacy policy for more information.