ZegoExpressEngine

Declared in ZegoExpressEngine.h

Includes

Public-Static-Func Lists

Public-Func Lists

Public-Static-Func Docs

createEngineWithAppID:appSign:isTestEnv:scenario:eventHandler:

+ (ZegoExpressEngine *)createEngineWithAppID:(unsigned int) appID appSign:(NSString *) appSign isTestEnv:(BOOL) isTestEnv scenario:(ZegoScenario) scenario eventHandler:(nullable id< ZegoEventHandler >) eventHandler;

Create engine singleton instance.

Parameters
appID Application ID issued by ZEGO for developers, please apply from the ZEGO Admin Console . The value ranges from 0 to 4294967295.
appSign Application signature for each AppID, please apply from the ZEGO Admin Console. Application signature is a 64 character string. Each character has a range of '0' ~ '9', 'a' ~ 'z'.
isTestEnv Choose to use a test environment or a formal commercial environment, the formal environment needs to submit work order configuration in the ZEGO management console. The test environment is for test development, with a limit of 30 rooms and 230 users. Official environment App is officially launched. ZEGO will provide corresponding server resources according to the configuration records submitted by the developer in the management console. The test environment and the official environment are two sets of environments and cannot be interconnected.
scenario The application scenario. Developers can choose one of ZegoScenario based on the scenario of the app they are developing, and the engine will preset a more general setting for specific scenarios based on the set scenario. After setting specific scenarios, developers can still call specific api to set specific parameters if they have customized parameter settings.
eventHandler Event notification callback. [nil] means not receiving any callback notifications.It can also be managed later via [setEventHandler]

destroyEngine:

+ (void)destroyEngine:(ZegoDestroyCompletionCallbacknullable ) callback;

Destroy engine singleton object asynchronously.

Parameters
callback Notification callback for destroy engine completion. Developers can listen to this callback to ensure that device hardware resources are released. This callback is only used to notify the completion of the release of internal resources of the engine. Developers cannot release resources related to the engine within this callback. If the developer only uses SDK to implement audio and video functions, this parameter can be passed [nil].

sharedEngine

+ (ZegoExpressEngine *)sharedEngine:;

Returns engine singleton instance.

setEngineConfig:

+ (void)setEngineConfig:(ZegoEngineConfig *) config;

Set the advanced engine configuration, which will only take effect before create engine.

Parameters
config Advanced engine configuration

getVersion

+ (NSString *)getVersion:;

Get SDK version number.

Public-Func Docs

setEventHandler:

- (void)setEventHandler:(nullable id< ZegoEventHandler >) eventHandler;

Set event notification callback, set [nil] to clears the set callback.

Parameters
eventHandler Event notification callback. Developers should override callback related methods to focus on specific notifications based on their own business scenarios. The main callback methods of SDK are in [IZegoEventHandler].

uploadLog

- (void)uploadLog:;

Upload logs to ZEGO server.

setDebugVerbose:language:

- (void)setDebugVerbose:(BOOL) enable language:(ZegoLanguage) language;

Set debug details switch and language.

Parameters
enable Detailed debugging information switch
language Debugging information language

setCustomVideoRenderHandler:

- (void)setCustomVideoRenderHandler:(nullable id< ZegoCustomVideoRenderHandler >) handler;

Set the custom video render handler.

Parameters
handler Custom video render handler

setCustomVideoCaptureHandler:

- (void)setCustomVideoCaptureHandler:(nullable id< ZegoCustomVideoCaptureHandler >) handler;

Set the custom video capture handler.

Parameters
handler Custom video capture handler

sendCustomVideoCaptureTextureData:size:timeStamp:

- (void)sendCustomVideoCaptureTextureData:(GLuint) textureID size:(CGSize) size timeStamp:(CMTime) timeStamp;

Send texture video frame data to SDK.

Parameters
textureID texture ID
size Video frame width and height
timeStamp Timestamp of this video frame

sendCustomVideoCaptureTextureData:size:timeStamp:channel:

- (void)sendCustomVideoCaptureTextureData:(GLuint) textureID size:(CGSize) size timeStamp:(CMTime) timeStamp channel:(ZegoPublishChannel) channel;

Send texture video frame data to SDK.

