The Agora Web SDK (WebRTC) is a JavaScript library loaded by an HTML web page.

The Agora Web SDK library uses APIs in the web browser to establish connections and control the communication and live broadcast services.

AgoraRTC is the entry point for all the methods that can be called in Agora Web SDK.

AgoraRTC includes the following classes.

Class Description
Client Represents a user in a call session. Provides much of the core AgoraRTC functionality.
ClientConfig Defines the properties of the Client object created by createClient.
Stream Represents a published audio or video stream.
StreamSpec Defines the properties of the Stream object created by createStream.
LocalStreamStats Provides connection statistics of a local stream.
RemoteStreamStats Provides connection statistics of a remote stream.
LiveTranscoding Defines user-specific CDN live audio/video transcoding settings.
MediaDeviceInfo Provides information of a single media input or output device.

Client

Use the createClient method to create a Client object and get started.

A Client object is a representation of a local or remote user in a call session, and provides access to much of the core AgoraRTC functionality, see the table below.

Method Description
init Initializes a client object.
join Joins an AgoraRTC channel.
leave Leaves an AgoraRTC channel.
publish Publishes a local stream.
unpublish Unpublishes the local stream.
subscribe Enables a user to subscribe to a remote stream.
unsubscribe Enables the user to unsubscribe from the remote stream.
on Adds event listeners for events triggered by the Client methods.
enableDualStream Enables the dual-stream mode on the publisher side. Dual streams refer to a hybrid of a high-bitrate, high-resolution video stream and a low-bitrate, a low-resolution video stream.
setLowStreamParameter If you enable the dual-stream mode, use this method to set the low-video stream profile.
setRemoteVideoStreamType When a remote user sends dual streams, this method decides on which stream to receive on the subscriber side.
setStreamFallbackOption Use this method to set stream fallback option on the subscriber. Under poor network conditions, the SDK can choose to subscribe to the low-video stream or only the audio stream.
disableDualStream Disables the dual-stream mode.
enableAudioVolumeIndicator Enables the SDK to report the active speaker and his/her volume regularly.
configPublisher Deprecated. Configures the push-stream settings before joining the channel for CDN Live.
startLiveStreaming Adds a voice or video stream URL to a live broadcast and starts live streaming.
setLiveTranscoding Sets the video layout and audio for CDN live. (CDN live only)
stopLiveStreaming Removes the voice or video stream URL from a live broadcast and stops live streaming.
setProxyServer Deploys the Nginx server.
setTurnServer Deploys the TURN server.
setEncryptionSecret Enables the built-in encryption.
setEncryptionMode Sets the encryption mode.
renewToken Renews the token. If you have used the Token when joining the channel, call this method to renew your Token when it expires.
renewChannelKey Renews the channel key. If you have used the channel key when joining the channel, call this method to renew your channel key when it expires.

Stream

Call the createStream method to create a Stream object.

A Stream object represents a published local or remote media stream object in a call session, and provides methods for stream settings, listed in the table below.

Method Description
init Initializes the stream object.
on Adds event listeners for events triggered by the Stream methods.
play Plays the audio or video stream.
stop Stops playing the stream.
close Closes the media input device, for example a camera.
setAudioProfile Sets the audio profile of the stream.
setVideoProfile Sets the video profile of the stream.
setScreenProfile Sets the screen profile in screen-sharing.
getAudioLevel Retrieves the current audio level.
setAudioVolume Sets the volume of the remote stream.
setAudioOutput Sets the audio output device. You can use it to switch between the microphone and the speakerphone.
hasAudio Retrieves the audio flag.
hasVideo Retrieves the video flag.
enableAudio Enables the audio track in the stream.
disableAudio Disables the audio track in the stream.
enableVideo Enables the video track in the stream.
disableVideo Disables the video track in the stream.
getId Retrieves the stream ID.
getStats Retrieves the connection statistics of the stream.