This Agora Electron SDK is developed upon the Native SDK for macOS and the Native SDK for Windows, with the Node.js C++ plug-in units. The Electron SDK supports all the functions of the Agora Native SDK. Agora provides ensured quality of experience (QoE) for worldwide Internet-based voice and video communications through a virtual global network optimized on all platforms.

  • The AgoraRtcEngine class provides the main methods that can be invoked by your application.
  • The Events class enables callbacks to your application.

Methods

Channel management

Method Description
initialize Initializes an AgoraRtcEngine instance.
release Releases an AgoraRtcEngine instance.
setChannelProfile Sets the channel profile.
setClientRole Sets the user role (Live Broadcast only).
joinChannel Allows a user to join a channel.
switchChannel Switches to a different channel (Live Broadcast only).
leaveChannel Allows a user to leave a channel.
subscribe Subscribes to the remote user and initializes the video sink
renewToken Renews the token.
enableWebSdkInteroperability Enables interoperability with the Agora Web SDK.
getConnectionState Gets the connection state of the app.
on Monitors the events during AgoraRtcEngine runtime.
off Stops monitoring the events during AgoraRtcEngine runtime.

Audio management

Method Description
enableAudio Enables the audio module.
disableAudio Disables the audio module.
setAudioProfile Sets the audio parameters and application scenarios.
adjustRecordingSignalVolume Adjusts the recording volume.
adjustPlaybackSignalVolume Adjusts the playback volume of the voice.
enableLocalAudio Enables/disables the local audio capture.
muteLocalAudioStream Stops/Resumes sending the local audio stream.
muteRemoteAudioStream Stops/Resumes receiving a specified remote audio stream.
muteAllRemoteAudioStreams Stops/Resumes receiving all remote audio streams.
setDefaultMuteAllRemoteAudioStreams Sets whether to receive all remote audio streams by default.

Video management

Method Description
enableVideo Enables the video module.
disableVideo Disables the video module.
setVideoEncoderConfiguration Sets the video encoder configuration.
setupLocalVideo Sets the local video view.
setupViewContentMode Sets the view content mode.
setRenderMode Sets the view render mode.
startPreview Starts the local video preview.
stopPreview Stops the local video preview.
enableLocalVideo Enables/Disables the local video capture.
muteLocalVideoStream Stops/Resumes sending the local video stream.
muteRemoteVideoStream Stops/Resumes receiving a specified remote video stream.
muteAllRemoteVideoStreams Stops/Resumes receiving all remote video streams.
setDefaultMuteAllRemoteVideoStreams Sets whether to receive all remote video streams by default.

Video sink

Method Description
initRender Initializes the video sink.
destroyRender Destroys the video sink.
resizeRender Resizes the rendered video.
setVideoRenderDimension Ses the pixels the rendered video.
setVideoRenderFPS Sets the frame rate of the rendered video.
setVideoRenderHighFPS Sets the high frame rate of the rendered video.
addVideoRenderToHighFPS Adds the rendered video with high frame rate.
removeVideoRenderFromHighFPS Removes the rendered video with high frame rate.

Video pre-process and post-process

Method Description
setBeautyEffectOptions Sets the image enhancement options.

Screen sharing

Method Description
videoSourceInitialize Initializes the video source object.
videoSourceRelease Releases the video source object.
getScreenDisplaysInfo Gets the display ID.
getScreenWindowsInfo Gets the window ID.
startScreenCapturePreview Starts the sharing video preview.
stopScreenCapturePreview Stops the sharing video preview.
videoSourceStartScreenCaptureByScreen Shares the whole or part of a screen by specifying the screen rect.
videoSourceStartScreenCaptureByWindow Shares the whole or part of a window by specifying the window ID.
videoSourceUpdateScreenCaptureRegion Updates the screen sharing region.
videoSourceUpdateScreenCaptureParameters Updates the screen sharing parameters.
videoSourceSetScreenCaptureContentHint Sets the content hint for screen sharing.
stopScreenCapture2 Stops screen sharing.