sendCustomVideoCapturePixelBuffer:timeStamp:

- (void)sendCustomVideoCapturePixelBuffer:(CVPixelBufferRef) buffer timeStamp:(CMTime) timeStamp;

Send texture video frame data to SDK.

Parameters
buffer Video frame data to send to the SDK
timeStamp Timestamp of this video frame

sendCustomVideoCapturePixelBuffer:timeStamp:channel:

- (void)sendCustomVideoCapturePixelBuffer:(CVPixelBufferRef) buffer timeStamp:(CMTime) timeStamp channel:(ZegoPublishChannel) channel;

Send texture video frame data to SDK.

setCustomVideoCaptureFillMode:

- (void)setCustomVideoCaptureFillMode:(ZegoViewMode) mode;

Set custom video capture fill mode.

Parameters
mode View mode

setCustomVideoCaptureFillMode:channel:

- (void)setCustomVideoCaptureFillMode:(ZegoViewMode) mode channel:(ZegoPublishChannel) channel;

Set custom video capture fill mode.

muteMicrophone:

- (void)muteMicrophone:(BOOL) mute;

Whether to mute microphone input.

Parameters
mute Whether to turn off the microphone, YES: turn off microphone, NO: turn on microphone. The default is YES.

muteSpeaker:

- (void)muteSpeaker:(BOOL) mute;

Whether to mute speaker output.

Parameters
mute Whether to disable audio output to the device, YES: disable audio output, NO: enable audio output. The default value is NO

useAudioDevice:deviceType:

- (void)useAudioDevice:(NSString *) deviceID deviceType:(ZegoAudioDeviceType) deviceType;

Choose to use an audio device.

Parameters
deviceID ID of a device obtained by getAudioDeviceList
deviceType Audio device type

getAudioDeviceList:

- (NSArray< ZegoDeviceInfo * > *)getAudioDeviceList:(ZegoAudioDeviceType) deviceType;

Get a list of audio devices.

Parameters
deviceType Audio device type

enableAudioCaptureDevice:

- (void)enableAudioCaptureDevice:(BOOL) enable;

On/off audio capture device.

Parameters
enable Whether to enable the audio capture device, YES: disable audio capture device, NO: enable audio capture device

setBuiltInSpeakerOn:

- (void)setBuiltInSpeakerOn:(BOOL) enable;

Whether to use the built-in speaker to play sound.

Parameters
enable Whether to use the built-in speaker to play sound, YES: use the built-in speaker to play sound, NO: use the highest priority audio output device scheduled by the current system to play sound

enableCamera:

- (void)enableCamera:(BOOL) enable;

On/off camera.

Parameters
enable Whether to turn on the camera, YES: turn on camera, NO: turn off camera

enableCamera:channel:

- (void)enableCamera:(BOOL) enable channel:(ZegoPublishChannel) channel;

On/off camera.

useFrontCamera:

- (void)useFrontCamera:(BOOL) enable;

Switch front and rear camera.

Parameters
enable Whether to use the front camera, YES: use the front camera, NO: use the the rear camera. The default value is YES

useFrontCamera:channel:

- (void)useFrontCamera:(BOOL) enable channel:(ZegoPublishChannel) channel;

Switch front and rear camera.You can call this api to set params when publishing another streams.

Parameters
enable Whether to use the front camera, YES: use the front camera, NO: use the the rear camera. The default value is YES
channel Publishing stream channel.

useVideoDevice:

- (void)useVideoDevice:(NSString *) deviceID;

Choose to use a video device.

Parameters
deviceID ID of a device obtained by getVideoDeviceList

useVideoDevice:channel:

- (void)useVideoDevice:(NSString *) deviceID channel:(ZegoPublishChannel) channel;

Choose to use a video device.

getVideoDeviceList

- (NSArray< ZegoDeviceInfo * > *)getVideoDeviceList:;

Get a list of video devices.

startSoundLevelMonitor

- (void)startSoundLevelMonitor:;

Start the sound level monitor.

stopSoundLevelMonitor

- (void)stopSoundLevelMonitor:;

Stop the sound level monitor.

startAudioSpectrumMonitor

- (void)startAudioSpectrumMonitor:;

Start the audio spectrum monitor.

