Digital Human Streaming Service Android SDK

Updated at:

The Digital Human Open Platform provides a streaming media software development kit (SDK) for Android. After you call the server-side OpenAPI StartInstance operation to obtain Real-Time Communication (RTC) and Instant Messaging (IM) parameters, you can build an Android app to pull digital human streams and enable two-way conversations. The AliyunAvatarSDK subscribes to video streams through Android RTC Real-Time Communication (DingRTC) and establishes an IM connection with the server-side using the standard WebSocket.

SDK 1.2.2 upgrade notes

This version upgrades AliRTC to DingRTC. The main changes are as follows:

Important
  • After you upgrade to version 1.2.2, the SDK automatically selects hardware or software decoding based on the device model. External decoding parameters no longer have any effect.

  • After you upgrade to version 1.2.2, the transparent background (image matting) feature is no longer available. You can retrieve video frames and then use a custom renderer to perform image matting.

  • Before you upgrade to version 1.2.2, you must manually restart the 3D digital human streaming media instance in the console to prevent authentication failures.

Prerequisites

  1. The SDK does not include operations for server-side instances, such as starting a digital human, stopping a digital human, or broadcasting text. For these features, see the OpenAPI documentation.

  2. The Demo requires a backend application to run. Make sure you have a backend application that can call OpenAPI operations.

  3. Limits:

    1. System version: Android 6.0 (API level 23) and later.

    2. CPU architecture: armeabi-v7a and arm64-v8a.

Integration method

  1. Download the digital human sample project. The SDK AAR package is `libs/AliyunAvatarSDK_1.2.2.aar` in the sample project.

  2. Import the SDK integration dependencies.

  3. Obtain the required device permissions.

Integrate the SDK

  1. To use the SDK in your project, place the downloaded `AliyunAvatarSDK.aar` file into the `libs` folder of your app module. Then, add the import statement to the `app/build.gradle` file.

implementation fileTree(include the following: ['*.aar'], dir: 'libs')
  1. In the `build.gradle` file of the root directory, add the Maven repository address:

allprojects {
  repositories {
    google()
    jcenter()
    // Add the following Maven address
    maven {
      url "http://maven.aliyun.com/nexus/content/groups/public/"
    }
  }
}
  1. The AliyunAvatarSDK depends on the OkHttp, DingRTC, and fastjson libraries. Manually import these dependencies.

implementation 'com.squareup.okhttp3:okhttp:4.4.1'
implementation 'com.alibaba:fastjson:1.2.83'
implementation 'com.ding.rtc:dingrtc-full:3.7.5'
  1. In the `app/src/main/AndroidManifest.xml` file, add the following code to obtain the required device permissions.

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/> 
Important
  1. For sensitive permissions, such as `Manifest.permission.WRITE_EXTERNAL_STORAGE` and `Manifest.permission.RECORD_AUDIO`, you must call the `requestPermissions` method of the Activity in your code to obtain runtime permissions.

  2. For devices that run Android S and later, you must also dynamically request the `Manifest.permission.BLUETOOTH_CONNECT` permission to ensure that RTC initializes correctly.

  3. In your app's Privacy Policy, inform users that you use the DingRTC service. For more information, see https://terms.aliyun.com/legal-agreement/terms/suit_bu1_ali_cloud/suit_bu1_ali_cloud202112151438_20307.html?spm=a2c4g.11186623.0.0.49fd18678NSHPJ

  1. Optional: Configure obfuscation rules.

In the `proguard-rules.pro` file, add -keep class configurations to prevent the obfuscation of public class names in the RTC SDK.

-keep class com.serenegiant.**{*;}
-keep class org.webrtc.**{*;}
-keep class com.ding.rtc.**{*;}
-keep class com.alivc.**{*;}
-keep class com.aliyun.avatarsdk.**{*;}

Interactive digital human

Create an instance

AvatarSDK avatarSDK = AvatarSDK.createDialogAvatarInstance(context,
                                            avatarSDKListener, 
                                            avatarInstanceInfo, 
                                            options);

Parameters

Parameter

Type

Required

Description

context

Context

Yes

The context of the Android Activity.

avatarSDKListener

AvatarSDKListener

Yes

The SDK status callback. For more information, see the "Callbacks and listeners" section.

avatarInstanceInfo

AvatarInstanceInfo

Yes

The basic configuration information for building the Avatar instance. For the complete list of parameters, see AvatarInstanceInfo.

options

AvatarOptions

No

