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

You can use the AgoraRTC methods to create Client and Stream objects.

Other methods of the AgoraRTC object check for system requirements and set up error logging.




VERSION: string

The version of the Agora Web SDK.





  • checkSystemRequirements(): boolean
  • Checks the Web Browser Compatibility

    This method checks the compatibility between the Web SDK and the current web browser.

    Use this method before calling createClient to check the compatibility between the system and the web browser.


    • Both the type and version of the browser affect the return value.
    • Agora has not conducted comprehensive tests on some Chromium kernel browsers, such as QQ and 360. You can call this method to check if the SDK supports the browser.

    Returns boolean

    • true: The Web SDK is compatible with the current web browser.
    • false: The Web SDK is not compatible with the current web browser.


  • Creates a Client Object

    This method creates and returns a client object. You can only call this method once each call session.




    Returns Client


  • Creates a Stream Object

    This method creates and returns a stream object.




    Returns Stream


  • getDevices(callback: function): void
  • Enumerates the media devices

    This method enumerates the available media input and output devices, such as microphones, cameras, headsets, and so on.

    If this method succeeds, the SDK returns a list of media devices in an array of MediaDeviceInfo objects.


    On Chrome 81 or later, Safari, and Firefox, device IDs are only available after the user has granted permissions to use the media device. See Why can't I get device ID on Chrome 81?


    Sample code

    AgoraRTC.getDevices (function(devices) {
    var devCount = devices.length;
    var id = devices[0].deviceId;


    Returns void


  • getScreenSources(callback: function): void
  • Gets the Sources for Screen-sharing

    To share the screen in Electron, call this method to get the screen sources. See Share the Screen for details.

    If this method succeeds, the SDK returns a list of screen sources in an array of DesktopCapturerSource objects.


    Sample code

    AgoraRTC.getScreenSources(function(err, sources) {


    Returns void


  • getSupportedCodec(supportedCodecOptions?: object): Promise<object>
  • Gets the supported codec of the web browser

    This method returns the codecs supported by both the Agora Web SDK and the web browser. The Agora Web SDK supports VP8 and H.264 for video, and OPUS for audio.


    • This method supports all web browsers. For web browsers that do not support WebRTC or are not recognized, the returned codec list is empty.
    • The returned codec list is based on the SDP used by the web browser and for reference only.
    • Some Android phones might claim to support H.264 but have problems in communicating with other platforms using H.264. In this case, we recommend using the VP8 codec.

    Sample code

    // Gets the supported decoding formats as the receiver
        console.log(`Supported video codec: ${",")}`);
        console.log(`Supported audio codec: ${",")}`);
    // Gets the supported encoding formats as the sender
    navigator.mediaDevices.getUserMedia({video: true, audio: true})
        return AgoraRTC.getSupportedCodec({stream: mediaStream});
        console.log(`Supported video codec: ${",")}`);
        console.log(`Supported audio codec: ${",")}`);


    • Optional supportedCodecOptions: object
      • stream: MediaStream

        (Optional) Specifies a MediaStream object.

        If this parameter is empty, this method gets the supported decoding formats of the web browser as the receiver. Otherwise the method gets the supported encoding formats as the sender. In most cases, the supported decoding and encoding formats are the same.

    Returns Promise<object>

    Returns a Promise object. In the .then(function(result){}) callback, result has the following properties:

    • video: array, the supported video codecs. The array might include "H264" and "VP8", or be empty.
    • audio: array, the supported audio codecs. The array might include "OPUS", or be empty.