stopAudioSpectrumMonitor

- (void)stopAudioSpectrumMonitor:;

Stop the audio spectrum monitor.

sendBroadcastMessage:roomID:callback:

- (void)sendBroadcastMessage:(NSString *) message roomID:(NSString *) roomID callback:(ZegoIMSendBroadcastMessageCallbacknullable ) callback;

Send room broadcast message.

Parameters
message Message content, no longer than 256 bytes
roomID Room ID, a string of up to 128 bytes in length. Only support numbers, English characters and '~', '!', '@', '#', '$', '', '^', '&', '*', '(', ')', '_', '+', '=', '-', ', ';', '’', ',', '.', '<', '>', '/', ''
callback Send broadcast message result callback

sendBarrageMessage:roomID:callback:

- (void)sendBarrageMessage:(NSString *) message roomID:(NSString *) roomID callback:(ZegoIMSendBarrageMessageCallbacknullable ) callback;

Send room barrage message.

Parameters
message Message content, no longer than 256 bytes
roomID Room ID, a string of up to 128 bytes in length. Only support numbers, English characters and '~', '!', '@', '#', '$', '', '^', '&', '*', '(', ')', '_', '+', '=', '-', ', ';', '’', ',', '.', '<', '>', '/', ''
callback Send barrage message result callback

sendCustomCommand:toUserList:roomID:callback:

- (void)sendCustomCommand:(NSString *) command toUserList:(nullable NSArray< ZegoUser * > *) toUserList roomID:(NSString *) roomID callback:(ZegoIMSendCustomCommandCallbacknullable ) callback;

Send custom command.

Parameters
command Custom command content, no longer than 256 bytes
toUserList The users who will receive the command
roomID Room ID, a string of up to 128 bytes in length. Only support numbers, English characters and '~', '!', '@', '#', '$', '', '^', '&', '*', '(', ')', '_', '+', '=', '-', ', ';', '’', ',', '.', '<', '>', '/', ''
callback Send command result callback

createMediaPlayer

- (nullable ZegoMediaPlayer *)createMediaPlayer:;

Create a media player instance object.

destroyMediaPlayer:

- (void)destroyMediaPlayer:(ZegoMediaPlayer *) mediaPlayer;

Destroy a media player instance object.

Parameters
mediaPlayer The media player instance object to be destroyed

startMixerTask:callback:

- (void)startMixerTask:(ZegoMixerTask *) task callback:(ZegoMixerStartCallbacknullable ) callback;

Start mix stream task.

Parameters
task Mix stream task object
callback Start mix stream task result callback notification

stopMixerTask:callback:

- (void)stopMixerTask:(ZegoMixerTask *) task callback:(ZegoMixerStopCallbacknullable ) callback;

Stop mix stream task.

Parameters
task Mix stream task object
callback Stop mix stream task result callback notification

startPlayingStream:canvas:

- (void)startPlayingStream:(NSString *) streamID canvas:(nullable ZegoCanvas *) canvas;

Start playing stream.

Parameters
streamID Stream ID, a string of up to 256 characters. You cannot include URL keywords, otherwise publishing stream and playing stream will fails. Only support numbers, English characters and '~', '!', '@', '#', '$', '', '^', '&', '*', '(', ')', '_', '+', '=', '-', ', ';', '’', ',', '.', '<', '>', '/', ''.
canvas The view used to display the play audio and video stream's image. If the view is set to [nil], it will not be displayed.

startPlayingStream:canvas:config:

- (void)startPlayingStream:(NSString *) streamID canvas:(nullable ZegoCanvas *) canvas config:(ZegoPlayerConfig *) config;

Start playing stream.

Parameters
streamID Stream ID, a string of up to 256 characters. You cannot include URL keywords, otherwise publishing stream and playing stream will fails. Only support numbers, English characters and '~', '!', '@', '#', '$', '', '^', '&', '*', '(', ')', '_', '+', '=', '-', ', ';', '’', ',', '.', '<', '>', '/', ''.
canvas The view used to display the play audio and video stream's image. If the view is set to [nil], it will not be displayed.
config Advanced player configuration

stopPlayingStream:

- (void)stopPlayingStream:(NSString *) streamID;

