Updated on 2025-04-22 GMT+08:00

Getting Started

Environment Requirements

Table 1 describes the operating environment requirements of the web SDK.

Table 1 Environment requirements

Item

Constraint

Development tool

Microsoft Visual Studio Code, WebStorm, or other web IDE development tools

Language

JavaScript or TypeScript

Build environment

Node v17+ (recommended)

Compilation tool

Webpack 5 + Babel 7 is recommended.

Browser

Use a supported browser by referring to Table 2.

Due to the security policy of the browser, you can use only https://domain name to load and run the intelligent interaction web SDK.

Table 2 Browser compatibility

OS

Browser

Browser Version

Windows

Google Chrome

91+

Microsoft Edge

80+

Android

Mobile Google Chrome

91+

iOS

Mobile Safari

17.3+

Mac

Safari

15.6+

Table 3 Support for transparent background

OS

Browser

Browser Version

Windows

Google Chrome

94+

Microsoft Edge

94+

Android

Mobile Google Chrome

94+

iOS

Mobile Safari

17.3+

macOS

Safari

16.4+

Quick SDK Integration

  1. Place the downloaded SDK package in the sdk directory of your project.
  2. Import HwICSUiSdk to the project code.

    • To import the SDK using <script>, access HwICSUiSdk to obtain the exported module:
      <script src='./sdk/HwICSUiSdk.js'></script>
    • To directly reference the static JS file of Huawei WebRTC SDK, use the following:
      import { HwICSUiSdk } from './sdk/HwICSUiSdk'
    • In addition to the preceding JS file, you also need to import the CSS file. You can import the CSS file using the link tag, or directly import it in the project.
      <link rel="stylesheet" href="./sdk/HwICSUiSdk.css">
      import './sdk/HwICSUiSdk.css'
      @import './sdk/HwICSUiSdk.css'

  3. Check whether the browser supports the SDK. For details about the APIs, see checkBrowserSupport.

    1
    2
    3
    4
    5
    6
    const result = await HwICSUiSdk.checkBrowserSupport();
    if (result) {
      // Supported
    } else {
      // Not supported
    }
    

  4. Add a container element to the page for intelligent interaction tasks.

    The container element must contain the id attribute.
    1
    <div id="ics-sdk" style="width: 100vw;height: 100vh"></div>
    

  5. Create an intelligent interaction task. For details about the APIs, see create.

    1
    2
    3
    4
    5
    6
    HwICSUiSdk.create({
      serverAddress: 'metastudio-api.cn-north-4.myhuaweicloud.com',
      onceCode: 'aaa',
      robotId: 'aaa',
      containerId: 'ics-sdk',
    });