Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace NERTC

Index

Variables

Const BUILD

BUILD: string

Const LIVE_STREAM_AUDIO_CODEC_PROFILE

LIVE_STREAM_AUDIO_CODEC_PROFILE: { HE_AAC: number; LC_AAC: number }

Type declaration

  • HE_AAC: number
  • LC_AAC: number

Const LIVE_STREAM_AUDIO_SAMPLE_RATE

LIVE_STREAM_AUDIO_SAMPLE_RATE: { SAMPLE_RATE_32000: number; SAMPLE_RATE_44100: number; SAMPLE_RATE_48000: number }

The audio sample rate in Interactive Live Streaming.

Type declaration

  • SAMPLE_RATE_32000: number

    32000 Hz

  • SAMPLE_RATE_44100: number

    44100 Hz

  • SAMPLE_RATE_48000: number

    48000 Hz

Const VERSION

VERSION: string

Const VIDEO_FRAME_RATE

VIDEO_FRAME_RATE: { CHAT_VIDEO_FRAME_RATE_10: number; CHAT_VIDEO_FRAME_RATE_15: number; CHAT_VIDEO_FRAME_RATE_20: number; CHAT_VIDEO_FRAME_RATE_25: number; CHAT_VIDEO_FRAME_RATE_5: number; CHAT_VIDEO_FRAME_RATE_NORMAL: number }

Sets video frame rate.

Type declaration

  • CHAT_VIDEO_FRAME_RATE_10: number

    Sets the frame rate of video calls. A maximum of 10 fps is supported.

  • CHAT_VIDEO_FRAME_RATE_15: number

    Sets the frame rate of video calls. A maximum of 15 fps is supported.

  • CHAT_VIDEO_FRAME_RATE_20: number

    Sets the frame rate of video calls. A maximum of 20 fps is supported.

  • CHAT_VIDEO_FRAME_RATE_25: number

    Sets the frame rate of video calls. A maximum of 25 fps is supported.

  • CHAT_VIDEO_FRAME_RATE_5: number

    Sets the frame rate of video calls. A maximum of 5 fps is supported.

  • CHAT_VIDEO_FRAME_RATE_NORMAL: number

    Sets the default frame rate of video calls. A maximum of 15 fps is supported.

Const VIDEO_QUALITY

VIDEO_QUALITY: { VIDEO_QUALITY_1080p: number; VIDEO_QUALITY_180p: number; VIDEO_QUALITY_480p: number; VIDEO_QUALITY_720p: number }

Sets the resolution.

Type declaration

  • VIDEO_QUALITY_1080p: number

    1080p

  • VIDEO_QUALITY_180p: number

    180p

  • VIDEO_QUALITY_480p: number

    480p

  • VIDEO_QUALITY_720p: number

    720p

Functions

checkSystemRequirements

  • checkSystemRequirements(): Boolean
  • Checks the compatibility of NERTC Web SDK with the browser used.

    note
    • You must call this method before you create the audio and video object (createClient).
    • The compatibility of the SDK with the browser is related to the browser type and version. Different browser versions may return different results.

    Returns Boolean

    -true: The SDK is compatible with the current browser. -false: The SDK is not compatible with the current browser.

createClient

  • Creates a client.

    This method is used to create a client. You can call the method once before each call.

    Parameters

    Returns Client

createStream

  • This method creates and returns an audio and video stream object.

    note

    From v4.1.0 or later, streams from the camera and screen sharing can be published in the meantime. The stream captured from screen sharing is transmitted using a substream.

    Parameters

    Returns Stream | { code: number; desc: string; name: string }

destroy

  • destroy(client?: Client): void
  • Destroy the Client object.

    Parameters

    • Optional client: Client

      The Client instance to be destroyed. If the instance is not passed, the Client instance created using createClient will be destroyed. The method is used in scenarios where multiple instances are created.

    Returns void

getCameras

  • Gets available video input devices.

    //Interface usage example
    NERTC.getCameras().then(data => {
      data.forEach(item=>{
        console.log('video label: ', item.label, 'deviceId: ', item.deviceId)
      })
    })   
    

    Returns Promise<DeviceInfo[]>

getDevices

  • This method enumerates the available media input and output devices, such as microphones, cameras, headphones, and more.

    example
    // Interface usage example
    NERTC.getDevices().then(data => {
      const {audioIn, audioOut, video} = data
      audioIn.forEach(item=>{
        console.log('mic label: ', item.label, 'deviceId: ', item.deviceId)
      })
      video.forEach(item=>{
        console.log('video label: ', item.label, 'deviceId: ', item.deviceId)
      })
      //...
    })
    

    Returns Promise<{ audioIn: DeviceInfo[]; audioOut: DeviceInfo[]; video: DeviceInfo[] }>

    • video: video

getMicrophones

  • Gets available audio input devices.

    Returns Promise<DeviceInfo[]>

getSpeakers

  • Gets available audio output devices.

    Returns Promise<DeviceInfo[]>

getSupportedCodec

  • getSupportedCodec(): Promise<{ audio: ["OPUS"]; video: ["H264", "VP8"] }>
  • Checks the codec supported by NERTC Web SDK and the current browser.

    NERTC Web SDK 2.0 video codec supports VP8, H.264, H.265, and NEVC format, and OPUS for audio files. You can call this method to check the codec supported by the NERTC Web SDK and the current browser at the same time. This allows your app to prevent audio and video playback issues during the call due to codec compatibility.

    note
    • You must call the method after the SDK is initialized.
    • This method supports some browsers. For more information about supported browsers, see [Browser types supported by Web SDK](/en/docs/jcyOTA0ODM/TU5NjUzNjU?platformId=50082#Browser types and versions supported on the Web).
    • The returned audio and video encoding is the encoding type declared by the browser through SDP, which is a reference value.
    • Currently, H.264 on some Android phones and H.264 on other platforms cannot communicate with each other or have a one-way communication problem. For these models, we recommend that you use the VP8 encoding format.

    Returns Promise<{ audio: ["OPUS"]; video: ["H264", "VP8"] }>

    Codec supported by NERTC Web SDK and the current browser.

    This method returns a Promise object. In the .then(data(result){}) callback, data contains the following attributes:

    • video: The supported video codec format in array type. The return values include H264 and VP8.
    • audio: Supported audio codec format in array type. The return values include OPUS.
    //Interface usage example
    NERTC.getSupportedCodec().then(data => {
      data.forEach(item=>{
        console.log(`Supported video codec: ${data.video.join(",")});
        console.log(`Supported audio codec: ${data.audio.join(",")});
    ${data.audio.join(",")});
    })