Talk to us
Talk to us
menu

Blog Post

start building
Developer

How to Choose Avatar SDK for Developers

How to Choose Avatar SDK for Developers

A user’s presence in the metaverse can be represented through their avatar, effectively a manifestation of the individual. The avatar’s appearance can be changed to virtually anything you can think of. There is a possibility that it will seem precisely the same as you do in the real world. Or the appearance of your avatar could be altered. 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. 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. 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 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, specialized consulting services, and one-on-one VIP technical support to meet a wide range of customer demands. Creating a Virtual Avatar with 3D avatar SDK on an iOS device can be done in the following steps.

There are three steps before going onto the main page:

  • Please navigate the ZEGOCLOUD Admin Console to acquire your project’s appID and app 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

  • 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.

  • 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. Keep an eye out for the on-state change callback to ensure that you are notified of important event alerts regarding the startup state.

  • Create a virtual 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.

- (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 services have been used by more than 200 countries and regions, 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.

There are three steps before going onto the main page:

  • Please navigate the ZEGOCLOUD Admin Console to acquire your project’s appID and app 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

  • 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 its 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, which is the Gradle package name for AppID.

  • 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.

  • 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. To receive relevant event alerts for the initialization state, keep an eye out for the onStateChange callback.

After importing the scripts, call the init function and present the newly acquired authentication license to start the AvatarService. Keep an eye out for the on-state change callback to ensure that you are notified of important event notifications regarding the initialization state.

  • 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 by utilizing the most advanced cloud communication technologies as the best avatar SDK alternative to Twilio. 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.

ZEGOCLOUD
ZEGOCLOUD With our fully customizable and easy-to-integrate Live SDK, you can quickly build reliable, scalable, and interactive live streaming into your mobile, web, and desktop apps.

Related posts

Contact us