logo
On this page

Run Sample Source Code

Sample Source Code Running Guide

Prepare Environment

Before integrating the ZEGO Express SDK, please ensure your development environment meets the following requirements:

  1. Install Node.js, it is recommended to use the Long Term Support (LTS) version displayed on the official website homepage.

  2. Install a browser with compatibility as shown in the following table:

BrowserWindowsMacAndroidiOS
Chrome 58 or later✔️✔️✔️✖️
FireFox 56 or later✔️✔️✔️✖️
Safari 11 or later-✔️-✔️
Opera 45 or later✔️✔️Partial support✖️
QQ Browser latest version✔️✔️Partial support✖️
360 Secure Browser speed mode✔️✔️✖️✖️
WeChat Browser--✔️
  • iOS 14.3 or later, and WeChat version 6.5 or later, supports publishing and playing streams
  • iOS below 14.3 only supports playing streams
WebView--✔️Only supports playing streams
Warning

Only Web servers with SSL (https), localhost, 127.0.0.1 are equivalent to https.

Prerequisites

You have created a project in the ZEGO Console, applied for a valid AppID and AppSign, and obtained the access server address Server. For details, please refer to Console - Project Management.

Notes

  • The SDK in the sample source code is a beta version, please do not use it in a production environment.
  • ZEGO currently only provides an interface for obtaining tokens in a test environment. In a production environment, developers need to implement the token acquisition logic themselves. For obtaining the token required for logging into a room, please refer to Login Room Authentication.

Get Sample Source Code

Run Sample Source Code

  1. Switch to the project directory in Terminal and run the npm i command to install dependencies.

  2. The downloaded sample source code lacks the appId and server address required for SDK initialization. You need to modify the appId and server in the "./src/common.js" file to the AppID and Server obtained in Prerequisites, otherwise the sample source code cannot run normally.

  3. Run the npm run dev command in Terminal to run the sample source code. After running successfully, access the local server (https://***) in a browser. An example is as follows:

​  Project is running at https://192.168.6.184:9090/

Note

Run the Control+C command in Terminal to stop the server.

Experience Real-time Audio/Video Features

Run the project on a real device. After running successfully, you can hear the local audio and see the local video.

Use the Web platform for debugging (only supports use in a test environment), enter the same AppID and roomID, and join the same room to communicate with the real device. When the audio/video call starts successfully, you can hear both local and remote audio, and see both local and remote video.

Note

In audio-only scenarios, you can only hear audio and cannot see video.

Previous

Common Error Codes

Next

Integrating SDK

On this page

Back to top