logo
On this page

Function Overview


ZEGO SDK has network nodes that fully cover key areas of the world, provides rich APIs, and provides clear and stable real-time voice and video cloud services for multiple terminals.

For the error codes returned by the API, please refer to: https://www.zegocloud.com/docs/video-call/error-code.

The following is a brief introduction to the basic API.

main

MethodDescription
CreateEngineCreate ZegoExpressEngine singleton object and initialize SDK.
DestroyEngineDestroy the ZegoExpressEngine singleton object and deinitialize the SDK.
GetEngineReturns the singleton instance of ZegoExpressEngine.
SetEngineConfigSet advanced engine configuration.
SetLogConfigSet log configuration.
SetRoomModeSet room mode.
GetVersionGets the SDK's version number.
UploadLogUploads logs to the ZEGO server.
SubmitLogUploads logs to the ZEGO server.
EnableDebugAssistantEnable the debug assistant. Note, do not enable this feature in the online version! Use only during development phase!
OnDebugErrorThe callback for obtaining debugging error information.
OnEngineStateUpdateThe callback triggered when the audio/video engine state changes.

room

MethodDescription
LoginRoomLogs in to a room with advanced room configurations. You must log in to a room before publishing or playing streams.
LogoutRoomExit the room.
LogoutRoomExit the room of the specified room ID.
SwitchRoomSwitch the room with advanced room configurations.
SetRoomExtraInfoSet room extra information.
OnRoomStateUpdateNotification of the room connection state changes.
OnRoomUserUpdateThe callback triggered when the number of other users in the room increases or decreases.
OnRoomOnlineUserCountUpdateThe callback triggered every 30 seconds to report the current number of online users.
OnRoomStreamUpdateThe callback triggered when the number of streams published by the other users in the same room increases or decreases.
OnRoomStreamExtraInfoUpdateThe callback triggered when there is an update on the extra information of the streams published by other users in the same room.
OnRoomExtraInfoUpdateThe callback triggered when there is an update on the extra information of the room.

publisher

MethodDescription
StartPublishingStreamStarts publishing a stream (for the specified channel). You can call this function to publish a second stream.
StartPublishingStreamStarts publishing a stream. Support multi-room mode.
StopPublishingStreamStops publishing a stream (for the specified channel).
SetStreamExtraInfoSets the extra information of the stream being published for the specified publish channel.
StartPreviewStarts/Updates the local video preview (for the specified channel).
StopPreviewStops the local preview (for the specified channel).
SetVideoConfigSets up the video configurations (for the specified channel).
GetVideoConfigGets the current video configurations (for the specified channel).
SetVideoMirrorModeSets the video mirroring mode (for the specified channel).
SetAppOrientationSets the video orientation (for the specified channel).
SetAudioConfigSets up the audio configurations for the specified publish channel.
GetAudioConfigGets the current audio configurations.
MutePublishStreamAudioStops or resumes sending the audio part of a stream for the specified channel.
MutePublishStreamVideoStops or resumes sending the video part of a stream for the specified channel.
EnableTrafficControlEnables or disables traffic control.
SetMinVideoBitrateForTrafficControlSet the minimum video bitrate threshold for traffic control.
SetCaptureVolumeSets the audio recording volume for stream publishing.
SetAudioCaptureStereoModeSet audio capture stereo mode.
AddPublishCdnUrlAdds a target CDN URL to which the stream will be relayed from ZEGO RTC server.
RemovePublishCdnUrlDeletes the specified CDN URL, which is used for relaying streams from ZEGO RTC server to CDN.
EnablePublishDirectToCDNWhether to directly push to CDN (without going through the ZEGO RTC server), for the specified channel.
SendSEISends Supplemental Enhancement Information to the specified publish channel.
EnableHardwareEncoderEnables or disables hardware encoding.
SetCapturePipelineScaleModeSets the timing of video scaling in the video capture workflow. You can choose to do video scaling right after video capture (the default value) or before encoding.
OnPublisherStateUpdateThe callback triggered when the state of stream publishing changes.
OnPublisherQualityUpdateCallback for current stream publishing quality.
OnPublisherCapturedAudioFirstFrameThe callback triggered when the first audio frame is captured.
OnPublisherCapturedVideoFirstFrameThe callback triggered when the first video frame is captured.
OnPublisherVideoSizeChangedThe callback triggered when the video capture resolution changes.
OnPublisherRelayCDNStateUpdateThe callback triggered when the state of relayed streaming to CDN changes.