Stop playing stream.

Parameters
streamID Stream ID

setPlayVolume:streamID:

- (void)setPlayVolume:(int) volume streamID:(NSString *) streamID;

Set the playback volume of the stream.

Parameters
volume Volume percentage. The value ranges from 0 to 100, and the default value is 100.
streamID Stream ID

mutePlayStreamAudio:streamID:

- (void)mutePlayStreamAudio:(BOOL) mute streamID:(NSString *) streamID;

Stop/resume playing the audio data of the stream.

Parameters
mute mute flag, YES: mute play stream video, NO: resume play stream video
streamID Stream ID

mutePlayStreamVideo:streamID:

- (void)mutePlayStreamVideo:(BOOL) mute streamID:(NSString *) streamID;

Stop/resume playing the video data of the stream.

Parameters
mute mute flag, YES: mute play stream video, NO: resume play stream video
streamID Stream ID

enableHardwareDecoder:

- (void)enableHardwareDecoder:(BOOL) enable;

On/off hardware decoding.

Parameters
enable Whether to turn on hardware decoding switch, YES: enable hardware decoding, NO: disable hardware decoding. The default is NO

enableCheckPoc:

- (void)enableCheckPoc:(BOOL) enable;

On/off frame order detection.

Parameters
enable Whether to turn on frame order detection, YES: enable check poc,not support B frames, NO: disable check poc, support B frames but the screen may temporary splash. The default is YES

enableAEC:

- (void)enableAEC:(BOOL) enable;

On/off echo cancellation.

Parameters
enable Whether to enable echo cancellation, YES: enable echo cancellation, NO: disable echo cancellation

setAECMode:

- (void)setAECMode:(ZegoAECMode) mode;

Set echo cancellation mode.

Parameters
mode Echo cancellation mode

enableAGC:

- (void)enableAGC:(BOOL) enable;

On/off automatic gain control.

Parameters
enable Whether to enable automatic gain control, YES: enable AGC, NO: disable AGC

enableANS:

- (void)enableANS:(BOOL) enable;

On/off noise suppression.

Parameters
enable Whether to enable noise suppression, YES: enable AGC, NO: disable AGC

enableBeautify:

- (void)enableBeautify:(ZegoBeautifyFeature) featureBitmask;

On/off beauty.

Parameters
featureBitmask Beauty features, bitmask format, you can choose to enable several features in [ZegoBeautifyFeature] at the same time

enableBeautify:channel:

- (void)enableBeautify:(ZegoBeautifyFeature) featureBitmask channel:(ZegoPublishChannel) channel;

On/off beauty.

Parameters
featureBitmask Beauty features, bitmask format, you can choose to enable several features in [ZegoBeautifyFeature] at the same time
channel Publishing stream channel.

setBeautifyOption:

- (void)setBeautifyOption:(ZegoBeautifyOption *) option;

Set beauty parameters.

Parameters
option Beauty configuration options

setBeautifyOption:channel:

- (void)setBeautifyOption:(ZegoBeautifyOption *) option channel:(ZegoPublishChannel) channel;

Set beauty parameters.

Parameters
option Beauty configuration options
channel Publishing stream channel.

startPublishingStream:

- (void)startPublishingStream:(NSString *) streamID;

Start publishing stream.

Parameters
streamID Stream ID, a string of up to 256 characters, needs to be globally unique within the entire AppID. If in the same AppID, different users publish each stream and the stream ID is the same, which will cause the user to publish the stream failure. You cannot include URL keywords, otherwise publishing stream and playing stream will fails. Only support numbers, English characters and '~', '!', '@', '#', '$', '', '^', '&', '*', '(', ')', '_', '+', '=', '-', ', ';', '’', ',', '.', '<', '>', '/', ''.

startPublishingStream:channel:

- (void)startPublishingStream:(NSString *) streamID channel:(ZegoPublishChannel) channel;

Start publishing stream, you can call this api to publish the another stream.

Parameters
streamID Stream ID, a string of up to 256 characters, needs to be globally unique within the entire AppID. If in the same AppID, different users publish each stream and the stream ID is the same, which will cause the user to publish the stream failure. You cannot include URL keywords, otherwise publishing stream and playing stream will fails. Only support numbers, English characters and '~', '!', '@', '#', '$', '', '^', '&', '*', '(', ')', '_', '+', '=', '-', ', ';', '’', ',', '.', '<', '>', '/', ''.
channel Publish stream channel

