System | Support Android 6 and later systems |
Processor Architecture | Support arm64-v8a CPU architecture |
Processor Performance Requirements | Support Rockchip RK3588 |
Development IDE | Android Studio |
Memory Requirements | More than 500 MB |
common_model/. If there are multiple character models, they can share one Base Model Package.human_xxxxx_540p_v2/, where xxxxx is the name of the custom avatar.
virtualhuman_2d_sdk_v202502071637.aardependencies{implementation fileTree(dir: 'libs', include: ['*.aar'])// Add dependencyimplementation 'com.squareup.okhttp3:okhttp:4.9.0'implementation 'com.parse.bolts:bolts-tasks:1.4.0'}
// Set log levelVirtualHumanController.setLogLevel(Int level);// Set log callbackVirtualHumanController.setLogCallback(IDataCallback logCallback);
Log level | level Flag |
Close logs | 0 |
Error logs | 1 |
Warning logs | 2 |
Log information | 3 |
Debug Logs | 4 |
Trace logs | 5 |
Parameter Name | Data Type | Parameter Type | Description |
level | Int | Required or Not | Log level |
logMsg | String | Required | Log information |
VirtualHumanParam vhParam = new VirtualHumanParam();// Local model pathvhParam.humanModelPath = "/data/user/0/com.tencent.virtualhuman_2d_demo/files/test_model/human_model";// Local model pathvhParam.commonModelPath = "/data/user/0/com.tencent.virtualhuman_2d_demo/files/test_model/common_model";vhParam.appId = "License appId";vhParam.secretKey = "License secretKey";vhParam.deviceName = "Device tag, use nameplate info";// error callback functionvhParam.errorCallback = (code, message) -> {Log.d(TAG, "Code: " + code + ", Message: " + message);};// event callback functionvhParam.eventCallback = (code, message) -> {Log.d(TAG, "Code: " + code + ", Message: " + message);};controller = new VirtualHumanController(this, vhParam);int ret = controller.initHuman();if (ret == 0) {controller.setRenderView(virtualHumanView); // set rendering viewcontroller.startHuman();// Start rendering} else {Log.i(TAG, "init fail=" + ret);}
Parameter Name | Data Type | Required | Description |
humanModelPath | String | Yes | Local model path. |
commonModelPath | String | Yes | Local general model path. |
appId | String | Yes | AppId in the License. |
secretKey | String | Yes | SecretKey in the License. |
eventCallback | IDataCallback | No | Event callback function Event notification |
eventCallback | IDataCallback | Yes | Exception callback function, monitoring exception messages. |
deviceName | String | No | Device alias. Use nameplate info. |
Parameter Name | Data Type | Required | Description |
code | Int | Yes | code |
message | String | Yes | Information |
Error Code | Error Message |
20001 | Algorithm model initialization error. |
20010 | Authentication failed. |
20012 | Insufficient device performance, cannot operate smoothly. |
Error Code | Error Message |
10001 | Broadcast started. |
10002 | Broadcast ended. |
10003 | controller.appendAudioData('audio data', boolean, 'tag'). When calling appendAudioData with a tag parameter, 10003 represents the start event for playing this audio data, and the tag is returned in the callback event. |
10004 | controller.appendAudioData('audio data', boolean, 'tag'). When calling appendAudioData with a tag parameter, 10003 represents the end event for playing this audio data, and the tag is returned in the callback event. |
10005 | Callback event for the first-frame image rendering of Digital Human. |
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"android:orientation="vertical"android:layout_width="match_parent"android:layout_height="match_parent"><LinearLayoutandroid:id="@+id/ll_floating_ball"android:layout_width="180dp"android:layout_height="320dp"android:background="#8f15ab71"android:gravity="center"android:orientation="horizontal"><com.tencent.virtualhuman_2d_sdk.VirtualHumanViewandroid:id="@+id/virtual_human_view"app:TVHFillMode="fill" // render View filling modeandroid:layout_width="match_parent"android:layout_height="match_parent" /></LinearLayout></LinearLayout>
<?xml version="1.0"encoding="utf-8"?><LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:orientation="vertical"android:layout_width="match_parent"android:layout_height="match_parent"><LinearLayoutandroid:id="@+id/ll_container"android:layout_width="480dp"android:layout_height="480dp"android:background="#8f15ab71"android:gravity="center"android:orientation="horizontal"></LinearLayout></LinearLayout>
// context is the context of the current Activity interfaceVirtualHumanView virtualHumanView = new VirtualHumanView(context);virtualHumanView.setFillMode(VirtualHumanViewType.fill);LinearLayout ll_container = findViewById(R.id.ll_container);ll_container.addView(virtualHumanView);
VirtualHumanViewType.stretch | Stretch image |
VirtualHumanViewType.fit | Crop image |
VirtualHumanViewType.fill | Keep black border (transparent edge) |
Parameter Name | Data Type | Parameter Type | Description |
virtualHumanView | VirtualHumanView | Required |
controller.setRenderView(virtualHumanView);
Parameter Name | Data Type | Parameter Type | Description |
decodedBytes | Byte[] | Yes | PCM audio data. |
isFinal | Boolean | Yes | Whether it is the last audio frame. |
metaData | String | No | Import the tag corresponding to the audio data. There will be event 10003/10004 when broadcasting the audio fragment. |
controller.appendAudioData(decodedBytes, isFinal);controller.appendAudioData(decodedBytes, isFinal, metaData);
controller.interrupt();
controller.pause();
controller.resume();
controller.setDualGen(true);// Enable dual-core algorithm logiccontroller.setSkipFrameInterval(5);// Skip 1 frame every 5 frames to reduce compute consumption


Feedback