Audio file playback and mixing

Method Description
startAudioMixing Starts playing and mixing the music file.
stopAudioMixing Stops playing and mixing the music file.
pauseAudioMixing Pauses playing and mixing the music file.
resumeAudioMixing Resumes playing and mixing the music file.
adjustAudioMixingVolume Adjusts the volume during audio mixing.
adjustAudioMixingPlayoutVolume Adjusts the volume of audio mixing for local playback.
adjustAudioMixingPublishVolume Adjusts the volume of audio mixing for remote playback.
getAudioMixingPlayoutVolume Adjusts the audio mixing volume for publishing (for remote users).
getAudioMixingPublishVolume Retrieves the audio mixing volume for publishing.
getAudioMixingDuration Gets the duration (ms) of the music file.
getAudioMixingCurrentPosition Gets the playback position (ms) of the music file.
setAudioMixingPosition Sets the playback position of the music file.

Audio effect playback

Method Description
getEffectsVolume Gets the volume of the audio effects.
setEffectsVolume Sets the volume of the audio effects.
setVolumeOfEffect Sets the volume of the audio effect.
playEffect Plays a specified audio effect.
stopEffect Stops playing a specified audio effect.
preloadEffect Preloads a specified audio effect file into the memory.
unloadEffect Releases a specified audio effect from the memory.
pauseEffect Pauses a specified audio effect.
pauseAllEffects Pauses all audio effects.
resumeEffect Resumes playing a specified audio effect.
resumeAllEffects Resumes playing all audio effects.

Voice changer and reverberation

Method Description
setLocalVoiceChanger Sets the local voice changer option.
setLocalVoiceReverbPreset Sets the preset local voice reverberation effect.
setLocalVoicePitch Changes the voice pitch of the local speaker.
setLocalVoiceEqualization Sets the local voice equalization effect.
setLocalVoiceReverb Sets the local voice reverberation.

Sound position indication

Method Description
enableSoundPositionIndication Enables/Disables stereo panning for remote users.
setRemoteVoicePosition Sets the sound position and gain of a remote user.

CDN publisher (live Broadcast only)

Method Description
setLiveTranscoding Sets the video layout and audio for CDN live.
addPublishStreamUrl Adds a CDN stream address.
removePublishStreamUrl Removes a CDN stream address.

Channel Media Relay

Method Description
startChannelMediaRelay Starts to relay media streams across channels.
updateChannelMediaRelay Updates the channels for media stream relay.
stopChannelMediaRelay Stops the media stream relay.

Audio volume indication

Method Description
enableAudioVolumeIndication Reports on which users are speaking and the speakers' volume.

In-ear monitoring

Method Description
setInEarMonitoringVolume Sets the volume of the in-ear monitor.

Dual video stream mode

Method Description
enableDualStreamMode Sets the stream mode to single-stream (default) or dual-stream mode.
setRemoteVideoStreamType Sets the remote user’s video stream type received by the local user when the remote user sends dual streams.
setRemoteDefaultVideoStreamType Sets the default video-stream type for the video received by the local user when the remote user sends dual streams.

Stream fallback

Method Description
setLocalPublishFallbackOption Sets the fallback option for the published video stream under unreliable network conditions.
setRemoteSubscribeFallbackOption Sets the fallback option for the remote stream under unreliable network conditions.
setRemoteUserPriority Prioritizes a remote user's stream.

Pre-call network test

Method Description
startEchoTestWithInterval Starts an audio call test.
stopEchoTest Stops the audio call test.
enableLastmileTest Enables the network connection quality test.
disableLastmileTest Disables the network connection quality test.
startLastmileProbeTest Starts the last-mile network probe test.
stopLastmileProbeTest Stops the last-mile network probe test.

Encryption

Method Description
setEncryptionSecret Enables built-in encryption with an encryption password before joining a channel.
setEncryptionMode Sets the built-in encryption mode.