stopPublishingStream

- (void)stopPublishingStream:;

Stop publishing stream.

stopPublishingStream:

- (void)stopPublishingStream:(ZegoPublishChannel) channel;

Stop publishing stream of the specified channel.

Parameters
channel Publish stream channel

setStreamExtraInfo:callback:

- (void)setStreamExtraInfo:(NSString *) extraInfo callback:(ZegoPublisherSetStreamExtraInfoCallbacknullable ) callback;

Set stream extra information.

Parameters
extraInfo Stream extra information, a string of up to 1024 characters.
callback Set stream extra information execution result notification

setStreamExtraInfo:channel:callback:

- (void)setStreamExtraInfo:(NSString *) extraInfo channel:(ZegoPublishChannel) channel callback:(ZegoPublisherSetStreamExtraInfoCallbacknullable ) callback;

Set stream additional information.

startPreview:

- (void)startPreview:(nullable ZegoCanvas *) canvas;

Start/Update local preview.

Parameters
canvas The view used to display the preview image. If the view is set to nil, no preview will be made.

startPreview:channel:

- (void)startPreview:(nullable ZegoCanvas *) canvas channel:(ZegoPublishChannel) channel;

Start/Update local preview.

stopPreview

- (void)stopPreview:;

Stop local preview.

stopPreview:

- (void)stopPreview:(ZegoPublishChannel) channel;

Stop local preview.

Parameters
channel Publish stream channel

setVideoConfig:

- (void)setVideoConfig:(ZegoVideoConfig *) config;

Set up video configuration.

Parameters
config Video configuration, the SDK provides a common setting combination of resolution, frame rate and bit rate, they also can be customized.

setVideoConfig:channel:

- (void)setVideoConfig:(ZegoVideoConfig *) config channel:(ZegoPublishChannel) channel;

Set up video configuration.

setVideoMirrorMode:

- (void)setVideoMirrorMode:(ZegoVideoMirrorMode) mirrorMode;

Set mirror mode.

Parameters
mirrorMode Mirror mode for previewing or publishing the stream

setVideoMirrorMode:channel:

- (void)setVideoMirrorMode:(ZegoVideoMirrorMode) mirrorMode channel:(ZegoPublishChannel) channel;

Set mirror mode.

setAppOrientation:

- (void)setAppOrientation:(UIInterfaceOrientation) orientation;

Set the orientation of video.

Parameters
orientation Video orientation

setAppOrientation:channel:

- (void)setAppOrientation:(UIInterfaceOrientation) orientation channel:(ZegoPublishChannel) channel;

Set the orientation of the captured video.

setAudioConfig:

- (void)setAudioConfig:(ZegoAudioConfig *) config;

set audio config

Parameters
config Audio config

mutePublishStreamAudio:

- (void)mutePublishStreamAudio:(BOOL) mute;

Stop or resume sending a audio stream.

Parameters
mute Whether to stop sending audio streams, YES means that only the video stream is sent without sending the audio stream, and NO means that the audio and video streams are sent simultaneously. The default is NO.

mutePublishStreamAudio:channel:

- (void)mutePublishStreamAudio:(BOOL) mute channel:(ZegoPublishChannel) channel;

Stop or resume sending a audio stream.

mutePublishStreamVideo:

- (void)mutePublishStreamVideo:(BOOL) mute;

Stop or resume sending a video stream.

Parameters
mute Whether to stop sending video streams, YES means that only the audio stream is sent without sending the video stream, and NO means that the audio and video streams are sent at the same time. The default is NO.

mutePublishStreamVideo:channel:

- (void)mutePublishStreamVideo:(BOOL) mute channel:(ZegoPublishChannel) channel;

Stop or resume sending a video stream.

enableTrafficControl:property:

- (void)enableTrafficControl:(BOOL) enable property:(ZegoTrafficControlProperty) property;

Enable or disable traffic control.