player

MethodDescription
StartPlayingStreamStarts playing a stream from ZEGO RTC server or from third-party CDN. Support multi-room mode.
StopPlayingStreamStops playing a stream.
SetPlayVolumeSets the stream playback volume.
MutePlayStreamAudioWhether the pull stream can receive the specified audio data.
MutePlayStreamVideoWhether the pull stream can receive the specified video data.
EnableHardwareDecoderEnables or disables hardware decoding.
EnableCheckPocEnables or disables frame order detection.
OnPlayerStateUpdateThe callback triggered when the state of stream playing changes.
OnPlayerQualityUpdateCallback for current stream playing quality.
OnPlayerMediaEventThe callback triggered when a media event occurs during streaming playing.
OnPlayerRecvAudioFirstFrameThe callback triggered when the first audio frame is received.
OnPlayerRecvVideoFirstFrameThe callback triggered when the first video frame is received.
OnPlayerRenderVideoFirstFrameThe callback triggered when the first video frame is rendered.
OnPlayerVideoSizeChangedThe callback triggered when the stream playback resolution changes.
OnPlayerRecvSEIThe callback triggered when Supplemental Enhancement Information is received.

IM

MethodDescription
SendBroadcastMessageSends a Broadcast Message.
SendBarrageMessageSends a Barrage Message (bullet screen) to all users in the same room, without guaranteeing the delivery.
SendCustomCommandSends a Custom Command to the specified users in the same room.
OnIMRecvBroadcastMessageThe callback triggered when Broadcast Messages are received.
OnIMRecvBarrageMessageThe callback triggered when Barrage Messages are received.
OnIMRecvCustomCommandThe callback triggered when a Custom Command is received.

mixer

MethodDescription
StartMixerTaskStarts a stream mixing task.
StopMixerTaskStops a stream mixing task.
OnMixerRelayCDNStateUpdateThe callback triggered when the state of relayed streaming of the mixed stream to CDN changes.
OnMixerSoundLevelUpdateThe callback triggered when the sound level of any input stream changes in the stream mixing process.

preprocess

MethodDescription
EnableAECWhether to enable acoustic echo cancellation (AEC).
SetAECModeSets the acoustic echo cancellation (AEC) mode.
EnableAGCEnables or disables automatic gain control (AGC).
EnableANSEnables or disables active noise suppression (ANS, aka ANC).
EnableTransientANSEnables or disables transient noise suppression.
SetANSModeSets the automatic noise suppression (ANS) mode.

mediaPlayer

MethodDescription
CreateMediaPlayerCreates a media player instance.
DestroyMediaPlayerDestroys a media player instance.

record

MethodDescription
StartRecordingCapturedDataStarts to record and directly save the data to a file.
StopRecordingCapturedDataStops recording locally captured audio or video.
OnCapturedDataRecordStateUpdateThe callback triggered when the state of data recording (to a file) changes.
OnCapturedDataRecordProgressUpdateThe callback to report the current recording progress.

device

MethodDescription
MuteMicrophoneMutes or unmutes the microphone.
IsMicrophoneMutedChecks whether the microphone is muted.
MuteSpeakerMutes or unmutes the audio output speaker.
IsSpeakerMutedChecks whether the audio output speaker is muted.
GetAudioDeviceListGets a list of audio devices.
UseAudioDeviceChooses to use the specified audio device.
EnableAudioCaptureDeviceEnables or disables the audio capture device.
EnableCameraTurns on/off the camera (for the specified channel).
UseFrontCameraSwitches to the front or the rear camera (for the specified channel).
UseVideoDeviceChooses to use the specified video device (for the specified channel).
GetVideoDeviceListGets a list of video devices.
StartSoundLevelMonitorStarts sound level monitoring. Support setting the listening interval.
StartSoundLevelMonitorStarts sound level monitoring. Support enable some advanced feature.
StopSoundLevelMonitorStops sound level monitoring.
StartAudioSpectrumMonitorStarts audio spectrum monitoring. Support setting the listening interval.
StopAudioSpectrumMonitorStops audio spectrum monitoring.
EnableHeadphoneMonitorEnables or disables headphone monitoring.
SetHeadphoneMonitorVolumeSets the headphone monitor volume.
OnCapturedSoundLevelUpdateThe local captured audio sound level callback.
OnRemoteSoundLevelUpdateThe remote playing streams audio sound level callback.
OnCapturedAudioSpectrumUpdateThe local captured audio spectrum callback.
OnRemoteAudioSpectrumUpdateThe remote playing streams audio spectrum callback.
OnLocalDeviceExceptionOccurredThe callback triggered when a local device exception occurred.
OnRemoteCameraStateUpdateThe callback triggered when the state of the remote camera changes.
OnRemoteMicStateUpdateThe callback triggered when the state of the remote microphone changes.