Custom configuration information, including the WebSocket address and audio 3A algorithm settings. For the complete list of parameter settings, see AvatarOptions.

AvatarInstanceInfo

The basic information of the digital human application. You can obtain the parameters from the Digital Human Open Platform - Developer Information page.

Name

Type

Required

Description

Sample value

tenantId

String

Yes

The tenant ID.

10000

appId

String

Yes

The application ID.

1234ab56cd

sessionId

String

Yes

The session ID.

123a567b-8d9e-0fgh-ab1c-2345de6f7efg

token

String

Required when you create an interactive digital human instance.

The authentication token. This is the token returned by the `StartInstance` operation, not the token in the channel.

0202e9b8cf531740ac782e4c35e06c795941e88941e3ae1e46ec61c1fbf58a3a

channel

object

Yes

The Web Real-Time Communication (WebRTC) authentication information. For more information, see Channel.

Channel

The authentication information required by DingRTC. You can obtain all parameters by calling the StartInstance operation.

Name

Type

Required

Description

Example

channelId

String

Yes

The channel ID.

108293819

token

String

Yes

The DingRTC token.

e59f61b2482b4d0562ab542da3f824f7

appId

String

Yes

The DingRTC application ID.

ONEX7E28C7C221854

userId

String

Yes

The user ID generated by DingRTC.

userId

nonce

String

Yes

A random string generated by the RTC server.

CK-9b5c335b9ae75879441ee7b363886418

expiredTime

ulong

Yes

The expiration time of the DingRTC channel.

1674128130551

AvatarOptions

Custom configurations for advanced features

Name

Type

Required

Description

Default

wsUrl

String

No

The WebSocket address for establishing the IM connection.

wss://avatar-im.console.aliyun.com/ws

autoStartRecord

boolean

No

Specifies whether to automatically start recording after initialization is complete.

false

interval

int

No

The audio collection interval in milliseconds. Valid values: 60 to 1000. If the value is outside this range, a runtime error is thrown.

100

autoDodge

boolean

No

Specifies whether to enable audio ducking.

false

aecConfig

int

No

The Acoustic Echo Cancellation (AEC) configuration. Valid values:

AvatarOptions.AEC_NONE: Disables AEC.

AvatarOptions.AEC_RTC: Uses WebRTC's AEC.

AvatarOptions.AEC_SYSTEM: Uses the system's AEC. This is not supported on some models.

If the value is outside this range, a runtime error is thrown.

AvatarOptions.AEC_SYSTEM

audioSampleRate

int

No

The audio sampling rate. Valid values:

AvatarOptions.SAMPLE_RATE_8K

AvatarOptions.SAMPLE_RATE_16K

If the value is outside this range, a runtime error is thrown.

AvatarOptions.SAMPLE_RATE_16K

customAudioSource

boolean

No

Specifies whether to enable custom audio collection. Default value: false.

false

maxReconnectTimeout

long

No

The maximum time to attempt reconnection after a disconnection. If the reconnection fails after this period, a reconnection timeout error is thrown. Unit: milliseconds.

300000

decodeMode

enum

No

You can switch the decoding mode based on your scenario. Using hardware decoding can reduce CPU load.

Warning

After the upgrade to version 1.2.2, this parameter is no longer effective. RTC automatically adjusts the decoding mode.

AvatarOptions.DecodeMode.SOFTWARE_DECODE

Initialization

The initialization call performs the following operations:

  1. Establishes a WebSocket connection and initializes the digital human's interactive capabilities.

  2. Joins an RTC channel and pulls the digital human's audio and video streams from the cloud.

AvatarSDK avatarSDK = AvatarSDK.createDialogAvatarInstance(this, avatarSDKListener, avatarInstanceInfo,options);
avatarSDK.init();

Callbacks and listeners

Attach a callback

  • Attach during initialization

private AvatarSDKListener avatarSDKListener = new AvatarSDKListener() {}

@Override
protected void onCreate(Bundle savedInstanceState) {
	AvatarSDK avatarSDK = AvatarSDK.createDialogAvatarInstance(this, avatarSDKListener, avatarInstanceInfo, options);
	avatarSDK.init();
}
  • In addition to attaching a listener in the constructor, you can also attach a listener to an instance at runtime.

private AvatarSDKListener avatarSDKListener = new AvatarSDKListener() {}

@Override
protected void onCreate(Bundle savedInstanceState) {
	AvatarSDK avatarSDK = AvatarSDK.createDialogAvatarInstance(this, avatarSDKListener, avatarInstanceInfo, options);
	avatarSDK.setAvatarSDKListener(avatarSDKListener);
	avatarSDK.init();
}
Important