Parameters
enable Whether to enable traffic control. The default is ture.
property Adjustable property of traffic control, bitmask format. Should be one or the combinations of [ZegoTrafficControlProperty] enumeration. [AdaptiveFPS] as default.

setMinVideoBitrateForTrafficControl:mode:

- (void)setMinVideoBitrateForTrafficControl:(int) bitrate mode:(ZegoTrafficControlMinVideoBitrateMode) mode;

Set the minimum video bitrate for traffic control.

Parameters
bitrate Minimum video bitrate (kbps)
mode Video sending mode below the minimum bitrate.

setCaptureVolume:

- (void)setCaptureVolume:(int) volume;

Set the captured volume for publishing stream.

Parameters
volume Volume percentage. The range is 0 to 100. Default value is 100.

addPublishCdnUrl:streamID:callback:

- (void)addPublishCdnUrl:(NSString *) targetURL streamID:(NSString *) streamID callback:(ZegoPublisherUpdateCdnUrlCallbacknullable ) callback;

Add URL to relay to CDN.

Parameters
targetURL CDN relay address, supported address format rtmp.
streamID Stream ID
callback The execution result notification of the relay CDN operation, and proceed to the next step according to the execution result.

removePublishCdnUrl:streamID:callback:

- (void)removePublishCdnUrl:(NSString *) targetURL streamID:(NSString *) streamID callback:(ZegoPublisherUpdateCdnUrlCallbacknullable ) callback;

Delete the URL relayed to the CDN.

Parameters
targetURL CDN relay address, supported address format rtmp, flv, hls
streamID Stream ID
callback Remove CDN relay result notifications

enablePublishDirectToCDN:config:

- (void)enablePublishDirectToCDN:(BOOL) enable config:(nullable ZegoCDNConfig *) config;

Whether to publish stream directly to CDN without passing through Zego real-time video cloud server.

Parameters
enable Whether to enable direct publish CDN, YES: enable direct publish CDN, NO: disable direct publish CDN
config CDN configuration, if nil, use Zego's background default configuration

enablePublishDirectToCDN:config:channel:

- (void)enablePublishDirectToCDN:(BOOL) enable config:(nullable ZegoCDNConfig *) config channel:(ZegoPublishChannel) channel;

Whether to publish stream directly to CDN without passing through Zego real-time video cloud server.

setPublishWatermark:isPreviewVisible:

- (void)setPublishWatermark:(nullable ZegoWatermark *) watermark isPreviewVisible:(BOOL) isPreviewVisible;

Set publish watermark.

Parameters
watermark The upper left corner of the watermark layout is the origin of the coordinate system, and the area cannot exceed the size set by the encoding resolution. If it is nil, the watermark is cancelled.
isPreviewVisible the watermark is visible on local preview

setPublishWatermark:isPreviewVisible:channel:

- (void)setPublishWatermark:(nullable ZegoWatermark *) watermark isPreviewVisible:(BOOL) isPreviewVisible channel:(ZegoPublishChannel) channel;

Set publish watermark.

sendSEI:

- (void)sendSEI:(NSData *) data;

Send SEI.

Parameters
data SEI data

sendSEI:channel:

- (void)sendSEI:(NSData *) data channel:(ZegoPublishChannel) channel;

Send SEI.

enableHardwareEncoder:

- (void)enableHardwareEncoder:(BOOL) enable;

On/off hardware encoding.

Parameters
enable Whether to enable hardware encoding, YES: enable hardware encoding, NO: disable hardware encoding

setCapturePipelineScaleMode:

- (void)setCapturePipelineScaleMode:(ZegoCapturePipelineScaleMode) mode;

set capture pipeline scale mode.

loginRoom:user:

- (void)loginRoom:(NSString *) roomID user:(ZegoUser *) user;

Login room.

loginRoom:user:config:

- (void)loginRoom:(NSString *) roomID user:(ZegoUser *) user config:(ZegoRoomConfig *) config;

Login room.

logoutRoom:

- (void)logoutRoom:(NSString *) roomID;

Logout room.

Parameters
roomID Room ID, a string of up to 128 bytes in length. Only support numbers, English characters and '~', '!', '@', '#', '$', '', '^', '&', '*', '(', ')', '_', '+', '=', '-', ', ';', '’', ',', '.', '<', '>', '/', ''