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.
setEngineConfigSet advanced engine configuration.
setLogConfigSet log configuration.
setRoomModeSet room mode.
setGeoFenceSet Geo Fence.
getVersionGets the SDK's version number.
isFeatureSupportedQuery whether the current SDK supports the specified feature.
setRoomScenarioSet room scenario.
uploadLogUploads logs to the ZEGO server.
enableDebugAssistantEnable the debug assistant. Note, do not enable this feature in the online version! Use only during development phase!
callExperimentalAPICall the experimental API.
onDebugErrorThe callback for obtaining debugging error information.
onEngineStateUpdateThe callback triggered when the audio/video engine state changes.
onRecvExperimentalAPIExperimental API callback

room

MethodDescription
loginRoomLog in to the room by configuring advanced properties, and return the login result through the callback parameter. You must log in to the room before pushing or pulling the stream.
logoutRoomExit the room of the specified room ID.
switchRoomSwitch the room with advanced room configurations.
renewTokenRenew token.
setRoomExtraInfoSet room extra information.
onRoomStateUpdateNotification of the room connection state changes.
onRoomStateChangedNotification of the room connection state changes, including specific reasons for state change.
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.
onRoomTokenWillExpireCallback notification that room Token authentication is about to expire.

publisher

MethodDescription
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).
setAudioConfigSets up the audio configurations.
setAudioConfigWithChannelSets up the audio configurations for the specified publish channel.
getAudioConfigGets the current audio configurations.
setPublishStreamEncryptionKeySet encryption key for the publishing stream for the specified publish channel.
takePublishStreamSnapshotTake a snapshot of the publishing stream for the specified publish channel.
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.
setStreamAlignmentPropertyEnable or disable the stream precision alignment function.
enableTrafficControlEnables or disables the traffic control for the specified publish channel.
setMinVideoBitrateForTrafficControlSet the minimum video bitrate threshold for traffic control.
setMinVideoFpsForTrafficControlSets the minimum video frame rate threshold for traffic control.
setMinVideoResolutionForTrafficControlSets the minimum video resolution threshold for traffic control.
setTrafficControlFocusOnSet the factors of concern that trigger traffic control for the specified publish channel.
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.
setPublishWatermarkSets up the stream watermark before stream publishing (for the specified channel).
setSEIConfigSet the Supplemental Enhancement Information type.
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.
setDummyCaptureImagePathSet the path of the static picture would be published when the camera is closed.
enableH265EncodeFallbackWhether to enable H.265 encoding to automatically downgrade to H.264 encoding.
isVideoEncoderSupportedWhether the specified video encoding type and implementation are supported.
setLowlightEnhancementSet low light enhancement.
setVideoSourceSet a video capture instance as video capture source for the specified channel.
setAudioSourceSet audio capture source for the specified channel.
setAudioSourceWithConfigSet audio capture source with audio mix config.
enableVideoObjectSegmentationEnable video object segmentation.
enableAlphaChannelVideoEncoderEnable video encoder alpha channel support.
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.
onPublisherSendAudioFirstFrameThe callback triggered when the first audio frame is sent.
onPublisherSendVideoFirstFrameThe callback triggered when the first video frame is sent.
onPublisherVideoSizeChangedThe callback triggered when the video capture resolution changes.
onPublisherRelayCDNStateUpdateThe callback triggered when the state of relayed streaming to CDN changes.
onVideoObjectSegmentationStateChangedThe video object segmentation state changed.

player