You must attach the listener before you call `init()`. Otherwise, the callback may not be triggered.

Callback method descriptions

API

Description

Minimum supported version

onInitSuccess

The SDK is initialized.

1.0.0

onRecordingStart

Callback for when recording starts.

1.0.0

onRecordingStop

Callback for when recording ends.

1.0.0

onAsr

Callback for Automatic Speech Recognition (ASR) text.

1.0.0

onAnswer

Callback for the digital human's answer text.

1.0.0

onError

Error callback.

1.0.0

onUnknown

Extension callback.

1.0.0

  • onInitSuccess: Callback for successful initialization.

onInitSuccess(String uid, DingRtcAudioTrack audioTrack, DingRtcVideoTrack videoTrack);

Parameter

Type

Description

uid

String

The user ID of the digital human.

audioTrack

DingRtcAudioTrack

The audio stream after the digital human user changes.

videoTrack

DingRtcVideoTrack

The video stream after the digital human user changes.

  • onRecordingStart: Callback for when recording starts.

public void onRecordingStart();
  • onRecordingStop: Callback for when recording ends.

public void onRecordingStop();
  • onAsr: Callback for ASR text.

public void onAsr(String asrResult,String sentenceId);

Parameter

Type

Description

asrResult

String

The ASR text.

sentenceId

String

The sentence ID.

  • onAnswer: Callback for the digital human's answer text.

public void onAnswer(String answerResult, String sentenceId);

Parameter

Type

Description

answerResult

String

The digital human's answer text.

sentenceId

String

The sentence ID.

  • onError: Error callback.

public void onError(int errorCode,String source, String errorMsg);

Parameter

Type

Description

errorCode

int

The error code.

source

String

The source of the error.

errorMsg

String

The error message.

  • onUnknown: Extension callback. Data that is sent from the IM message channel and does not belong to any of the preceding types is returned by the `onUnknown` callback.

public void onUnknown(String msg);

Parameter

Type

Description

msg

String

The extensible data field.

Start recording

Starts collecting audio data from the microphone and sends it to the server. This is not available in custom collection mode.

avatarSDK.startRecording();

Stop audio capture

Stops collecting audio data from the microphone and sending the data to the server-side. This function is not available in custom collection mode.

avatarSDK.stopRecording();

Text interaction

Use text to interact with the digital human.

avatarSDK.sendMessage("Hello");

Advanced features

Get the original DingRtcEngine object

Retrieves the original `DingRtcEngine` object. You can use this object to access advanced RTC features.

DingRtcEngine mAliRtcEngine = avatarSDK.getAliRtcEngine();

Set the listener for DingRtcEngine callbacks

  • Local user behavior callback

// Note: Use the avatarSDK instance, not the original DingRTCEngine object.
avatarSDK.setRtcEngineEventListener(new AvatarRtcEngineEventListener(context) {
    @Override
    public void onJoinChannelResult(int result, String channel, String userId, int elapsed) {
        // You must call the super method. Otherwise, the reconnection feature of AvatarSDK will not work.
        super.onJoinChannelResult(result, channel, userId, elapsed);
    }

    @Override
    public void onConnectionStatusChange(DingRtcEngine.DingRtcConnectionStatus status, DingRtcEngine.DingRtcConnectionStatusChangeReason reason) {
        // You must call the super method. Otherwise, the reconnection feature of AvatarSDK will not work.
        super.onConnectionStatusChange(status, reason);
    }

    @Override
    public void onOccurError(int error, String message) {
        // You must call the super method. Otherwise, AvatarSDKListener cannot throw the related exception information.
        super.onOccurError(error, message);
    }
    
    @Override
    public void onAudioVolumeIndication(List<DingRtcAudioVolumeInfo> speakers) {
        super.onAudioVolumeIndication(speakers);
    }
});
Important

Use the following method to obtain the status callbacks for `DingRtcEngine`. Do not call the `DingRtcEngine` operations directly. Otherwise, AvatarSDK features may not function correctly.

  • Remote user behavior callback