customVideoIO

MethodDescription
EnableCustomVideoRenderEnables or disables custom video rendering.
EnableCustomVideoCaptureEnables or disables custom video capture (for the specified channel).
SendCustomVideoCaptureRawDataSends the video frames (Raw Data) produced by custom video capture to the SDK (for the specified channel).
SendCustomVideoCaptureRawDataSends the video frames (Raw Data) produced by custom video capture to the SDK (for the specified channel).
OnCustomVideoCaptureStartCustomize the notification of the start of video capture.
OnCustomVideoCaptureStopCustomize the notification of the end of the collection.
OnCapturedVideoFrameRawDataWhen custom video rendering is enabled, the original video frame data collected by the local preview is called back.
OnRemoteVideoFrameRawDataWhen custom video rendering is enabled, the remote end pulls the original video frame data to call back, and distinguishes different streams by streamID.
EnableCustomVideoProcessingEnables or disables custom video processing, and support specifying the publish channel.

customAudioIO

MethodDescription
StartAudioDataObserverEnable audio data observering.
StopAudioDataObserverDisable audio data observering.
EnableCustomAudioIOEnables the custom audio I/O function (for the specified channel), support PCM, AAC format data.
SendCustomAudioCaptureAACDataSends AAC audio data produced by custom audio capture to the SDK (for the specified channel).
SendCustomAudioCapturePCMDataSends PCM audio data produced by custom audio capture to the SDK (for the specified channel).
FetchCustomAudioRenderPCMDataFetches PCM audio data of the remote stream from the SDK for custom audio rendering.
OnCapturedAudioDataThe callback for obtaining the audio data captured by the local microphone.
OnPlaybackAudioDataThe callback for obtaining the audio data of all the streams playback by SDK.
OnMixedAudioDataCallback to get the audio data played by the SDK and the audio data captured by the local microphone. The audio data is the data mixed by the SDK.
OnPlayerAudioDataThe callback for obtaining the audio data of each stream.

CopyrightedMusic

MethodDescription
CreateCopyrightedMusicCreates a copyrighted music instance.
DestroyCopyrightedMusicDestroys a copyrighted music instance.
InitCopyrightedMusicInitialize the copyrighted music module.
GetCacheSizeGet cache size.
ClearCacheClear cache.
SendExtendedRequestSend extended feature request.
GetLrcLyricGet lyrics in lrc format.
GetKrcLyricByTokenGet lyrics in krc format.
DownloadDownload music resource.
GetDurationGet the playing time of a song or accompaniment file.
OnDownloadProgressUpdateCallback for download song or accompaniment progress rate.

deprecated_api

MethodDescription
EnableBeautify[Deprecated] Enables or disables the beauty features for the specified publish channel. Deprecated since 2.16.0, please use the [enableEffectsBeauty] function instead.
SetBeautifyOption[Deprecated] Set beautify option. Deprecated since 2.16.0, please use the [setEffectsBeautyParam] function instead.
CreateEngine[Deprecated] Create ZegoExpressEngine singleton object and initialize SDK. Deprecated since 2.14.0, please use the method with the same name without [isTestEnv] parameter instead. Please refer to Testing environment deprecation for more details.
RequestSong[Deprecated] Request a song. Deprecated since 3.0.2, please use the [requestResource] function instead.
RequestAccompaniment[Deprecated] Request accompaniment. Deprecated since 3.0.2, please use the [requestResource] function instead.
GetMusicByToken[Deprecated] Get a song or accompaniment. Deprecated since 3.0.2, please use the [getSharedResource] function instead.
GetLrcLyric[Deprecated] Get lyrics in lrc format. Deprecated since 3.2.1, please use the method with the same name with [vendorID] parameter instead.

Previous

FAQ

Next

Class

On this page

Back to top