MethodDescription
startPlayingStreamStarts playing a stream from ZEGO RTC server or from third-party CDN. Support multi-room mode.
stopPlayingStreamStops playing a stream.
setPlayStreamDecryptionKeySet decryption key for the playing stream.
takePlayStreamSnapshotTake a snapshot of the playing stream.
setPlayVolumeSets the stream playback volume.
setAllPlayStreamVolumeSets the all stream playback volume.
setPlayStreamVideoTypeSet play video stream type.
setPlayStreamBufferIntervalRangeSet the adaptive adjustment interval range of the buffer for playing stream.
setPlayStreamFocusOnSet the weight of the pull stream priority.
mutePlayStreamAudioWhether the pull stream can receive the specified audio data.
mutePlayStreamVideoWhether the pull stream can receive the specified video data.
muteAllPlayStreamAudioCan the pull stream receive all audio data. (When set to true, calling [mutePlayStreamAudio] will not take effect)
muteAllPlayStreamVideoCan the pull stream receive all video data. (When set to true, calling [mutePlayStreamVideo] will not take effect)
enableHardwareDecoderEnables or disables hardware decoding.
enableCheckPocEnables or disables frame order detection.
isVideoDecoderSupportedWhether the specified video decoding format is supported.
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.
onPlayerSyncRecvSEIThe callback triggered when Supplemental Enhancement Information is received synchronously.

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.

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.
setAudioEqualizerGainSet the sound equalizer (EQ).
setVoiceChangerPresetSetting up the voice changer via preset enumeration.
setVoiceChangerParamSetting up the specific voice changer parameters.
setReverbPresetSetting up the reverberation via preset enumeration.
setReverbAdvancedParamSetting up the specific reverberation parameters.
setReverbEchoParamSetting up the specific reverberation echo parameters.
enableVirtualStereoEnable or disable the virtual stereo effect when publishing stream.

mediaPlayer

MethodDescription
createMediaPlayerCreates a media player instance.
destroyMediaPlayerDestroys a media player instance.
loadResourceLoad local or network media resource.
loadResourceWithPositionLoad local or network media resource and specify the start position.
loadCopyrightedMusicResourceWithPositionLoad copyrighted music resource.
startStart playing.
stopStop playing.
pausePause playing.
resumeResume playing.
seekToSet the specified playback progress.
enableRepeatWhether to repeat playback.
enableAuxWhether to mix the player's sound into the stream being published.
muteLocalWhether to play locally silently.
setPlayerViewSet the view of the player playing video.
setVolumeSet mediaplayer volume. Both the local play volume and the publish volume are set.
setPlayVolumeSet mediaplayer local playback volume.
setPublishVolumeSet mediaplayer publish volume.
setProgressIntervalSet playback progress callback interval.
getPlayVolumeGets the current local playback volume of the mediaplayer, the range is 0 ~ 200, with the default value of 60.
getPublishVolumeGets the current publish volume of the mediaplayer, the range is 0 ~ 200, with the default value of 60.
getTotalDurationGet the total progress of your media resources.
getCurrentProgressGet current playing progress.
getCurrentRenderingProgressGet current rendering progress.
getAudioTrackCountGet the number of audio tracks of the playback file.
setAudioTrackIndexSet the audio track of the playback file.
getCurrentStateGet the current playback status.
getIndexGet media player index.
takeSnapshotTake a screenshot of the current playing screen of the media player.
enableSoundLevelMonitorWhether to enable sound level monitoring.
enableFrequencySpectrumMonitorWhether to enable frequency spectrum monitoring.
getMediaInfoGet meida information such as video resolution from media file.
enablePublishVideoWhether to mix the player's video into the stream being published.
getCustomVideoCapturePluginGet the custom video capture plugin of the media player
registerCustomAudioProcessPluginRegister custom audio data processing plugin for mediaplayer.
unregisterCustomAudioProcessPluginUnregister custom audio processing plugin for mediaplayer.
enableLiveAudioEffectEnable live audio effect.
enableLocalCacheEnable local caching of http/https network resources.
onMediaPlayerStateUpdateMediaPlayer playback status callback.
onMediaPlayerNetworkEventThe callback triggered when the network status of the media player changes.
onMediaPlayerPlayingProgressThe callback to report the current playback progress of the media player.
onMediaPlayerRenderingProgressThe callback to report the current rendering progress of the media player.
onMediaPlayerVideoSizeChangedThe callback triggered when when the resolution of the playback video changes.
onMediaPlayerLoadResourceCallback to the result of media player loading resources.
onMediaPlayerVideoDataCallback to mediaplayer video data.
onMediaPlayerRecvSEIThe callback triggered when the media player got media side info.
onMediaPlayerSoundLevelUpdateThe callback of sound level update.
onMediaPlayerFrequencySpectrumUpdateThe callback of frequency spectrum update.
onMediaPlayerFirstFrameEventThe callback triggered when the media player plays the first frame.
onMediaPlayerLocalCacheThe callback triggered when the media player caches http/https network resource locally.

audioEffectPlayer