setRtcEngineEventListener(new AvatarRtcEngineEventListener() {
    @Override
    public void onJoinChannelResult(int result, String channel, String userId, int elapsed) {
        super.onJoinChannelResult(result, channel, userId, elapsed);
        Log.d(TAG, "onJoinChannelResult:" + result + ";channel:" + channel);
    }

    @Override
    public void onConnectionStatusChanged(DingRtcEngine.DingRtcConnectionStatus status, DingRtcEngine.DingRtcConnectionStatusChangeReason reason) {
        super.onConnectionStatusChanged(status, reason);
    }

    @Override
    public void onOccurError(int error, String message) {
        super.onOccurError(error, message);
    }

    @Override
    public void onAudioVolumeIndication(List<DingRtcAudioVolumeInfo> speakers) {
        super.onAudioVolumeIndication(speakers);
    }
});
  • Get the raw audio data callback. This replaces `DingRtcEngine().registerAudioObserver()`.

avatarSDK.setAvatarRtcAudioObserver(new AvatarRtcAudioObserver() {
    @Override
    public void onCaptureRawData(DingRtcAudioFrame aliRtcAudioSample) {
        
    }

    @Override
    public void onCaptureData(DingRtcAudioFrame aliRtcAudioSample) {

    }

    @Override
    public void onRenderData(DingRtcAudioFrame aliRtcAudioSample) {

    }

    @Override
    public void onPlaybackAudioFrameBeforeMixing(String s, DingRtcAudioFrame aliRtcAudioSample) {

    }
});
  • Volume callback. This replaces `DingRtcEngine().registerAudioVolumeObserver()`.

    Important

    After SDK 1.2.2, use `setRtcEngineEventListener` to listen for volume callbacks.

Audio ducking

Automatically detects when the digital human in the RTC video stream is speaking and pauses audio recording. This feature is disabled by default.

  • Enable at initialization:

AvatarOptions options = new AvatarOptions.Builder().autoDodge(true).build();
AvatarSDK avatarSDK = AvatarSDK.createDialogAvatarInstance(this, avatarSDKListener, avatarInstanceInfo, options);
  • Enable at runtime:

avatarSDK.setAutoDodge(true);
  • Shutdown:

avatarSDK.setAutoDodge(false);

Custom collection

Send custom-collected audio data.

avatarSDK.sendAudioBuffer(buffer);
Important
  • If the collection interval is less than 60 ms or greater than 1000 ms, a runtime error is triggered.

  • When custom collection is enabled, the start recording, stop recording, audio ducking, or echo cancellation features are unavailable. The `onRecordingStart` and `onRecordingStop` callbacks are not triggered.

Destroy the instance

Disconnects from the RTC stream pulling, disconnects the IM connection, stops recording, and destroys the client instance.

avatarSDK.destory();
Important

This method only destroys the client instance. To avoid wasting cloud resources, call the OpenAPI StopInstance operation.

Broadcast digital human

Create an instance

AvatarSDK avatarSDK = AvatarSDK.createBroadcastAvatarInstance(context,
                                                           avatarSDKListener,
                                                           avatarInstanceInfo,
                                            			   options);
Important

You must call the constructor in the main thread.

Parameters

Parameter

Type

Required

Description

context

Context

Yes

The context of the Android Activity.

avatarSDKListener

AvatarSDKListener

Yes

The SDK status callback. For more information, see Callbacks and listeners.

avatarInstanceInfo

AvatarInstanceInfo

Yes

The basic configuration information for building the Avatar instance. For the complete list of parameters, see AvatarInstanceInfo.

options

AvatarOptions

No

Custom configuration information, such as the reconnection timeout period. For the complete list of parameter settings, see AvatarOptions.

AvatarInstanceInfo

The basic information of the digital human application. You can obtain the parameters from the Digital Human Open Platform - Developer Information page.

Name

Type

Required

Description

Example value

tenantId

String

Yes

The tenant ID.

10000

appId

String

Yes

The application ID.

1234ab56cd

sessionId

String

Yes

The session ID.

123a567b-8d9e-0fgh-ab1c-2345de6f7efg

channel

object

Yes

The WebRTC authentication information. For more information, see Channel.

Channel

The authentication information required by DingRTC. You can obtain all parameters by calling the StartInstance operation.

Name

Type

Required

Description

Example

channelId

String

Yes

The channel ID.

108293819

token

String

Yes

The DingRTC token.

e59f61b2482b4d0562ab542da3f824f7

gslb

array

Yes

The DingRTC channel address.

["https://rgslb.rtc.aliyuncs.com"]

appId

String

Yes

The DingRTC application ID.

ONEX7E28C7C221854

userId

String

Yes

The user ID generated by DingRTC.

userId

nonce

String

Yes

A random string generated by the RTC server.

CK-9b5c335b9ae75879441ee7b363886418

expiredTime

ulong

Yes