Inject an online media stream

Method Description
addInjectStreamUrl Adds an online media stream to a live broadcast.
removeInjectStreamUrl Removes the online media stream from a live broadcast.

Device management

Method Description
setAudioPlaybackDevice Sets the audio playback device using the device ID.
getAudioPlaybackDevices Gets the audio playback device using the device ID.
setAudioRecordingDevice Sets the audio recording device using the device ID.
getAudioRecordingDevices Gets the audio recording device using the device ID.
setVideoDevice Sets the device with the device ID.
getVideoDevices Gets the video-capture device that is in use.
setAudioPlaybackDeviceMute Mutes/Unmutes the audio playback device.
getAudioPlaybackDeviceMute Gets the mute state of the audio playback device.
setAudioRecordingDeviceMute Mutes/Unmutes the audio recording device.
getAudioRecordingDeviceMute Gets the mute state of the audio recording device.
getPlaybackDeviceInfo Gets the information of the audio playback device.
getRecordingDeviceInfo Gets the information of the recording device.
getCurrentAudioPlaybackDevice Gets the current audio playback device.
getCurrentAudioRecordingDevice Gets the current audio recording device.
getCurrentVideoDevice Gets the current video device.
startAudioDeviceLoopbackTest Starts the audio device loopback test.
stopAudioDeviceLoopbackTest Stops the audio device loopback test.
startAudioPlaybackDeviceTest Starts the audio playback device test.
stopAudioPlaybackDeviceTest Stops the audio playback device test.
startAudioRecordingDeviceTest Starts the recording device test.
stopAudioRecordingDeviceTest Stops the recording device test.
startVideoDeviceTest Starts the video playback device test.
stopVideoDeviceTest Stops the video playback device test.
setAudioPlaybackVolume Sets the volume of the audio playback device.
getAudioPlaybackVolume Gets the volume of the audio playback device.
setAudioRecordingVolume Sets the volume of the recording device.
getAudioRecordingVolume Gets the volume of the recording device.

Stream message

Method Description
createDataStream Creates a data stream.
sendStreamMessage Sends data stream messages.

Miscellaneous audio control

Method Description
enableLoopbackRecording Enables loopback recording.

Miscellaneous video control

Method Description
setLocalVideoMirrorMode Sets the local video mirror mode.
setCameraCapturerConfiguration Sets the camera capturer configuration.

Miscellaneous methods

Method Description
getCallId Gets the current call ID.
rate Allows the user to rate the call and is called after the call ends.
complain Allows a user to complain about the call quality after a call ends.
setLogFile Specifies an SDK output log file.
setLogFileSize Sets the log file size (KB).
setLogFilter Sets the output log level of the SDK.
getVersion Gets the SDK version number.
getErrorDescription Gets the warning or error description.

Customized methods

Method Description
setParameters Provides the technical preview functionalities or special customizations by configuring the SDK with JSON options.

Methods for the second instance

Agora Electron SDK provides the methods for the second instance:

Method Description
videoSourceSetChannelProfile Sets the channel profile.
videoSourceJoin Allows a user to join a channel.
videoSourceLeave Allows a user to leave a channel.
videoSourceRenewToken Renews the Token.
videoSourceEnableWebSdkInteroperability Enables interoperability with the Agora Web SDK.
setupLocalVideoSource Sets the local video view.
videoSourceSetVideoProfile Sets the video encoder configuration.
videoSourceEnableDualStreamMode Sets the stream mode to single- (default) or dual-stream mode (for live broadcast only).
videoSourceSetLogFile Specifies an SDK output log file.
videoSourceSetParameters Provides the technical preview functionalities or special customizations by configuring the SDK with JSON options.

Events

Agora Electron SDK use the on method to add listeners for the events above:

Event Description
warning Occurs when a warning occurs.
error Occurs when an error occurs.
joinedChannel Occurs when a user joins a channel.
rejoinedChannel Occurs when a user rejoins a channel.
leaveChannel Occurs when a user leaves a channel.
clientRoleChanged Occurs when the user role in a Live Broadcast changes.
userJoined Occurs when a remote user joins a channel.
connectionStateChanged Occurs when the network connection state changes.
connectionLost Occurs when the network connection state changes.
apiCallExecuted Occurs when an API method is executed.
tokenPrivilegeWillExpire Occurs when the token expires in 30 seconds.
requestChannelKey Occurs when the Channel Key expires.
localUserRegistered Occurs when the local user successfully registers a user account.
userInfoUpdated Occurs when the SDK gets the user ID and user account of the remote user.
microphoneEnabled Occurs when the state of the microphone changes.
groupAudioVolumeIndication Occurs when the state of the microphone changes.
activeSpeaker Reports which user is the loudest speaker.
rtcStats Reports the statistics of AgoraRtcEngine.
localVideoStats Reports the statistics of the uploading local video stream.
remoteVideoStats Reports the statistics of the video stream from each remote user/host.
localAudioStats Reports the statistics of the local audio stream.
remoteAudioStats Reports the statistics of the audio stream from each remote user/host.
remoteVideoTransportStats Reports the transport-layer statistics of each remote video stream.
remoteAudioTransportStats Reports the transport-layer statistics of each remote audio stream.
audioDeviceStateChanged Occurs when the audio device state changes.
videoDeviceStateChanged Occurs when the video device state changes.
audioMixingStateChanged Occurs when the state of the local user's audio mixing file changes.
remoteAudioMixingBegin Occurs when a remote user starts audio mixing.
remoteAudioMixingEnd Occurs when a remote user finishes audio mixing.
audioEffectFinished Occurs when the audio effect file playback finishes.
networkQuality Reports the network quality of each user.
lastmileQuality Reports the last-mile network quality of the local user before the user joins a channel.
lastmileProbeResult Reports the last-mile network probe result.
firstLocalAudioFrame Occurs when the first local audio frame is sent.
firstRemoteAudioFrame Occurs when the first remote audio frame is received.
firstRemoteAudioDecoded Occurs when the engine receives the first audio frame from a specified remote user.
firstLocalVideoFrame Occurs when the first local video frame is rendered.
firstRemoteVideoFrame Occurs when the first remote video frame is rendered.
videoSizeChanged Occurs when the video size or rotation information of a specified remote user changes.
addStream Occurs when the SDK decodes the first remote audio frame for playback.
removeStream Occurs when the remote user leaves the channel.
userMuteAudio Occurs when a remote user stops/resumes sending the audio stream.
userMuteVideo Occurs when a remote user stops/resumes sending the video stream.
userEnableVideo Occurs when a remote user enables/disables the video module.
userEnableLocalVideo Occurs when a remote user enables/disables the local video capture.
cameraReady Occurs when the camera turns on and is ready to capture the video.
videoStopped Occurs when the video stops playing.
streamMessage Occurs when the local user receives a remote data stream within five seconds.
streamMessageError Occurs when the local user fails to receive the remote data stream.
audioDeviceVolumeChanged Occurs when the volume of the playback, microphone, or application changes.
localAudioStateChanged Occurs when the local audio state changes.
remoteAudioStateChanged Occurs when the remote audio state changes.
localVideoStateChanged Occurs when the local video state changes.
remoteVideoStateChanged Occurs when the remote video stream state changes.
cameraFocusAreaChanged Occurs when the camera focus area changes.
cameraExposureAreaChanged Occurs when the camera exposure area changes.
streamPublished Adds a CDN stream address.
streamUnpublished Removes a CDN stream address.
transcodingUpdated Occurs when the publisher's transcoding settings are updated.
streamInjectStatus Reports the status of the injected online media stream.
channelMediaRelayState Occurs when the state of the media stream relay changes.
channelMediaRelayEvent Reports events during the media stream relay.
localPublishFallbackToAudioOnly Occurs:
  • When the published media stream falls back to an audio-only stream due to poor network conditions.

  • When the published media stream switches back to the video after the network conditions improve.
  • remoteSubscribeFallbackToAudioOnly Occurs:
  • When the remote media stream falls back to audio-only due to poor network conditions.

  • When the remote media stream switches back to the video after the network conditions improve.
  • videoSourceJoinedSuccess Occurs when a user joins a channel. (The second instance)
    videoSourceRequestNewToken Occurs when the token expires. (The second instance)
    videoSourceLeaveChannel Occurs when a user leaves a channel. (The second instance)

    Error codes and warning codes

    Reports an error code or a warning code during SDK runtime:

    • Error Code: In most cases, the SDK cannot fix the issue and resume running. The SDK requires the application to take action or informs the user about the issue.
    • Warning Code: In most cases, the application can ignore the warning reported by the SDK because the SDK can usually fix the issue and resume running.

    Error codes

    Error code Enumerator Description
    ERR_OK 0 No error occurs.
    ERR_FAILED 1 A general error occurs (no specified reason).
    ERR_INVALID_ARGUMENT 2 An invalid parameter is used. For example, the specific channel name includes illegal characters.
    ERR_NOT_READY 3 The SDK module is not ready.
    ERR_NOT_SUPPORTED 4 The SDK does not support this function.
    ERR_REFUSED 5 The request is rejected. This is for internal SDK use only, and it does not return to the application through any method or callback.
    ERR_BUFFER_TOO_SMALL 6 The buffer size is not big enough to store the returned data.
    ERR_NOT_INITIALIZED 7 The SDK is not initialized before calling this method.
    ERR_NO_PERMISSION 9 No permission exists. This is for internal SDK use only, and it does not return to the application through any method or callback.
    ERR_TIMEDOUT 10 An API method timeout occurs. Some API methods require the SDK to return the execution result, and this error occurs if the request takes too long (more than 10 seconds) for the SDK to process.
    ERR_CANCELED 11 The request is canceled. This is for internal SDK use only, and it does not return to the application through any method or callback.
    ERR_TOO_OFTEN 12 The method is called too often. This is for internal SDK use only, and it does not return to the application through any method or callback.
    ERR_BIND_SOCKET 13 The SDK fails to bind to the network socket. This is for internal SDK use only, and it does not return to the application through any method or callback.
    ERR_NET_DOWN 14 The network is unavailable. This is for internal SDK use only, and it does not return to the application through any method or callback.
    ERR_NET_NOBUFS 15 No network buffers are available. This is for internal SDK internal use only, and it does not return to the application through any method or callback.
    ERR_JOIN_CHANNEL_REJECTED 17 The request to join the channel is rejected. This error usually occurs when the user is already in the channel, and still calls the method to join the channel.
    ERR_LEAVE_CHANNEL_REJECTED 18 The request to leave the channel is rejected. This error usually occurs when the user has left the channel and still calls the method to leave the channel.
    ERR_ALREADY_IN_USE 19 Resources are occupied and cannot be reused.
    ERR_ABORTED 20 The SDK gives up the request due to too many requests.
    ERR_INIT_NET_ENGINE 21 In Windows, specific firewall settings can cause the SDK to fail to initialize and crash.
    ERR_INVALID_VENDOR_KEY 101 The specified App ID is invalid.
    ERR_INVALID_CHANNEL_NAME 102 The specified channel name is invalid.
    ERR_NOT_IN_CHANNEL 113 The user is not in the channel.
    ERR_SIZE_TOO_LARGE 114 The size of the sent data is over 1024 bytes.
    ERR_BITRATE_LIMIT 115 The bitrate of the sent data exceeds the limit of 6 Kbps.
    ERR_SET_CLIENT_ROLE_NOT_AUTHORIZED 119 Switching roles fail.
    ERR_LOAD_MEDIA_ENGINE 1001 Fails to load the media engine.
    ERR_START_CALL 1002 Fails to start the call after enabling the media engine.
    ERR_ADM_GENERAL_ERROR 1005 A general error occurs in the Audio Device Module (no specified reason).
    ERR_ADM_JAVA_RESOURCE 1006 Audio Device Module: An error occurs in using the Java resources.
    ERR_ADM_SAMPLE_RATE 1007 Audio Device Module: An error occurs in setting the sampling frequency.
    ERR_ADM_INIT_PLAYOUT 1008 Audio Device Module: An error occurs in initializing the playback device.
    ERR_ADM_START_PLAYOUT 1009 Audio Device Module: An error occurs in starting the playback device.
    ERR_ADM_STOP_PLAYOUT 1010 Audio Device Module: An error occurs in stopping the playback device.
    ERR_ADM_INIT_RECORDING 1011 Audio Device Module: An error occurs in initializing the recording device.
    ERR_ADM_START_RECORDING 1012 Audio Device Module: An error occurs in starting the recording device.
    ERR_ADM_STOP_RECORDING 1013 Audio Device Module: An error occurs in stopping the recording device.
    ERR_ADM_RUNTIME_PLAYOUT_ERROR 1015 Audio Device Module: A playback error occurs.
    ERR_ADM_RUNTIME_RECORDING_ERROR 1017 Audio Device Module: A recording error occurs.
    ERR_ADM_RECORD_AUDIO_FAILED 1018 Audio Device Module: Fails to record.
    ERR_ADM_INIT_LOOPBACK 1022 Audio Device Module: An error occurs in initializing the loopback device.
    ERR_ADM_START_LOOPBACK 1023 Audio Device Module: An error occurs in starting the loopback device.
    ERR_ADM_NO_PERMISSION 1027 Audio Device Module: No recording permission exists.

    Warning codes

    Warning code Enumerator Description
    WARN_PENDING 20 The request is pending, usually due to some module not being ready, and the SDK postponed processing the request.
    WARN_NO_AVAILABLE_CHANNEL 103 No channel resources are available. Maybe because the server cannot allocate any channel resource.
    WARN_LOOKUP_CHANNEL_TIMEOUT 104 A timeout occurs when looking up the channel. When joining a channel, the SDK looks up the specified channel. This warning usually occurs when the network condition is too poor for the SDK to connect to the server.
    WARN_LOOKUP_CHANNEL_REJECTED 105 The server rejects the request to look up the channel. The server cannot process this request or the request is illegal.
    WARN_OPEN_CHANNEL_TIMEOUT 106 A timeout occurs when opening the channel. Once the specific channel is found, the SDK opens the channel. This warning usually occurs when the network condition is too poor for the SDK to connect to the server.
    WARN_OPEN_CHANNEL_REJECTED 107 The server rejects the request to open the channel. The server cannot process this request or the request is illegal.
    WARN_SET_CLIENT_ROLE_TIMEOUT 118 A timeout occurs when setting the client role in the live broadcast profile.
    WARN_AUDIO_MIXING_OPEN_ERROR 701 An error occurs in opening the audio mixing file.
    WARN_ADM_RUNTIME_PLAYOUT_WARNING 1014 Audio Device Module: a warning occurs in the playback device.
    WARN_ADM_RUNTIME_RECORDING_WARNING 1016 Audio Device Module: a warning occurs in the recording device.
    WARN_ADM_RECORD_AUDIO_SILENCE 1019 Audio Device Module: no valid audio data is collected.
    WARN_ADM_PLAYOUT_MALFUNCTION 1020 Audio Device Module: the playback device fails.
    WARN_ADM_RECORD_MALFUNCTION 1021 Audio Device Module: the recording device fails.
    WARN_ADM_RECORD_MALFUNCTION 1031 Audio Device Module: the recorded audio voice is too low.
    WARN_ADM_HOWLING 1051 Audio Device Module: howling is detected.