MethodDescription
createAudioEffectPlayerCreates a audio effect player instance.
destroyAudioEffectPlayerDestroys a audio effect player instance.
startStart playing audio effect.
stopStop playing audio effect.
pausePause playing audio effect.
resumeResume playing audio effect.
stopAllStop playing all audio effect.
pauseAllPause playing all audio effect.
resumeAllResume playing all audio effect.
seekToSet the specified playback progress.
setVolumeSet volume for a single audio effect. Both the local play volume and the publish volume are set.
setVolumeAllSet volume for all audio effect. Both the local play volume and the publish volume are set.
setPlaySpeedSet the playback speed for a given audio effect. Both the local play speed and the publish speed are set. (separate settings are not supported).
getTotalDurationGet the total duration of the specified audio effect resource.
getCurrentProgressGet current playback progress.
loadResourceLoad audio effect resource.
unloadResourceUnload audio effect resource.
getIndexGet audio effect player index.
onAudioEffectPlayStateUpdateAudio effect playback state callback.

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.
getDefaultAudioDeviceIDGet the device ID of the default audio device.
useAudioDeviceChooses to use the specified audio device.
getAudioDeviceVolumeGet volume for the specified audio device.
setAudioDeviceVolumeSet volume for the specified audio device.
setSpeakerVolumeInAPPSet the volume of the speaker in the App.
getSpeakerVolumeInAPPGet the volume of the speaker in the App, only support Windows.
startAudioDeviceVolumeMonitorTurn on audio device volume monitoring.
stopAudioDeviceVolumeMonitorTurn off audio device volume monitoring. Only for Windows/macOS.
muteAudioDeviceMutes or unmutes the audio device.
enableAudioCaptureDeviceEnables or disables the audio capture device.
enableCameraTurns on/off the camera (for the specified channel).
useVideoDeviceChooses to use the specified video device (for the specified channel).
getVideoDeviceListGets a list of video devices.
getDefaultVideoDeviceIDGet the device ID of the default video device.
startSoundLevelMonitorStarts sound level monitoring. Support setting the listening interval.
startSoundLevelMonitorWithConfigStarts 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.
enableMixSystemPlayoutEnable or disable system audio capture.
setMixSystemPlayoutVolumeset system audio capture volume.
enableMixEnginePlayoutEnable or disable mix SDK playout to stream publishing.
startAudioVADStableStateMonitorStart audio VAD stable state monitoring, and the monitoring period can be set.
stopAudioVADStableStateMonitorStop audio VAD stable state monitoring.
onAudioDeviceStateChangedThe callback triggered when there is a change to audio devices (i.e. new device added or existing device deleted).
onAudioDeviceVolumeChangedThe callback triggered when there is a change of the volume for the audio devices.
onVideoDeviceStateChangedThe callback triggered when there is a change to video devices (i.e. new device added or existing device deleted).
onCapturedSoundLevelUpdateThe local captured audio sound level callback.
onCapturedSoundLevelInfoUpdateThe local captured audio sound level callback, supported vad.
onRemoteSoundLevelUpdateThe remote playing streams audio sound level callback.
onLocalCaptureVideoDataCallback to local capture video data.
onRemotePlayVideoDataCallback to play stream video data.
onRemoteSoundLevelInfoUpdateThe remote playing streams audio sound level callback, supported vad.
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.
onRemoteSpeakerStateUpdateThe callback triggered when the state of the remote speaker changes.
onAudioVADStateUpdateCallback for audio VAD stable state update.
getCurrentAudioDeviceGet the audio device information currently in use.

customVideoIO

MethodDescription
enableCustomVideoCaptureEnables or disables custom video capture (for the specified channel).
enableExternalRenderenable/disable external render, when external rendering is enabled, data rendering will no longer take place inside the SDK.
registerCustomVideoCapturePluginregister custom video capture plugin
unregisterCustomVideoCapturePluginunregister custom video capture plugin
enableCameraVideoDataCapturePluginEnable or disable the camera video data capture plugin
getCameraVideoDataCapturePluginGet the camera video data capture plugin, it needs to call interface [enableCameraVideoDataCapturePlugin] open to use.
setCustomVideoCaptureFillModeSets the video fill mode of custom video capture (for the specified channel).
setCustomVideoCaptureRegionOfInterestSet the region of interest (ROI) for encoder of custom video capture (for the specified channel).
enableCustomVideoProcessingEnables or disables custom video processing, and support specifying the publish channel.
registerCustomVideoProcessPluginRegister custom video process plugin
setCustomVideoProcessCutRegionSet the custom video process crop region

