Updated on 2023-11-01 GMT+08:00

Preparations

Prerequisites

You have submitted a service ticket to obtain the SDK package.

Environment Requirements

  • You are advised to install Microsoft Visual Studio Code 1.43.2 or a later version for compilation.
  • If you want to develop your client using Node.js, you are advised to install Node.js 14.19.1 or a later version.
  • For details about the supported browsers, see Web Browser Adaptation.
  • If you want to develop your client using TypeScript, the TypeScript version must be 3.8.3 or later.
  • For browser security, the camera and microphone permissions can be requested only through https://Domain name or localhost:port after you build a local server.

SDK Integration

  1. Place the obtained SDK package in the sdk directory of your project.
  2. Introduce hrtc to the project code.

    • To use the <script> mode to introduce Huawei WebRTC SDK, access HRTC to obtain the exported module:
      <script src='./sdk/hrtc.js'>
          console.log(HRTC.VERSION)
      </script>
    • To directly reference the static JS file of Huawei WebRTC SDK, reference the following code to access HRTC:
      import HRTC from '../../sdk/hrtc'
      console.log(HRTC.VERSION)
    • To introduce Huawei WebRTC SDK in npm modularization mode, install the hrtc module and introduce hrtc to the development dependency of package.json, for example, "hrtc": "./sdk/RtcSdk_Web_*.*.*.***.tar.gz". Run the npm install command on the terminal (replace the version number with the actual one), and then run the following commands:
      import HRTC from 'hrtc'
      console.log(HRTC.VERSION)