A class defining the properties of the config parameter in the createClient method.

Note:

  • Ensure that you do not leave mode and codec as empty.
  • Set mode as "live" if you need to communicate with the native SDK.
  • Set codec as "h264" as long as Safari is involved in the session.
  • If you set mode as "rtc", the Agora Recording SDK will not be supported.
  • Ensure that you set these properties before calling Client.join.

Set the Session Mode

The table below lists the corresponding mode settings between different versions of the Web SDK:

Before v2.3 From v2.3
createClient({mode: "interop"}) createClient({mode: "live", codec: "vp8"})
createClient({mode: "h264_interop"}) createClient({mode: "live", codec: "h264"})

Set the Proxy Server

Define proxyServer and turnServer if you need to set a proxy server. For a tutorial on deploying the Proxy server on a Web client, see Deploying the Enterprise Proxy.

Note:

Proxy services by different service providers may result in slow performance if you are using the Firefox browser. Therefore, Agora recommends using the same service provider for the proxy services. If you use different service providers, Agora recommends not using the Firefox browser.

example

Sample Code

var config = {
     mode: "live",
     codec: "vp8",
     proxyServer: "YOUR NGINX PROXY SERVER IP",
     turnServer: {
         turnServerURL: "YOUR TURNSERVER URL",
         username: "YOUR USERNAME",
         password: "YOUR PASSWORD",
         udpport: "THE UDP PORT YOU WANT TO ADD",
         tcpport: "THE TCP PORT YOU WANT TO ADD",
         forceturn: false
     }
}
var client = AgoraRTC.createClient(config);

Hierarchy

  • ClientConfig

Index

Properties

codec

codec: "vp8" | "h264"

The codec the Web browser uses for encoding and decoding.

  • "vp8": Sets the browser to use VP8 for encoding and decoding.
  • "h264": Sets the browser to use H264 for encoding and decoding.

mode

mode: "live" | "rtc"

The channel mode.

  • "live": Sets the channel mode as live broadcast (interop with the native SDK).
  • "rtc": Sets the channel mode as communication (non-interop with the native SDK).

Optional proxyServer

proxyServer: string

Your Nginx server domain name.

Enterprise users with a company firewall can use this property to pass signaling messages to the Agora SD-RTN through the Nginx Server.

Optional turnServer

turnServer: object

TURN server settings.

Enterprise users with a company firewall can use this property to pass audio and video data to the Agora SD-RTN through the TURN Server.

Type declaration

  • forceturn: boolean

    Sets whether to force data transfer by TURN Server:

    • true: Force data transfer.
    • false: (default) Not to force data transfer.
  • password: string

    Your TURN Server password.

  • Optional tcpport?: string

    The TCP port(s) you want add to TURN Server.

  • turnServerURL: string

    Your TURN Server URL address.

  • Optional udpport?: string

    The UDP port(s) you want to add to TURN Server.

  • username: string

    Your TURN Server username.