customAudioIO

MethodDescription
enableCustomAudioCaptureProcessingEnable local collection and custom audio processing(before ear return).
registerCustomAudioProcessPluginRegister custom audio processing plugin.
unregisterCustomAudioProcessPluginUnregister custom audio processing plugin.
enableCustomAudioCaptureProcessingAfterHeadphoneMonitorTurn on local collection and custom audio processing (after ear return).
enableCustomAudioIOEnables the custom audio I/O function (for the specified channel), support PCM, AAC format data.
registerCustomAudioCapturePluginregister custom audio capture plugin
unregisterCustomAudioCapturePluginunregister custom audio capture plugin

utilities

MethodDescription
startNetworkSpeedTestStart network speed test. Support set speed test interval。
stopNetworkSpeedTestStop network speed test.
getNetworkTimeInfoObtain synchronization network time information.
onNetworkModeChangedNetwork mode changed callback.
onNetworkSpeedTestErrorNetwork speed test error callback.
onNetworkSpeedTestQualityUpdateNetwork speed test quality callback.
onNetworkQualityThe network quality callback of users who are publishing in the room.

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.
getLrcLyricWithVendorIDGet lyrics in lrc format.
getLrcLyricWithConfigGet lyrics in lrc format.
getKrcLyricByTokenGet lyrics in krc format.
requestResourceRequest music resource.
requestResourceWithConfigV2Request music resource.
getSharedResourceGet shared music resource.
getSharedResourceWithConfigV2Get shared music resource.
downloadDownload music resource.
queryCacheWithConfigQuery the resource's cache is existed or not.
queryCacheWithConfigV2Query the resource's cache is existed or not.
getDurationGet the playing time of a song or accompaniment file.
setScoringLevelSet the difficulty level of scoring.
startScoreStart scoring.
pauseScorePause scoring.
resumeScoreResume scoring.
stopScoreStop scoring.
resetScoreReset scoring.
getPreviousScoreGet the score of the previous sentence.
getAverageScoreGet average score.
getTotalScoreGet total score .
getFullScoreGet full score .
getStandardPitchGet standard pitch data.
getCurrentPitchGet real-time pitch data.
onDownloadProgressUpdateCallback for download song or accompaniment progress rate.
onCurrentPitchValueUpdateReal-time pitch line callback.

ScreenCapture

MethodDescription
getScreenCaptureSourcesGet a list of screens or windows in a screen.
createScreenCaptureSourceCreate the screen capture source
destroyScreenCaptureSourceDestroy the screen capture source instance
updateCaptureSourceCreate the screen capture source
startCaptureStart screen capture.
stopCaptureStop screen capture.
getCaptureSourceRectGets the rectangle of the screen capture source.
updateCaptureRegionUpdate the area captured by the screen.
updatePublishRegionUpdate the streaming area of ​​the screen capture.
setExcludeWindowListSets the filtered list of windows.
enableWindowActivateWhether to activate the promotion of the window to the foreground.
enableCursorVisibleSet whether to show the cursor
enableHightLightSet whether to highlight the capture area
getIndexGet screen capture source index.
onExceptionOccurredThe callback triggered when a screen capture source exception occurred
onCaptureTypeExceptionOccurredThe callback triggered when a screen capture source capture type exception occurred
onWindowStateChangedThe callback will be triggered when the state of the capture target window change.
onRectChangedThe callback will be triggered when the state of the capture target window change.

deprecated_api

MethodDescription
init[Deprecated] Initializes the Engine. Deprecated since 2.14.0, please use the method [createEngine] instead.
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.
requestAccompanimentClip[Deprecated] Request accompaniment clip. 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 [getLrcLyricWithVendorID].
queryCache[Deprecated] Query the resource's cache is existed or not. Deprecated since 3.2.1, please use the method [queryCacheWithVendorID].
queryCacheWithVendorID[Deprecated] Query the resource's cache is existed or not. Deprecated since 3.9.0, please use the method [queryCacheWithConfig] with the name with [config] parameter instead.
setVoiceChangerParam[Deprecated] Setting up the specific voice changer parameters.
enableAudioCapture[Deprecated] Whether to collect the sound of the window process during window collection

Previous

FAQ

Next

Class

On this page

Back to top