Listen to this event, and subscribe to the remote stream in the callback.
When a remote user publishes a stream, the SDK triggers the stream-added event. let client = AgoraRTC.createClient(, handleError) 4. You need to replace yourAppId with the App ID of your Agora project. If (remoteDiv) (remoteDiv) Ĭreate and initialize a client object to control the call. Let remoteDiv = document.getElementById(elementId) Remove the video stream from the container. Let streamDiv = document.createElement("div") Let remoteContainer = document.getElementById("remote-container")
Query the container to which the remote stream belong.
Add the following code to the beginning of the script.js file. Note that these methods apply to different objects.īefore you begin, it is helpful to define some functions to handle errors and add/remove views of remote users. The following figure shows the API call sequence of a basic one-to-one video call.
Run the following command to install the SDK: npm install agora-rtc-sdkĪdd the following code to the JavaScript code in your project: import AgoraRTC from 'agora-rtc-sdk'Īdd the following code to the line after in the index.html file: Method 3: Through the Agora websiteĬopy the AgoraRTCSDK-3.6.11.js file to the scripts directory.Īdd the following code to the line after in the index.html file: This method requires npm see Install npm for details. The index.html file is the web page the script.js file includes the JavaScript code that implements the video call function the style.css file defines the front-end styles.Ĭhoose one of the following methods to obtain the Agora Web SDK: Method 1: Through npm An Intel 2.2GHz Core i3/i5/i7 processor (2nd generation) or equivalentĬreate a folder for this project, and then create files in the following structure.Physical media input devices, such as a built-in camera and a built-in microphone.Agora highly recommends using the latest version of Google Chrome. A browser that matches the supported browser list.If your network has a firewall, follow the instructions in Firewall Requirements to access Agora services.
Your browser does not support the video tag.
The following video demonstrates how to build an app that implements the Agora video call from scratch. This article describes how to build a Web project that implements a basic video call using the Agora SDK. This article only applies to the Agora Web SDK 3.x and earlier versions.