logo
Video Call
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.
getVersionGets the SDK's version number.
setApiCalledCallbackSet method execution result callback.
isFeatureSupportedQuery whether the current SDK supports the specified feature.
setEventHandlerSets up the event notification callbacks that need to be handled. If the eventHandler is set to [null], all the callbacks set previously will be cleared.
setRoomScenarioSet room scenario.
uploadLogUploads logs to the ZEGO server, with callback.
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.
onApiCalledResultMethod execution result callback
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 with callback.
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).
setAppOrientationSets the video orientation (for the specified channel).
setAudioConfigSets up the audio configurations for the specified publish channel.
getAudioConfigGets the current audio configurations from the specified publish channel.
setPublishStreamEncryptionKeySet encryption key for 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.
enableTrafficControlEnables or disables the traffic control for the specified publish channel.
setMinVideoBitrateForTrafficControlSets the minimum video bitrate for traffic control for the specified publish channel.
setMinVideoFpsForTrafficControlSets the minimum video frame rate threshold for traffic control.
setMinVideoResolutionForTrafficControlSets the minimum video resolution threshold for traffic control.
setCaptureVolumeSets the audio recording volume for stream publishing.
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.
isVideoEncoderSupportedWhether the specified video encoding type is supported.
setAppOrientationModeSet the orientation mode of the video.
setVideoSourceSet a video capture instance as video capture source for the specified channel.
setAudioSourceSet audio capture source for the specified channel.
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.
onPublisherRenderVideoFirstFrameThe callback triggered when the first video frame is rendered.
onPublisherVideoSizeChangedThe callback triggered when the video capture resolution changes.
onPublisherRelayCDNStateUpdateThe callback triggered when the state of relayed streaming to CDN changes.
onPublisherVideoEncoderChangedThe callback triggered when the video encoder changes in publishing stream.
onPublisherStreamEventThe callback triggered when publishing stream.

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.
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.
onPlayerRenderCameraVideoFirstFrameCalls back when the stream playing end renders the first frame of the video from the remote camera.
onPlayerVideoSizeChangedThe callback triggered when the stream playback resolution changes.
onPlayerRecvSEIThe callback triggered when Supplemental Enhancement Information is received.
onPlayerRecvAudioSideInfoReceive the audio side information content of the remote stream.
onPlayerLowFpsWarningPlaying stream low frame rate warning.
onPlayerStreamEventThe callback triggered when playing stream.
onPlayerVideoSuperResolutionUpdatePlaying stream video super resolution enabled state changes.

IM

MethodDescription
sendCustomCommandSends a Custom Command to the specified users in the same room.
onIMRecvCustomCommandThe callback triggered when a Custom Command is received.

preprocess

MethodDescription
enableAECWhether to enable acoustic echo cancellation (AEC).
enableHeadphoneAECWhether to turn on acoustic echo cancellation (AEC) when using the headphone.
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.
startEffectsEnvEnable the Effects beauty environment.
stopEffectsEnvDisable the Effects beauty environment.
enableEffectsBeautyEnables or disables the beauty effect.
setEffectsBeautyParamSet beautify param.
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.
enablePlayStreamVirtualStereoEnable or disable the virtual stereo effect when playing stream.
setElectronicEffectsTurn on or off the electronic sound effect.

mediaPlayer

MethodDescription
createMediaPlayerCreates a media player instance.
destroyMediaPlayerDestroys a media player instance.
loadResourceWithConfigLoad local or network media resource with config.
startStart playing.
stopStop playing.

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.
startAudioDeviceVolumeMonitorTurn on audio device volume monitoring.
stopAudioDeviceVolumeMonitorTurn off audio device volume monitoring. Only for Windows/macOS.
muteAudioDeviceMutes or unmutes the audio device.
setAudioDeviceModeSet the audio device mode.
isAudioDeviceMutedCheck if the audio device is muted.
enableAudioCaptureDeviceEnables or disables the audio capture device.
getAudioRouteTypeget current audio route type.
setAudioRouteToSpeakerWhether to use the built-in speaker to play audio.
enableCameraTurns on/off the camera (for the specified channel).
useFrontCameraSwitches to the front or the rear camera (for the specified channel).
isCameraFocusSupportedWhether the camera supports focusing.
setCameraFocusModeSet the camera focus mode.
setCameraFocusPointInPreviewSet the focus point in the preview view.
setCameraExposureModeSet the camera exposure mode.
setCameraExposurePointInPreviewSet the exposure point in the preview view.
setCameraExposureCompensationSet the camera exposure compensation value and support spedifying the publish channel.
setCameraZoomFactorSet the zoom factor of the camera and support specifying the publish channel. Every time the camera is restarted, the camera zoom factor will return to the initial value (1.0).
getCameraMaxZoomFactorGet the maximum zoom factor of the camera and support specifying the publish channel.
enableCameraAdaptiveFPSEnable camera adaptive frame rate.
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 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).
onCapturedSoundLevelInfoUpdateThe local captured audio sound level callback, supported vad.
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.
onAudioRouteChangeCallback for device's audio route changed.
onAudioVADStateUpdateCallback for audio VAD stable state update.
getCurrentAudioDeviceGet the audio device information currently in use.

utilities

MethodDescription
startPerformanceMonitorStart system performance monitoring.
stopPerformanceMonitorStop system performance monitoring.
startNetworkSpeedTestStart network speed test. Support set speed test interval。
stopNetworkSpeedTestStop network speed test.
onPerformanceStatusUpdateSystem performance monitoring callback.
onNetworkSpeedTestErrorNetwork speed test error callback.
onNetworkSpeedTestQualityUpdateNetwork speed test quality callback.
onNetworkQualityThe network quality callback of users who are publishing in the room.

ScreenCapture

MethodDescription
setAppGroupIDSet the App Group configuration item.
startScreenCaptureInAppStart screen capture, in-app capture only.
startScreenCaptureStart screen capture.
stopScreenCaptureStop screen capture.
updateScreenCaptureConfigUpdate screen capture parameter configuration.
onScreenCaptureExceptionOccurredThe callback triggered when a screen capture source exception occurred.
onScreenCaptureStartThe callback triggered when start screen capture.

Previous

FAQ

Next

Class

On this page

Back to top