Options
All
  • Public
  • Public/Protected
  • All
Menu

NERTC V4.4.0

NERTC Web SDK

NERTC Web SDK provides a complete set of audio and video call development APIs for Javascript. The SDK offers Internet-based video calls and audio calls. You can quickly get connected for audio and video communication by calling relevant APIs in your browser and publish streams for audio and video calls.

The complete NERTC Web SDK consists of NERTC, Client, and Stream.

  • NERTC is the basic object that is used as the entry point for other APIs.
  • Client is the Client object that manages core operations for local and remote users.
  • Stream is the Stream object that handles the settings for audio and video streams.

Note: From version 4.4.0, the entry point of NERTC is renamed from WebRTC2 to NERTC and is still compatible with WebRTC2.

NERTC object

Method Description
NERTC.createClient Creates a client.
NERTC.createStream Creates an audio and video stream object.
NERTC.getDevices Gets media input and output devices.
NERTC.getCameras Gets video input devices.
NERTC.getMicrophones Gets audio input devices.
NERTC.getSpeakers Gets audio output devices.
NERTC.Logger.enableLogUpload Enables log upload.
NERTC.Logger.disableLogUpload Disables log upload.

Client object

Client management

Method Description
NERTC.createClient Creates a client instance.
Client.destroy Destroys the client instance.

Room management

Method Description
Client.join Joins an RTC room.
Client.leave Leaves an RTC room.
Client.setChannelProfile Sets a room scene.
Client.setClientRole Sets the user role.
Client.publish Publishes audio and video streams.
Client.unpublish Unpublishes audio and video streams.
Client.subscribe Subscribes to remote audio and video streams.
Client.unsubscribe Unsubscribes from remote audio and video streams.
Client.setRemoteVideoStreamType Sets the resolution of the remote video stream.
Client.getConnectionState Gets the network connection status.
Client.getUid Gets the ID of the local user.

CDN relayed streaming

Method Description
Client.addTasks Adds streaming tasks.
Client.deleteTasks Deletes streaming tasks.
Client.updateTasks Updates streaming tasks.

Device stats

Method Description
Client.getSystemStats Gets the system power information.
Client.getTransportStats Gets the stats of the network connection.

RTC stats

Method Description
Client.getLocalAudioStats Gets the stats of the published local audio stream.
Client.getLocalVideoStats Gets the stats of the published local video stream.
Client.getRemoteAudioStats Gets the stats of the subscribed remote audio stream.
Client.getRemoteVideoStats Gets the stats of the subscribed remote video stream.
Client.getSessionStats Gets the session stats.

RTC stream fallback

Method Description
Client.setLocalMediaPriority Sets the priority of local media streams.

Encryption

Method Description
Client.setEncryptionMode Sets the encryption mode.
Client.setEncryptionSecret Sets the encryption secret.

Stream object

Audio and video stream management

Method Description
NERTC.createStream Creates a Stream object.
Stream.destroy Destroys a Stream object.
Stream.init Initializes a Stream object.
Stream.play Plays an audio and video stream.
Stream.stop Stops playing an audio and video stream.
Stream.open Opens an audio and video input device, such as the microphone.
Stream.close Closes an audio and video input device, such as the microphone.

Audio management

Method Description
Stream.setAudioProfile Sets audio profile.
Stream.setAudioVolume Sets the audio volume.
Stream.setCaptureVolume Sets the audio capture volume.
Stream.muteAudio Mutes the audio track.
Stream.unmuteAudio unmutes the audio track.
Stream.getAudioLevel Gets the audio volume of the microphone.
Stream.hasAudio Determines whether the current Stream contains an audio track.
Stream.setAudioOutput Sets audio output devices.

Video management

Method Description
Stream.setVideoProfile Sets the video profile.
Stream.setSubscribeConfig Sets the subscription parameters.
Stream.setScreenProfile Sets the screen profile for screen sharing.
Stream.muteVideo Mutes the video track.
Stream.unmuteVideo Unmutes the video track.
Stream.setLocalRenderMode Sets the local rendering mode.
Stream.setRemoteRenderMode Sets the remote rendering mode.
Stream.takeSnapshot Takes a snapshot of a specified window.
Stream.setCanvasWatermarkConfigs Adds a watermark to the video canvas.

Music files playback and mixing

Method Description
Stream.startAudioMixing Starts playing back the mixing audio that is mixed from local music files and the sound track from the microphone.
Stream.pauseAudioMixing Pauses playing the back mixing audio.
Stream.resumeAudioMixing Resumes playing back the mixing audio.
Stream.stopAudioMixing Stops playing back the mixing audio.
Stream.adjustAudioMixingVolume Adjusts the volume of mixing audio playback.
Stream.getAudioMixingDuration Gets the duration of the mixing audio.
Stream.getAudioMixingCurrentPosition Gets the current position of mixing audio playback.
Stream.setAudioMixingPosition Sets the position of the mixing audio playback.

Sound effect playback

Method Description
Stream.playEffect Plays a specified sound effect file.
Stream.stopEffect Stops playing a specified sound effect file.
Stream.pauseEffect Pauses playing a specified sound effect file.
Stream.resumeEffect Resumes playing a specified sound effect file.
Stream.setVolumeOfEffect Sets the volume of a specified sound effect file.
Stream.preloadEffect Preloads a specified sound effect file.
Stream.unloadEffect Unloads a specified sound effect file.
Stream.getEffectsVolume Gets the volume of all sound effect files.
Stream.setEffectsVolume Sets the volume of all sound effect files
Stream.stopAllEffects Stops playing all sound effect files.
Stream.pauseAllEffects Pause playing all sound effect files.
Stream.resumeAllEffects Resumes playing all sound effect files.

Recording management

Method Description
Stream.startMediaRecording Starts recording for a single user.
Stream.stopMediaRecording Stops video recording.
Stream.playMediaRecording Plays back the recording files.
Stream.listMediaRecording Enumerates the recording files.
Stream.cleanMediaRecording Clears the recording files.
Stream.downloadMediaRecording Downloads the recording files.

Event

Listen for events triggered by Client and Stream by using Client.on and Stream.on.