Run the HarmonyOS demo

更新时间:
复制 MD 格式

This topic describes how to run the HarmonyOS demo.

Prerequisites

You have obtained authentication information from the console. For more information, see User Guide.

Note

The token obtained from the console is for development and testing only. It is not secure for use in a production environment. For your production application, you must set up your own server to generate tokens over the HTTPS protocol. For more information, see Generate a token on the server-side.

Environment requirements

Type

Description

Terminal device

A physical device running HarmonyOS.

System version

5.0.0 or later.

Procedure

  1. Download and decompress the software development kit (SDK) and the sample code. For more information, see SDK download.

  2. In the `Demo/oh-package.json5` file, change `"@dingrtc/dingrtc": "3.5.0"` to the latest version.

  3. Open the CommonConstants.ets file in `BasicVideoCall` and configure your authentication information.

      static readonly APP_ID = ; // TODO: Your App ID
    
      static readonly TOKEN = ; // TODO: Your channel authentication token. For more information, see the README file.
  4. Run the demo.

    1. After the demo runs successfully, enter a channel ID, user ID, and username on the main interface. Then, click the "Join Channel" button.

    2. After you join the channel, a preview of your local video stream appears in the grid view.

    3. When another user joins the same channel, the application automatically subscribes to their video and audio streams and displays their video in the grid view.