The expiration time of the DingRTC channel.

1674128130551

AvatarOptions

Custom configurations for advanced features

Name

Type

Required

Description

Default

maxReconnectTimeout

long

No

The maximum time to attempt reconnection after a disconnection. If the reconnection fails after this period, a reconnection timeout error is thrown. Unit: milliseconds.

300000

decodeMode

enum

No

You can switch the decoding mode based on your scenario. Using hardware decoding can reduce CPU load.

Warning

After the upgrade to version 1.2.2, this parameter is no longer effective. RTC automatically adjusts the decoding mode.

AvatarOptions.DecodeMode.SOFTWARE_DECODE

Initialization

The initialization call joins an RTC channel and pulls the digital human's audio and video streams from the cloud.

AvatarSDK avatarSDK = AvatarSDK.createBroadcastAvatarInstance(this, avatarSDKListener, avatarInstanceInfo, null);
avatarSDK.init();

Callbacks and listeners

Attach a callback

  • Attach during initialization

private AvatarSDKListener avatarSDKListener = new AvatarSDKListener() {}

@Override
protected void onCreate(Bundle savedInstanceState) {
	AvatarSDK avatarSDK = AvatarSDK.createBroadcastAvatarInstance(this, avatarSDKListener, avatarInstanceInfo, options);
	avatarSDK.init();
}

  • In addition to attaching a listener in the constructor, you can also attach a listener to an instance at runtime.

private AvatarSDKListener avatarSDKListener = new AvatarSDKListener() {}

@Override
protected void onCreate(Bundle savedInstanceState) {
	AvatarSDK avatarSDK = AvatarSDK.createBroadcastAvatarInstance(this, avatarSDKListener, avatarInstanceInfo, options);
	avatarSDK.setAvatarSDKListener(avatarSDKListener);
	avatarSDK.init();
}
Important

You must attach the listener before you call `init()`. Otherwise, the callback may not be triggered.

Callback method descriptions

API

Description

Minimum supported version

onInitSuccess

The SDK is initialized.

1.0.0

onError

Error callback.

1.0.0

onUnknown

Extension callback.

1.0.0

  • onInitSuccess: Callback for successful initialization.

public void onInitSuccess(String uid, DingRtcAudioTrack audioTrack, DingRtcVideoTrack videoTrack);

Parameter

Type

Description

uid

String

The user ID of the digital human.

audioTrack

DingRtcAudioTrack

The audio stream after the digital human user changes.

videoTrack

DingRtcVideoTrack

The video stream after the digital human user changes.

  • onError: Error callback.

public void onError(int errorCode,String source, String errorMsg);

Parameter

Type

Description

errorCode

int

The error code.

source

String

The source of the error.

errorMsg

String

The error message.

  • onUnknown: Extension callback. Data that is sent from the IM message channel and does not belong to any of the preceding types is returned by the `onUnknown` callback.

public void onUnknown(String msg);

Parameter

Type

Description

msg

String

The extensible data field.

Advanced features

Get the original DingRtcEngine object

Retrieves the original `DingRtcEngine` object. You can use this object to access advanced RTC features.

DingRtcEngine mAliRtcEngine = avatarSDK.getAliRtcEngine();

Set the listener for DingRtcEngine callbacks

Important

Use the following method to obtain the status callbacks for `DingRtcEngine`. Do not call the `DingRtcEngine` operations directly. Otherwise, AvatarSDK features may not function correctly.

  • Local user behavior callback

// Note: Use the avatarSDK instance, not the original DingRTCEngine object.
avatarSDK.setRtcEngineEventListener(new AvatarRtcEngineEventListener() {
    @Override
    public void onJoinChannelResult(int result, String channel, String userId, int elapsed) {
        super.onJoinChannelResult(result, channel, userId, elapsed);
        Log.d(TAG, "onJoinChannelResult:" + result + ";channel:" + channel);
    }

    @Override
    public void onConnectionStatusChanged(DingRtcEngine.DingRtcConnectionStatus status, DingRtcEngine.DingRtcConnectionStatusChangeReason reason) {
        super.onConnectionStatusChanged(status, reason);
    }

    @Override
    public void onOccurError(int error, String message) {
        super.onOccurError(error, message);
    }

    @Override
    public void onAudioVolumeIndication(List<DingRtcAudioVolumeInfo> speakers) {
        super.onAudioVolumeIndication(speakers);
    }
});
  • Remote user behavior callback

// Note: Use the avatarSDK instance, not the original DingRTCEngine object.
avatarSDK.setRtcEngineEventListener(new AvatarRtcEngineEventListener() {
    @Override
    public void onJoinChannelResult(int result, String channel, String userId, int elapsed) {
        super.onJoinChannelResult(result, channel, userId, elapsed);
        Log.d(TAG, "onJoinChannelResult:" + result + ";channel:" + channel);
    }

    @Override
    public void onConnectionStatusChanged(DingRtcEngine.DingRtcConnectionStatus status, DingRtcEngine.DingRtcConnectionStatusChangeReason reason) {
        super.onConnectionStatusChanged(status, reason);
    }

    @Override
    public void onOccurError(int error, String message) {
        super.onOccurError(error, message);
    }

    @Override
    public void onAudioVolumeIndication(List<DingRtcAudioVolumeInfo> speakers) {
        super.onAudioVolumeIndication(speakers);
    }
});

Destroy the instance

Disconnects from the RTC stream pulling, disconnects the IM connection, stops recording, and destroys the client instance.

Important

This method only destroys the client instance. To avoid wasting cloud resources, call the OpenAPI StopInstance operation.

avatarSDK.destory();

Error codes

Audio and video service fault

When the `onError` callback is triggered, if the `source` field contains `Rtc`, it indicates an RTC error. For more information, see DingRTC Error Codes.

Digital Human service errors

When the `onError` callback is triggered, if the `source` field is `Avatar`, it indicates a Digital Human service error. See the following table for details.

Error code

Error message

Description

50009999

Internal system error

An unknown internal error occurred. Check the log file for support.

50000001

Missing required parameter: audio

A required parameter is missing.

50000002

Invalid parameter: audio

Invalid parameter.

50000006

Invalid sessionId

Invalid sessionId.

50010001

The size of the sent audio exceeds the limit

The size of the sent audio exceeds the limit. The default maximum size is 1s of PCM audio.

50010002

Required configuration for the interactive digital human is missing

Required configuration for the interactive digital human is missing.

50010003

The Q&A result from the interactive bot is empty

The Q&A result from the interactive bot is empty.

50010004

The number of requests to the weather forecast bot has reached the upper limit

The number of requests to the weather forecast bot has reached the upper limit.

50020001

Unknown exception in ASR processing

Unknown exception in ASR processing.

50020002

ASR has not received audio in the correct format for a long time

ASR has not received audio in the correct format for a long time.

50040001

errcode:errMsg returned by Chatbot

No permission to access the corresponding Chatbot resource.

50040002

errcode:errMsg returned by Chatbot

The configured Chatbot account has been frozen.

50040004

errcode:errMsg returned by Chatbot

Unknown exception in the Chatbot conversation.

15011000

Failed to start the server-side two-way conversation

Failed to initialize the conversation channel after the IM channel was established.

15011001

IM channel is abnormal

Possible causes: incorrect WebSocket address, server rejected the WebSocket connection, or an untrusted SSL Certificate was used.

15011002

IM disconnected

The IM connection was disconnected due to network issues.

15011003

IM reconnection timed out

The IM connection failed to reconnect within the maximum reconnection time after disconnection. When you receive this callback, call the `destroy` operation to destroy the instance and then reinitialize it.

15021000

RTC channel closed

The same instance was logged on from another client.

15021001

RTC reconnection timed out

The RTC connection failed to reconnect within the maximum reconnection time after disconnection. When you receive this callback, call the `destroy` operation to destroy the instance and then reinitialize it.

15031000

Incorrect digital human type

Incorrect digital human type. An operation that is not supported by the current digital human type was called.

15031001

Custom collection configuration conflict

A conflict occurred in the custom collection configuration. For example, the `StartRecord` operation was called while custom collection was enabled.

15031002

Recording permission not granted

Check whether the microphone device is working correctly or if microphone permissions are restricted in the browser.

FAQ

  1. The stream I pulled is full screen. How can I fit it into a custom-sized container?

    You need to adjust the layout properties of the container. For more information, see the settings method in `AvatarActivity` in the Demo. If the transparent background is disabled, you can modify `LayoutParams` in the `updateRemoteDisplay` method. If the transparent background is enabled, you need to modify `LayoutParams` in the `updateRemoteDisplayByGreenBackground` method. Because the aspect ratio of the video stream is fixed, we recommend that you scale it proportionally. Using a container with a different aspect ratio may cause the video to be cropped. The following code provides an example:

    RelativeLayout.LayoutParams layout = new RelativeLayout.LayoutParams(1080, 1920);