logo
On this page

Class

2026-03-13
ZegoAccurateSeekConfigZegoAIVoiceChanger
ZegoAIVoiceChangerEventHandlerZegoAIVoiceChangerSpeakerInfo
ZegoAudioConfigZegoAudioEffectPlayConfig
ZegoAudioEffectPlayerZegoAudioFrameParam
ZegoAudioMixingDataZegoAudioSourceMixConfig
ZegoAudioVADClientZegoAutoMixerTask
ZegoBackgroundConfigZegoBarrageMessageInfo
ZegoBeautifyOptionZegoBlurInfo
ZegoBroadcastMessageInfoZegoCanvas
ZegoCDNConfigZegoColorEnhancementParams
ZegoCopyrightedMusicZegoCopyrightedMusicConfig
ZegoCopyrightedMusicEventHandlerZegoCopyrightedMusicGetLyricConfig
ZegoCopyrightedMusicGetSharedConfigZegoCopyrightedMusicGetSharedConfigV2
ZegoCopyrightedMusicQueryCacheConfigZegoCopyrightedMusicQueryCacheConfigV2
ZegoCopyrightedMusicRequestConfigZegoCopyrightedMusicRequestConfigV2
ZegoCrossAppInfoZegoCustomAudioConfig
ZegoCustomAudioProcessConfigZegoCustomPlayerResourceConfig
ZegoCustomVideoCaptureConfigZegoCustomVideoProcessConfig
ZegoCustomVideoRenderConfigZegoDataRecordConfig
ZegoDataRecordProgressZegoDeviceInfo
ZegoDummyCaptureImageParamsZegoDumpDataConfig
ZegoEffectsBeautyParamZegoEngineConfig
ZegoEngineProfileZegoExpLowlightEnhancementParams
ZegoExpressDefinesZegoExpressEngine
ZegoFaceDetectionInfoZegoFacePositionInfo
ZegoFontStyleZegoItemParam
ZegoLabelInfoZegoLayerBorderConfig
ZegoLogConfigZegoMediaDataPublisher
ZegoMediaDataPublisherConfigZegoMediaDataPublisherEventHandler
ZegoMediaPlayerZegoMediaPlayerBlockDataHandler
ZegoMediaPlayerMediaInfoZegoMediaPlayerResource
ZegoMediaPlayerStatisticsInfoZegoMediaSideInfo
ZegoMixerAudioConfigZegoMixerImageInfo
ZegoMixerInputZegoMixerOutput
ZegoMixerOutputRoomInfoZegoMixerOutputVideoConfig
ZegoMixerTaskZegoMixerVideoConfig
ZegoMixerWhiteboardZegoNetworkProbeConfig
ZegoNetworkProbeHttpResultZegoNetworkProbeResult
ZegoNetworkProbeTcpResultZegoNetworkProbeTracerouteResult
ZegoNetworkProbeUdpResultZegoNetWorkResourceCache
ZegoNetworkSpeedTestConfigZegoNetworkSpeedTestQuality
ZegoNetworkTimeInfoZegoObjectSegmentationConfig
ZegoPerformanceStatusZegoPictureCapturer
ZegoPlayerConfigZegoPlayStreamQuality
ZegoPositionZegoPositionOrientation
ZegoProxyInfoZegoPublishDualStreamConfig
ZegoPublisherConfigZegoPublisherTakeSnapshotConfig
ZegoPublishStreamQualityZegoRangeAudio
ZegoRangeSceneZegoRangeSceneEventHandler
ZegoRangeSceneItemZegoRangeSceneItemEventHandler
ZegoRangeSceneStreamZegoRangeSceneStreamEventHandler
ZegoRangeSceneTeamZegoRangeSceneTeamEventHandler
ZegoRealTimeSequentialDataEventHandlerZegoRealTimeSequentialDataManager
ZegoReceiveRangeParamZegoReplayKitExt
ZegoReplayKitExtHandlerZegoReverbAdvancedParam
ZegoReverbEchoParamZegoReverbParam
ZegoRoiRectZegoRoomConfig
ZegoRoomExtraInfoZegoRoomRecvTransparentMessage
ZegoRoomSendTransparentMessageZegoRoomStreamList
ZegoRtcStatsInfoZegoSceneConfig
ZegoSceneParamZegoScenePlayerConfig
ZegoScenePublisherConfigZegoSceneStreamConfig
ZegoScreenCaptureAudioConfigZegoScreenCaptureConfig
ZegoScreenCaptureSourceZegoScreenCaptureSourceEventHandler
ZegoScreenCaptureSourceInfoZegoSEIConfig
ZegoSoundLevelConfigZegoSoundLevelInfo
ZegoStreamZegoStreamRelayCDNInfo
ZegoSwitchPlayingStreamConfigZegoTeamParam
ZegoTestNetworkConnectivityResultZegoTrafficControlInfo
ZegoUserZegoVideoConfig
ZegoVideoDenoiseParamsZegoVideoEncodedFrameParam
ZegoVideoFrameParamZegoVocalRangeParam
ZegoVoiceChangerParamZegoWatermark

ZegoAIVoiceChanger

Declared in ZegoExpressDefines.h

Methods

getIndex

getIndex
- (int)getIndex;
Get AI voice changer instance index.
Declared in ZegoExpressDefines.h

AI voice changer instance index.

setEventHandler:

setEventHandler:
- (void)setEventHandler:(nullable id<ZegoAIVoiceChangerEventHandler>) handler;
Set event notification callback handler of the AI voice changer.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
handlernullable id<ZegoAIVoiceChangerEventHandler>Event callback handler for AI voice changer

Details

Listen to the event notification callback of the AI voice changer. Use Cases: Developers can handle this according to the related event callback.

  • When to call: After the [ZegoAIVoiceChanger] instance created.
  • Caution: Calling this function will overwrite the callback set by the last call to this function.
  • Available since: 3.10.0
  • Restrictions: None.

initEngine

initEngine
- (void)initEngine;
Initialize AI voice changer engine.
Declared in ZegoExpressDefines.h

update

update
- (void)update;
Update AI voice changer engine models.
Declared in ZegoExpressDefines.h

getSpeakerList

getSpeakerList
- (void)getSpeakerList;
Get AI voice changer speaker list.
Declared in ZegoExpressDefines.h

setSpeaker:

setSpeaker:
- (void)setSpeaker:(int) speakerID;
Set AI voice changer speaker.
Declared in ZegoExpressDefines.h
NameTypeDescription
speakerIDintSpeaker ID.

ZegoAIVoiceChangerEventHandler

Declared in ZegoExpressEventHandler.h

Methods

aiVoiceChanger:onInit

aiVoiceChanger:onInit
- (void)aiVoiceChanger:(ZegoAIVoiceChanger *)aiVoiceChanger onInit:(int)errorCode;
Initialize AI voice changer engine status callback.
Declared in ZegoExpressEventHandler.h

Parameters

NameTypeDescription
aiVoiceChangerZegoAIVoiceChanger *Callback AI voice changer instance.
errorCodeintError code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.

Details

Initialize AI voice changer engine status callback.

  • Trigger: The callback triggered when call [init] function.
  • Available since: 3.10.0.
  • Restrictions: None.

aiVoiceChanger:onUpdateProgress:fileIndex:fileCount

aiVoiceChanger:onUpdateProgress:fileIndex:fileCount
- (void)aiVoiceChanger:(ZegoAIVoiceChanger *)aiVoiceChanger onUpdateProgress:(double)percent fileIndex:(int)fileIndex fileCount:(int)fileCount;
Update AI voice changer engine models progress callback.
Declared in ZegoExpressEventHandler.h

Parameters

NameTypeDescription
aiVoiceChangerZegoAIVoiceChanger *Callback AI voice changer instance.
percentdoubleCurrent file update progress.
fileIndexintCurrent update file index.
fileCountintTotal update file count.

Details

Update AI voice changer engine models progress callback.

  • Trigger: The callback triggered when call [update] function.
  • Available since: 3.12.0.
  • Restrictions: None.

aiVoiceChanger:onUpdate

aiVoiceChanger:onUpdate
- (void)aiVoiceChanger:(ZegoAIVoiceChanger *)aiVoiceChanger onUpdate:(int)errorCode;
Update AI voice changer engine models status callback.
Declared in ZegoExpressEventHandler.h

Parameters

NameTypeDescription
aiVoiceChangerZegoAIVoiceChanger *Callback AI voice changer instance.
errorCodeintError code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.

Details

Update AI voice changer engine models status callback.

  • Trigger: The callback triggered when call [update] function.
  • Available since: 3.10.0.
  • Restrictions: None.

aiVoiceChanger:onGetSpeakerList:speakers

aiVoiceChanger:onGetSpeakerList:speakers
- (void)aiVoiceChanger:(ZegoAIVoiceChanger *)aiVoiceChanger onGetSpeakerList:(int)errorCode speakers:(NSArray<ZegoAIVoiceChangerSpeakerInfo *> *)speakerList;
Get AI voice changer engine available speaker list callback.
Declared in ZegoExpressEventHandler.h

Parameters

NameTypeDescription
aiVoiceChangerZegoAIVoiceChanger *Callback AI voice changer instance.
errorCodeintError code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.
speakerListNSArray<ZegoAIVoiceChangerSpeakerInfo *> *Available speaker list.

Details

Get AI voice changer engine available speaker list callback.

  • Trigger: The callback triggered when call [getSpeakerList] function.
  • Available since: 3.10.0.
  • Restrictions: None.

aiVoiceChanger:onEvent

aiVoiceChanger:onEvent
- (void)aiVoiceChanger:(ZegoAIVoiceChanger *)aiVoiceChanger onEvent:(int)event;
AI voice changer event callback.
Declared in ZegoExpressEventHandler.h

Parameters

NameTypeDescription
aiVoiceChangerZegoAIVoiceChanger *Callback AI voice changer instance.
eventZegoAIVoiceChangerEventAI voice changer event.

Details

AI voice changer event callback.

  • Trigger: The callback triggered when AI voice changer transcode failure occurred.
  • Available since: 3.12.0.
  • Restrictions: None.

aiVoiceChanger:onSetSpeaker

aiVoiceChanger:onSetSpeaker
- (void)aiVoiceChanger:(ZegoAIVoiceChanger *)aiVoiceChanger onSetSpeaker:(int)errorCode;
Set AI voice changer engine speaker status callback.
Declared in ZegoExpressEventHandler.h

Parameters

NameTypeDescription
aiVoiceChangerZegoAIVoiceChanger *Callback AI voice changer instance.
errorCodeintError code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.

Details

Set AI voice changer engine speaker status callback.

  • Trigger: The callback triggered when call [setSpeaker] function.
  • Available since: 3.12.0.
  • Restrictions: None.

ZegoAIVoiceChangerSpeakerInfo

AI voice changer speaker detail.

Declared in ZegoExpressDefines.h

Properties

id

id
nonatomic, assign int id

Speaker ID.

name

name
nonatomic, copy NSString * name

Speaker name.

ZegoAccurateSeekConfig

Precise seek configuration

Declared in ZegoExpressDefines.h

Properties

timeout

timeout
nonatomic, assign unsigned long long timeout

The timeout time for precise search; if not set, the SDK internal default is set to 5000 milliseconds, the effective value range is [2000, 10000], the unit is ms

ZegoAudioConfig

Audio configuration.

Details

Configure audio bitrate, audio channel, audio encoding for publishing stream

Declared in ZegoExpressDefines.h

Properties

bitrate

bitrate
nonatomic, assign int bitrate

Audio bitrate in kbps, default is 48 kbps. The settings before and after publishing stream can be effective

channel

channel
nonatomic, assign ZegoAudioChannel channel

Audio channel, default is Mono. The setting only take effect before publishing stream

codecID

codecID
nonatomic, assign ZegoAudioCodecID codecID

codec ID, default is ZegoAudioCodecIDDefault. The setting only take effect before publishing stream

Methods

defaultConfig

defaultConfig
- (void)+ (instancetype)defaultConfig;
Create a default audio configuration
Declared in ZegoExpressDefines.h

ZegoAudioConfigPresetStandardQuality (48 kbps, Mono, ZegoAudioCodecIDDefault)

ZegoAudioConfig instance

configWithPreset

configWithPreset
- (void)+ (instancetype)configWithPreset:(ZegoAudioConfigPreset)preset;
Create a audio configuration with preset enumeration values
Declared in ZegoExpressDefines.h

ZegoAudioConfig instance

initWithPreset

initWithPreset
- (instancetype)initWithPreset:(ZegoAudioConfigPreset)preset;
Create a audio configuration with preset enumeration values
Declared in ZegoExpressDefines.h

ZegoAudioConfig instance

ZegoAudioEffectPlayConfig

AudioEffectPlayer play configuration.

Declared in ZegoExpressDefines.h

Properties

playCount

playCount
nonatomic, assign unsigned int playCount

The number of play counts. When set to 0, it will play in an infinite loop until the user invoke [stop]. The default is 1, which means it will play only once.

isPublishOut

isPublishOut
nonatomic, assign BOOL isPublishOut

Whether to mix audio effects into the publishing stream, the default is false.

ZegoAudioEffectPlayer

Declared in ZegoExpressDefines.h

Methods

setEventHandler:

setEventHandler:
- (void)setEventHandler:(nullable id<ZegoAudioEffectPlayerEventHandler>) handler;
Set audio effect player event handler.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
handlernullable id<ZegoAudioEffectPlayerEventHandler>event handler for audio effect player.

Details

Set audio effect player event handler.

  • When to call: It can be called after [createAudioEffectPlayer].
  • Related APIs: [createAudioEffectPlayer].
  • Available since: 1.16.0
  • Restrictions: None.

start:path:config:

start:path:config:
- (void)start:(unsigned int) audioEffectID path:(nullable NSString *) path config:(ZegoAudioEffectPlayConfig *) config;
Start playing audio effect.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
audioEffectIDunsigned intDescription: ID for the audio effect. The SDK uses audioEffectID to control the playback of sound effects. The SDK does not force the user to pass in this parameter as a fixed value. It is best to ensure that each sound effect can have a unique ID. The recommended methods are static self-incrementing ID or the hash of the incoming sound effect file path.
pathnullable NSString *The absolute path of the local resource. <br>Value range: "assets://"、"ipod-library://" and network url are not supported. Set path as nil or "" if resource is loaded already using [loadResource].
configZegoAudioEffectPlayConfig *Audio effect playback configuration. <br>Default value: Set NULL will only be played once, and will not be mixed into the publishing stream.

Details

Start playing audio effect. The default is only played once and is not mixed into the publishing stream, if you want to change this please modify [config] param.

  • Use cases: When you need to play short sound effects, such as applause, cheers, etc., you can use this interface to achieve, and further configure the number of plays through the [config] parameter, and mix the sound effects into the push stream.
  • When to call: It can be called after [createAudioEffectPlayer].
  • Available since: 1.16.0
  • Restrictions: None.

stop:

stop:
- (void)stop:(unsigned int) audioEffectID;
Stop playing audio effect.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
audioEffectIDunsigned intID for the audio effect.

Details

Stop playing the specified audio effect [audioEffectID].

  • When to call: The specified [audioEffectID] is [start].
  • Available since: 1.16.0
  • Restrictions: None.

pause:

pause:
- (void)pause:(unsigned int) audioEffectID;
Pause playing audio effect.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
audioEffectIDunsigned intID for the audio effect.

Details

Pause playing the specified audio effect [audioEffectID].

  • When to call: The specified [audioEffectID] is [start].
  • Available since: 1.16.0
  • Restrictions: None.

resume:

resume:
- (void)resume:(unsigned int) audioEffectID;
Resume playing audio effect.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
audioEffectIDunsigned intID for the audio effect.

Details

Resume playing the specified audio effect [audioEffectID].

  • When to call: The specified [audioEffectID] is [pause].
  • Available since: 1.16.0
  • Restrictions: None.

stopAll

stopAll
- (void)stopAll;
Stop playing all audio effect.
Declared in ZegoExpressDefines.h

Stop playing all audio effect.

  • When to call: Some audio effects are Playing.
  • Available since: 1.16.0
  • Restrictions: None.

pauseAll

pauseAll
- (void)pauseAll;
Pause playing all audio effect.
Declared in ZegoExpressDefines.h

Pause playing all audio effect.

  • When to call: It can be called after [createAudioEffectPlayer].
  • Available since: 1.16.0
  • Restrictions: None.

resumeAll

resumeAll
- (void)resumeAll;
Resume playing all audio effect.
Declared in ZegoExpressDefines.h

Resume playing all audio effect.

  • When to call: It can be called after [pauseAll].
  • Available since: 1.16.0
  • Restrictions: None.

seekTo:audioEffectID:callback:

seekTo:audioEffectID:callback:
- (void)seekTo:(unsigned long long) millisecond audioEffectID:(unsigned int) audioEffectID callback:(nullable ZegoAudioEffectPlayerSeekToCallback) callback;
Set the specified playback progress.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
millisecondunsigned long longPoint in time of specified playback progress.
audioEffectIDunsigned intID for the audio effect.
callbacknullable ZegoAudioEffectPlayerSeekToCallbackThe result of seek.

Details

Set the specified audio effect playback progress. Unit is millisecond.

  • When to call: The specified [audioEffectID] is[start], and not finished.
  • Available since: 1.16.0
  • Restrictions: None.

setVolume:audioEffectID:

setVolume:audioEffectID:
- (void)setVolume:(int) volume audioEffectID:(unsigned int) audioEffectID;
Set volume for a single audio effect. Both the local play volume and the publish volume are set.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
volumeintVolume. <br>Value range: The range is 0 ~ 200. <br>Default value: The default is 100.
audioEffectIDunsigned intID for the audio effect.

Details

Set volume for a single audio effect. Both the local play volume and the publish volume are set.

  • When to call: The specified [audioEffectID] is [start].
  • Available since: 1.16.0
  • Restrictions: None.

setPlayVolume:audioEffectID:

setPlayVolume:audioEffectID:
- (void)setPlayVolume:(int) volume audioEffectID:(unsigned int) audioEffectID;
Set local play volume for a single audio effect.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
volumeintVolume. <br>Value range: The range is 0 ~ 200. <br>Default value: The default is 100.
audioEffectIDunsigned intID for the audio effect.

Details

Set local play volume for a single audio effect.

  • When to call: The specified [audioEffectID] is [start].
  • Available since: 3.11.0
  • Restrictions: None.

setPublishVolume:audioEffectID:

setPublishVolume:audioEffectID:
- (void)setPublishVolume:(int) volume audioEffectID:(unsigned int) audioEffectID;
Set publish volume for a single audio effect.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
volumeintVolume. <br>Value range: The range is 0 ~ 200. <br>Default value: The default is 100.
audioEffectIDunsigned intID for the audio effect.

Details

Set publish volume for a single audio effect.

  • When to call: The specified [audioEffectID] is [start].
  • Available since: 3.11.0
  • Restrictions: None.

setVolumeAll:

setVolumeAll:
- (void)setVolumeAll:(int) volume;
Set volume for all audio effect. Both the local play volume and the publish volume are set.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
volumeintVolume. <br>Value range: The range is 0 ~ 200. <br>Default value: The default is 100.

Details

Set volume for all audio effect. Both the local play volume and the publish volume are set.

  • When to call: It can be called after [createAudioEffectPlayer].
  • Available since: 1.16.0
  • Restrictions: None.

setPlayVolumeAll:

setPlayVolumeAll:
- (void)setPlayVolumeAll:(int) volume;
Set local play volume for all audio effect.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
volumeintVolume. <br>Value range: The range is 0 ~ 200. <br>Default value: The default is 100.

Details

Set local play volume for all audio effect.

  • When to call: It can be called after [createAudioEffectPlayer].
  • Available since: 3.11.0
  • Restrictions: None.

setPublishVolumeAll:

setPublishVolumeAll:
- (void)setPublishVolumeAll:(int) volume;
Set publish volume for all audio effect.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
volumeintVolume. <br>Value range: The range is 0 ~ 200. <br>Default value: The default is 100.

Details

Set publish volume for all audio effect.

  • When to call: It can be called after [createAudioEffectPlayer].
  • Available since: 3.11.0
  • Restrictions: None.

setPlaySpeed:audioEffectID:

setPlaySpeed:audioEffectID:
- (void)setPlaySpeed:(float) speed audioEffectID:(unsigned int) audioEffectID;
Set the playback speed for a given audio effect. Both the local play speed and the publish speed are set. (separate settings are not supported).
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
speedfloatThe speed of play. <br>Value range: The range is 0.5 ~ 2.0. <br>Default value: The default is 1.0.
audioEffectIDunsigned intID for the audio effect.

Details

Set the playback speed for a given audio effect. Both the local play speed and the publish speed are set. (separate settings are not supported).

  • When to call: The specified [audioEffectID] is [start].
  • Available since: 2.18.0
  • Restrictions: None.

getTotalDuration:

getTotalDuration:
- (unsigned long long)getTotalDuration:(unsigned int) audioEffectID;
Get the total duration of the specified audio effect resource.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
audioEffectIDunsigned intID for the audio effect.

Details

Get the total duration of the specified audio effect resource. Unit is millisecond.

  • When to call: You should invoke this function after the audio effect resource already loaded, otherwise the return value is 0.
  • Related APIs: [start], [loadResource].
  • Available since: 1.16.0
  • Restrictions: It can be called after [createAudioEffectPlayer].

Return

Unit is millisecond.

getCurrentProgress:

getCurrentProgress:
- (unsigned long long)getCurrentProgress:(unsigned int) audioEffectID;
Get current playback progress.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
audioEffectIDunsigned intID for the audio effect.

Details

Get current playback progress of the specified audio effect. Unit is millisecond.

  • When to call: You should invoke this function after the audio effect resource already loaded, otherwise the return value is 0.
  • Related APIs: [start], [loadResource].
  • Available since: 1.16.0
  • Restrictions: None.

loadResource:audioEffectID:callback:

loadResource:audioEffectID:callback:
- (void)loadResource:(NSString *) path audioEffectID:(unsigned int) audioEffectID callback:(nullable ZegoAudioEffectPlayerLoadResourceCallback) callback;
Load audio effect resource.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
pathNSString *the absolute path of the audio effect resource and cannot be nil or "". <br>Value range: "assets://"、"ipod-library://" and network url are not supported.
audioEffectIDunsigned intID for the audio effect.
callbacknullable ZegoAudioEffectPlayerLoadResourceCallbackload audio effect resource result.

Details

Load audio effect resource.

  • Use cases: In a scene where the same sound effect is played frequently, the SDK provides the function of preloading the sound effect file into the memory in order to optimize the performance of repeatedly reading and decoding the file.
  • When to call: It can be called after [createAudioEffectPlayer].
  • Available since: 1.16.0
  • Restrictions: Preloading supports loading up to 15 sound effect files at the same time, and the duration of the sound effect files cannot exceed 30s, otherwise an error will be reported when loading.

unloadResource:

unloadResource:
- (void)unloadResource:(unsigned int) audioEffectID;
Unload audio effect resource.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
audioEffectIDunsigned intID for the audio effect loaded.

Details

Unload the specified audio effect resource.

  • When to call: After the sound effects are used up, related resources can be released through this function; otherwise, the SDK will release the loaded resources when the AudioEffectPlayer instance is destroyed.
  • Related APIs: [loadResource].
  • Available since: 1.16.0
  • Restrictions: None.

updatePosition:position:

updatePosition:position:
- (void)updatePosition:(unsigned int) audioEffectID position:(const float[_Nonnull 3]) position;
Update the position of the audio effect player (audio source).
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
audioEffectIDunsigned intID for the audio effect.
positionconst float[_Nonnull 3]The unit vector of the front axis of its own coordinate system. The parameter is a float array with a length of 3.

Details

Update the position of the audio effect player (audio source).

  • Use cases: The audio effect player also needs to have 3D spatial sound.
  • When to call: Listen to the [onAudioEffectPlayStateUpdate] callback, please call this interface after the player state is ZegoAudioEffectPlayState.Playing and before ZegoAudioEffectPlayState.NoPlay/PlayEnded.
  • Available since: 3.6.0
  • Restrictions: This interface needs to be used in conjunction with the RangeAudio/RangeScene module. This interface can only be called successfully after the RangeAudio/RangeScene module enables 3D sound effects.

getIndex

getIndex
- (NSNumber *)getIndex;
Get audio effect player index.
Declared in ZegoExpressDefines.h

Get audio effect player index.

  • When to call: It can be called after [createAudioEffectPlayer].
  • Available since: 1.16.0
  • Restrictions: None.

Audio effect player index.

ZegoAudioFrameParam

Parameter object for audio frame.

Details

Including the sampling rate and channel of the audio frame

Declared in ZegoExpressDefines.h

Properties

sampleRate

sampleRate
nonatomic, assign ZegoAudioSampleRate sampleRate

Sampling Rate

channel

channel
nonatomic, assign ZegoAudioChannel channel

Audio channel, default is Mono

ZegoAudioMixingData

audio mixing data.

Declared in ZegoExpressDefines.h

Properties

audioData

audioData
nonatomic, strong, nullable NSData * audioData

Audio PCM data that needs to be mixed into the stream

param

param
nonatomic, strong ZegoAudioFrameParam * param

Audio data attributes, including sample rate and number of channels. Currently supports 16k, 32k, 44.1k, 48k sampling rate, mono or stereo, 16-bit deep PCM data. Developers need to explicitly specify audio data attributes, otherwise mixing will not take effect.

SEIData

SEIData
nonatomic, strong, nullable NSData * SEIData

SEI data, used to transfer custom data. When audioData is nil, SEIData will not be sent

ZegoAudioSourceMixConfig

Audio source mix config

Details

Used to config whether mix media player, audio effect player and captured system audio into publish stream or not when set audio source.

Declared in ZegoExpressDefines.h

Properties

mediaPlayerIndexList

mediaPlayerIndexList
nonatomic, assign int* mediaPlayerIndexList

Media player instance index list.

mediaPlayerCount

mediaPlayerCount
nonatomic, assign int mediaPlayerCount

Media player instance count.

audioEffectPlayerIndexList

audioEffectPlayerIndexList
nonatomic, assign int* audioEffectPlayerIndexList

Audio effect player instance index list.

audioEffectPlayerCount

audioEffectPlayerCount
nonatomic, assign int audioEffectPlayerCount

Audio effect player instance count.

enableMixScreenCapture

enableMixScreenCapture
nonatomic, assign BOOL enableMixScreenCapture

Enable or disable mix screen capture into publish stream, the input source cannot be set to screen capture. (only for Android and iOS)

Methods

defaultConfig

defaultConfig
- (void)+ (instancetype)defaultConfig;
Create a default audio source mix config object
Declared in ZegoExpressDefines.h

ZegoAudioSourceMixConfig instance

ZegoAudioVADClient

Declared in ZegoExpressDefines.h

Methods

update:dataLength:sampleRate:channels:

update:dataLength:sampleRate:channels:
- (ZegoAudioVADType) update:(unsigned char *) data dataLength:(int) dataLength sampleRate:(int) sampleRate channels:(int) channels;
Check if an audio packet contains speech.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
dataunsigned char *audio data.
dataLengthintaudio data length.
sampleRateintsampling rate.
channelsintnumber of channels.

Details

Check if an audio packet contains speech.

  • When to call: It can be called after [createAudioVADClient].
  • Caution: ZegoAudioVADTypeSpeech will also be returned when the voice data is abnormal to ensure that the voice will not be missed.
  • Available since: 2.21.0

Return

voice detection results.

reset

reset
- (BOOL)reset;
Reset audio vad client instance.
Declared in ZegoExpressDefines.h

Reset audio vad client instance.

  • When to call: It can be called after [createAudioVADClient].
  • Available since: 2.21.0

reset results.

ZegoAutoMixerTask

Auto mix stream task object.

Details

When using [StartAutoMixerTask] function to start an auto stream mixing task to the ZEGO RTC server, user need to set this parameter to configure the auto stream mixing task, including the task ID, room ID, audio configuration, output stream list, and whether to enable the sound level callback.

  • Use cases: This configuration is required when an auto stream mixing task is requested to the ZEGO RTC server.
  • Caution: As an argument passed when [StartAutoMixerTask] function is called.

Declared in ZegoExpressDefines.h

Properties

taskID

taskID
nonatomic, copy NSString * taskID

Auto stream mixing task id, must be unique in a room.

  • Use cases: User need to set this parameter when initiating an auto stream mixing task.
  • Required: Yes.
  • Recommended value: Set this parameter based on requirements.
  • Value range: A string up to 256 bytes.
  • Caution: When starting a new auto stream mixing task, only one auto stream mixing task ID can exist in a room, that is, to ensure the uniqueness of task ID. You are advised to associate task ID with room ID. You can directly use the room ID as the task ID.Cannot include URL keywords, for example, 'http' and '?' etc, otherwise publishing stream and playing stream will fail. Only support numbers, English characters and '~', '!', '@', '$', '%', '^', '&', '*', '(', ')', '_', '+', '=', '-', '`', ';', '’', ',', '.', '<', '>', '/', ''.

roomID

roomID
nonatomic, copy NSString * roomID

Auto stream mixing task id.

  • Use cases: User need to set this parameter when initiating an auto stream mixing task.
  • Required: Yes.
  • Recommended value: Set this parameter based on requirements.
  • Value range: A string up to 128 bytes.
  • Caution: Only support numbers, English characters and '~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', '=', '-', '`', ';', '’', ',', '.', '<', '>', ''.If you need to communicate with the Web SDK, please do not use '%'.

audioConfig

audioConfig
nonatomic, strong ZegoMixerAudioConfig * audioConfig

The audio config of the auto mixer task.

  • Use cases: If user needs special requirements for the audio config of the auto stream mixing task, such as adjusting the audio bitrate, user can set this parameter as required. Otherwise, user do not need to set this parameter.
  • Required: No.
  • Default value: The default audio bitrate is 48 kbps, the default audio channel is ZEGO_AUDIO_CHANNEL_MONO, the default encoding ID is ZEGO_AUDIO_CODEC_ID_DEFAULT, and the default multi-channel audio stream mixing mode is ZEGO_AUDIO_MIX_MODE_RAW.
  • Recommended value: Set this parameter based on requirements.

outputList

outputList
nonatomic, strong NSArray<ZegoMixerOutput *> * outputList

The output list of the auto stream mixing task, items in the list are URL or stream ID, if the item set to be URL format, only RTMP URL surpported, for example rtmp://xxxxxxxx.

  • Use cases: User need to set this parameter to specify the mix stream output target when starting an auto stream mixing task.
  • Required: Yes.

enableSoundLevel

enableSoundLevel
nonatomic, assign BOOL enableSoundLevel

Enable or disable sound level callback for the task.If enabled, then the remote player can get the sound level of every stream in the inputlist by [onAutoMixerSoundLevelUpdate] callback.

  • Use cases: This parameter needs to be configured if user need the sound level information of every stream when an auto stream mixing task started.
  • Required: No.
  • Default value: false.
  • Recommended value: Set this parameter based on requirements.

streamAlignmentMode

streamAlignmentMode
nonatomic, assign ZegoStreamAlignmentMode streamAlignmentMode

Stream mixing alignment mode.

minPlayStreamBufferLength

minPlayStreamBufferLength
nonatomic, assign int minPlayStreamBufferLength

Sets the lower limit of the interval range for the adaptive adjustment of the stream playing cache of the stream mixing server. In the real-time chorus KTV scenario, slight fluctuations in the network at the push end may cause the mixed stream to freeze. At this time, when the audience pulls the mixed stream, there is a high probability of the problem of freeze. By adjusting the lower limit of the interval range for the adaptive adjustment of the stream playing cache of the stream mixing server, it can optimize the freezing problem that occurs when playing mixing streams at the player end, but it will increase the delay. It is not set by default, that is, the server uses its own configuration values. It only takes effect for the new input stream setting, and does not take effect for the input stream that has already started mixing.Value Range: [0,10000], exceeding the maximum value will result in a failure of the stream mixing request. On web platforms, this property does not take effect.

streamAlignmentVolumeControlMode

streamAlignmentVolumeControlMode
nonatomic, assign ZegoStreamAlignmentVolumeControlMode streamAlignmentVolumeControlMode

Stream mixing alignment scene volume adjustment mode.

streamAlignmentBaselineStreamID

streamAlignmentBaselineStreamID
nonatomic, copy NSString * streamAlignmentBaselineStreamID

Stream mixing alignment scene baseline streamID.

ZegoBackgroundConfig

Background config.

Details

It is used to configure background when the object segmentation is turned on.

Declared in ZegoExpressDefines.h

Properties

processType

processType
nonatomic, assign ZegoBackgroundProcessType processType

Background process type.

color

color
nonatomic, assign int color

Background color, the format is 0xRRGGBB, default is black, which is 0x000000

imageURL

imageURL
nonatomic, copy NSString * imageURL

Background image URL. Support local file absolute path (file://xxx). The format supports png, jpg.

videoURL

videoURL
nonatomic, copy NSString * videoURL
  • Caution: 1. The video will be played in a loop. 2. Support local file absolute path (file://xxx). 3. The format supports MP4, FLV, MKV, AVI. 4. The maximum resolution should not exceed 4096px, and it is recommended to be within 1920px. 5. The maximum video duration should not exceed 30 seconds, and it is recommended to be within 15 seconds. 6. The maximum video size should not exceed 50MB, and 10MB is recommended.

blurLevel

blurLevel
nonatomic, assign ZegoBackgroundBlurLevel blurLevel

Background blur level.

ZegoBarrageMessageInfo

Barrage message info.

Details

The received object of the room barrage message, including the message content, message ID, sender, sending time

Declared in ZegoExpressDefines.h

Properties

message

message
nonatomic, copy NSString * message

message content

messageID

messageID
nonatomic, copy NSString * messageID

message id

sendTime

sendTime
nonatomic, assign unsigned long long sendTime

Message send time, UNIX timestamp, in milliseconds.

fromUser

fromUser
nonatomic, strong ZegoUser * fromUser

Message sender.Please do not fill in sensitive user information in this field, including but not limited to mobile phone number, ID number, passport number, real name, etc.

ZegoBeautifyOption

Beauty configuration options.

Details

Configure the parameters of skin peeling, whitening and sharpening

Declared in ZegoExpressDefines.h

Properties

polishStep

polishStep
nonatomic, assign double polishStep

The sample step size of beauty peeling, the value range is [0,1], default 0.2

whitenFactor

whitenFactor
nonatomic, assign double whitenFactor

Brightness parameter for beauty and whitening, the larger the value, the brighter the brightness, ranging from [0,1], default 0.5

sharpenFactor

sharpenFactor
nonatomic, assign double sharpenFactor

Beauty sharpening parameter, the larger the value, the stronger the sharpening, value range [0,1], default 0.1

Methods

defaultConfig

defaultConfig
- (void)+ (instancetype)defaultConfig;
Create a default beauty parameter object
Declared in ZegoExpressDefines.h

ZegoBeautifyOption instance

ZegoBlurInfo

blur info.

Details

mix stream blur padding info.

  • Use cases: Set text watermark in manual stream mixing scene, such as Co-hosting.

Declared in ZegoExpressDefines.h

Properties

topPadding

topPadding
nonatomic, assign int topPadding
  • Required: False.
  • Default value: 0.

leftPadding

leftPadding
nonatomic, assign int leftPadding
  • Required: False.
  • Default value: 0.

bottomPadding

bottomPadding
nonatomic, assign int bottomPadding

The distance between the feathered edge and the bottom canvas border.

rightPadding

rightPadding
nonatomic, assign int rightPadding
  • Required: False.
  • Default value: 0.

ZegoBroadcastMessageInfo

Broadcast message info.

Details

The received object of the room broadcast message, including the message content, message ID, sender, sending time

Declared in ZegoExpressDefines.h

Properties

message

message
nonatomic, copy NSString * message

message content

messageID

messageID
nonatomic, assign unsigned long long messageID

message id

sendTime

sendTime
nonatomic, assign unsigned long long sendTime

Message send time, UNIX timestamp, in milliseconds.

fromUser

fromUser
nonatomic, strong ZegoUser * fromUser

Message sender.Please do not fill in sensitive user information in this field, including but not limited to mobile phone number, ID number, passport number, real name, etc.

ZegoCDNConfig

CDN config object.

Details

Includes CDN URL and authentication parameter string

Declared in ZegoExpressDefines.h

Properties

url

url
nonatomic, copy NSString * url

CDN URL

authParam

authParam
nonatomic, copy NSString * authParam

Auth param of URL. Please contact ZEGO technical support if you need to use it, otherwise this parameter can be ignored (set to nil or empty string).

protocol

protocol
nonatomic, copy NSString * protocol

URL supported protocols, candidate values are "tcp" and "quic". If there are more than one, separate them with English commas and try them in order. Please contact ZEGO technical support if you need to use it, otherwise this parameter can be ignored (set to nil or empty string).

quicVersion

quicVersion
nonatomic, copy NSString * quicVersion

QUIC version。 If [protocol] has the QUIC protocol, this information needs to be filled in. If there are multiple version numbers, separate them with commas. Please contact ZEGO technical support if you need to use it, otherwise this parameter can be ignored (set to nil or empty string).

httpdns

httpdns

customized httpdns service. This feature is only supported for playing stream currently.

quicConnectMode

quicConnectMode
int quicConnectMode

QUIC establishes link mode. If the value is 1, quic 0 rtt is used preferentially to establish link. Otherwise, the link is established normally. If [protocol] has the QUIC protocol, this value takes effect.

customParams

customParams
nonatomic, copy NSString * customParams

custom param of URL. Please contact ZEGO technical support if you need to use it, otherwise this parameter can be ignored (set to nil or empty string).

ZegoCanvas

View object.

Details

Configure view object, view Mode, background color

Declared in ZegoExpressDefines.h

Properties

view

view
nonatomic, strong ZGView * view

View object

viewMode

viewMode
nonatomic, assign ZegoViewMode viewMode

View mode, default is ZegoViewModeAspectFit

backgroundColor

backgroundColor
nonatomic, assign int backgroundColor

Background color, the format is 0xRRGGBB, default is black, which is 0x000000

alphaBlend

alphaBlend
nonatomic, assign BOOL alphaBlend

If enable alpha blend render, default is false.

rotation

rotation
nonatomic, assign int rotation

Rotate the angle counterclockwise, the default is 0. The media player canvas is not supported.

mirror

mirror
nonatomic, assign BOOL mirror

If enable the view mirror, default is false. Only play stream canvas is supported, for publish stream please use [setVideoMirrorMode] interface, for media player please use [enableViewMirror] interface.

viewContext

viewContext
nonatomic, copy NSString * viewContext

Context of view, default is empty string. A utf8 string with a maximum length of 63 bytes or less. Generally no attention is required, it can be used for slitting rendering of mixed stream, to understand the specific use, you need to contact ZEGO technical support.

Methods

canvasWithView

canvasWithView
+ (instancetype)canvasWithView:(ZGView *)view;
Create a ZegoCanvas, default viewMode is ZegoViewModeAspectFit, default background color is black
Declared in ZegoExpressDefines.h

ZegoCanvas instance

initWithView

initWithView
- (instancetype)initWithView:(ZGView *)view;
Create a ZegoCanvas, default viewMode is ZegoViewModeAspectFit, default background color is black
Declared in ZegoExpressDefines.h

ZegoCanvas instance

ZegoColorEnhancementParams

Color enhancement params.

Declared in ZegoExpressDefines.h

Properties

intensity

intensity
nonatomic, assign float intensity

color enhancement intensity.

  • Value range: [0,1], the larger the value, the stronger the intensity of color enhancement.
  • Default value: 0.

skinToneProtectionLevel

skinToneProtectionLevel
nonatomic, assign float skinToneProtectionLevel

Skin tone protection level.

  • Value range: [0,1], the larger the value, the greater the level of skin protection.
  • Default value: 1.

lipColorProtectionLevel

lipColorProtectionLevel
nonatomic, assign float lipColorProtectionLevel

Lip color protection level.

  • Value range: [0,1], the larger the value, the greater the level of lip color protection.
  • Default value: 0.

ZegoCopyrightedMusic

Declared in ZegoExpressDefines.h

Methods

setEventHandler:

setEventHandler:
- (void)setEventHandler:(nullable id<ZegoCopyrightedMusicEventHandler>) handler;
set copyrighted music event handler.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
handlernullable id<ZegoCopyrightedMusicEventHandler>The object used to receive copyrighted music callbacks.

Details

Set the callback function of the copyrighted music module, which can receive callback notifications related to song playback status .

  • When to call: After create the copyrighted music [createCopyrightedMusic].
  • Available since: 2.13.0

initCopyrightedMusic:callback:

initCopyrightedMusic:callback:
- (void)initCopyrightedMusic:(ZegoCopyrightedMusicConfig *) config callback:(nullable ZegoCopyrightedMusicInitCallback) callback;
Initialize the copyrighted music module.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
configZegoCopyrightedMusicConfig *the copyrighted music configuration.
callbacknullable ZegoCopyrightedMusicInitCallbackinit result

Details

Initialize the copyrighted music so that you can use the function of the copyrighted music later.

  • When to call: After call [createCopyrightedMusic] and [loginRoom].
  • Caution: 1. The real user information must be passed in, otherwise the song resources cannot be obtained for playback. 2. The user ID set when initializing copyrighted music needs to be the same as the user ID set when logging in to the room.
  • Available since: 2.13.0

getCacheSize

getCacheSize
- (unsigned long long)getCacheSize;
Get cache size.
Declared in ZegoExpressDefines.h

When using this module, some cache files may be generated, and the size of the cache file can be obtained through this interface. Use case: Used to display the cache size of the App.

  • When to call: After initializing the copyrighted music [createCopyrightedMusic].
  • Available since: 2.13.0

cache file size, in byte.

clearCache

clearCache
- (void)clearCache;
Clear cache.
Declared in ZegoExpressDefines.h

When using this module, some cache files may be generated, which can be cleared through this interface. Use case: Used to clear the cache of the App.

  • When to call: After initializing the copyrighted music [createCopyrightedMusic].
  • Available since: 2.13.0

sendExtendedRequest:params:callback:

sendExtendedRequest:params:callback:
- (void)sendExtendedRequest:(NSString *) command params:(NSString *) params callback:(nullable ZegoCopyrightedMusicSendExtendedRequestCallback) callback;
Send extended feature request.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
commandNSString *request command, details about the commands supported.
paramsNSString *request parameters, each request command has corresponding request parameters.
callbacknullable ZegoCopyrightedMusicSendExtendedRequestCallbacksend extended feature request result

Details

Initialize the copyrighted music so that you can use the function of the copyrighted music later. Use case: Used to get a list of songs.

  • When to call: After initializing the copyrighted music success [initCopyrightedMusic].
  • Available since: 2.13.0

getLrcLyric:vendorID:callback:

getLrcLyric:vendorID:callback:
- (void)getLrcLyric:(NSString *) songID vendorID:(ZegoCopyrightedMusicVendorID) vendorID callback:(nullable ZegoCopyrightedMusicGetLrcLyricCallback) callback;
Get lyrics in lrc format.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
songIDNSString *the ID of the song or accompaniment, the song and accompaniment of a song share the same ID.
vendorIDZegoCopyrightedMusicVendorIDCopyright music resource song copyright provider.
callbacknullable ZegoCopyrightedMusicGetLrcLyricCallbackget lyrics result

Details

Get lyrics in lrc format, support parsing lyrics line by line. Use case: Used to display lyrics line by line.

  • When to call: After initializing the copyrighted music success [initCopyrightedMusic].
  • Available since: 3.2.1

getLrcLyricWithConfig:callback:

getLrcLyricWithConfig:callback:
- (void)getLrcLyricWithConfig:(ZegoCopyrightedMusicGetLyricConfig *) config callback:(nullable ZegoCopyrightedMusicGetLrcLyricCallback) callback;
Get lyrics in lrc format.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
configZegoCopyrightedMusicGetLyricConfig *The configuration of get lyric.
callbacknullable ZegoCopyrightedMusicGetLrcLyricCallbackget lyrics result

Details

Get lyrics in lrc format, support parsing lyrics line by line. Use case: Used to display lyrics line by line.

  • When to call: After initializing the copyrighted music success [initCopyrightedMusic].
  • Available since: 3.12.0

getKrcLyricByToken:callback:

getKrcLyricByToken:callback:
- (void)getKrcLyricByToken:(NSString *) krcToken callback:(nullable ZegoCopyrightedMusicGetKrcLyricByTokenCallback) callback;
Get lyrics in krc format.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
krcTokenNSString *The krcToken obtained when calling [requestResource] for accompaniment or climax clips, or when obtaining shared resources through the [getSharedResource] interface. For more details, please refer to /online-ktv-ios/client-api/apis-to-obtain-songs-and-lyrics#2_2
callbacknullable ZegoCopyrightedMusicGetKrcLyricByTokenCallbackget lyrics result.

Details

Get verbatim lyrics, support parsing lyrics word by word. Use case: Used to display lyrics word by word.

  • When to call: After initializing the copyrighted music success [initCopyrightedMusic].
  • Available since: 2.13.0

requestResource:type:callback:

requestResource:type:callback:
- (void)requestResource:(ZegoCopyrightedMusicRequestConfig *) config type:(ZegoCopyrightedMusicResourceType) type callback:(nullable ZegoCopyrightedMusicRequestResourceCallback) callback;
Request music resource.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
configZegoCopyrightedMusicRequestConfig *The configuration of requesting music resource.
typeZegoCopyrightedMusicResourceTypeThe resource type of music.
callbacknullable ZegoCopyrightedMusicRequestResourceCallbackCallback of requesting music resource.

Details

In addition to obtaining the basic information of the song (duration, song name, singer, etc.), and the most important resource id that can be used for local playback, there are also some related authentications information. Use case: Get copyrighted songs for local playback and sharing.

  • Related APIs: After a user in the room successfully calls this interface to request a music resource, other users in the room can call the [getsharedresource] interface to get the music resource for free once.

  • When to call: After initializing the copyrighted music [initCopyrightedMusic].

    1. Each resource has a unique resource ID.
    2. Every time this API is called, it will be billed once, please consult ZEGO business personnel for details.
    3. Each resource has a unique resource ID. The resources obtained by calling this API are time-sensitive, the valid duration is the minimum value between the SDK life cycle and 24-hour.
  • Available since: 3.0.2

requestResource:callback:

requestResource:callback:
- (void)requestResource:(ZegoCopyrightedMusicRequestConfigV2 *) config callback:(nullable ZegoCopyrightedMusicRequestResourceCallback) callback;
Request music resource.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
configZegoCopyrightedMusicRequestConfigV2 *The configuration of requesting music resource.
callbacknullable ZegoCopyrightedMusicRequestResourceCallbackCallback of requesting music resource.

Details

In addition to obtaining the basic information of the song (duration, song name, singer, etc.), and the most important resource id that can be used for local playback, there are also some related authentications information. Use case: Get copyrighted songs for local playback and sharing.

  • Related APIs: After a user in the room successfully calls this interface to request a music resource, other users in the room can call the [getsharedresource] interface to get the music resource for free once.

  • When to call: After initializing the copyrighted music [initCopyrightedMusic].

    1. Each resource has a unique resource ID.
    2. Every time this API is called, it will be billed once, please consult ZEGO business personnel for details.
    3. Each resource has a unique resource ID. The resources obtained by calling this API are time-sensitive, the valid duration is the minimum value between the SDK life cycle and 24-hour.
  • Available since: 3.12.0

getSharedResource:type:callback:

getSharedResource:type:callback:
- (void)getSharedResource:(ZegoCopyrightedMusicGetSharedConfig *) config type:(ZegoCopyrightedMusicResourceType) type callback:(nullable ZegoCopyrightedMusicGetSharedResourceCallback) callback;
Get shared music resource.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
configZegoCopyrightedMusicGetSharedConfig *The configuration of getting shared music resource.
typeZegoCopyrightedMusicResourceTypeThe resource type of music.
callbacknullable ZegoCopyrightedMusicGetSharedResourceCallbackCallback of getting shared music resource.

Details

In addition to obtaining the basic information of the song (duration, song name, singer, etc.), and the most important resource id that can be used for local playback, there are also some related authentications information. Use case: Get copyrighted songs for local playback.

  • Related APIs: After a user in the room calls the [requestresource] interface to request a music resource successfully, other users in the room can call this interface to get the music resource for free once.
  • When to call: After initializing the copyrighted music [initCopyrightedMusic]. Each resource has a unique resource ID. The resources obtained by calling this API are time-sensitive, the valid duration is the minimum value between the SDK life cycle and 24-hour.
  • Available since: 3.0.2

getSharedResource:callback:

getSharedResource:callback:
- (void)getSharedResource:(ZegoCopyrightedMusicGetSharedConfigV2 *) config callback:(nullable ZegoCopyrightedMusicGetSharedResourceCallback) callback;
Get shared music resource.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
configZegoCopyrightedMusicGetSharedConfigV2 *The configuration of getting shared music resource.
callbacknullable ZegoCopyrightedMusicGetSharedResourceCallbackCallback of getting shared music resource.

Details

In addition to obtaining the basic information of the song (duration, song name, singer, etc.), and the most important resource id that can be used for local playback, there are also some related authentications information. Use case: Get copyrighted songs for local playback.

  • Related APIs: After a user in the room calls the [requestresource] interface to request a music resource successfully, other users in the room can call this interface to get the music resource for free once.
  • When to call: After initializing the copyrighted music [initCopyrightedMusic]. Each resource has a unique resource ID. The resources obtained by calling this API are time-sensitive, the valid duration is the minimum value between the SDK life cycle and 24-hour.
  • Available since: 3.12.0

download:callback:

download:callback:
- (void)download:(NSString *) resourceID callback:(nullable ZegoCopyrightedMusicDownloadCallback) callback;
Download music resource.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
resourceIDNSString *the resource ID corresponding to the song or accompaniment.
callbacknullable ZegoCopyrightedMusicDownloadCallbackdownload song or accompaniment result.

Details

Download music resource. It can only be played after downloading successfully. Use case: After obtaining the music resource authorization, use this interface to download the corresponding resources.

  • When to call: After initializing the copyrighted music success [initCopyrightedMusic].
  • Caution: Downloading copyrighted music resources is affected by the Internet.
  • Available since: 2.13.0

cancelDownload:

cancelDownload:
- (void)cancelDownload:(NSString *) resourceID;
Cancel download of music resource.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
resourceIDNSString *the resource ID corresponding to the song or accompaniment.

Details

Cancel download of music resource. Use case: After starting to download music resources, use this interface to cancel the corresponding download task.

  • When to call: After starting the download [download].
  • Caution: When a valid resourceID is passed in, only unfinished download tasks will be cancelled. When empty is passed in, all unfinished download tasks will be canceled.
  • Available since: 3.11.0

queryCache:

queryCache:
- (BOOL)queryCache:(ZegoCopyrightedMusicQueryCacheConfig *) config;
Query the resource's cache is existed or not.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
configZegoCopyrightedMusicQueryCacheConfig *The configuration of querying cache.

Details

Query the resource is existed or not, query the Yinsuda resource cache by default Use case: Can be used to check the resource's cache is existed or not

  • When to call: After initializing the copyrighted music success [initCopyrightedMusic].
  • Available since: 3.9.0

queryCacheV2:

queryCacheV2:
- (BOOL)queryCacheV2:(ZegoCopyrightedMusicQueryCacheConfigV2 *) config;
Query the resource's cache is existed or not.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
configZegoCopyrightedMusicQueryCacheConfigV2 *The configuration of querying cache.

Details

Query the resource is existed or not, query the Yinsuda resource cache by default Use case: Can be used to check the resource's cache is existed or not

  • When to call: After initializing the copyrighted music success [initCopyrightedMusic].
  • Available since: 3.12.0

getDuration:

getDuration:
- (unsigned long long)getDuration:(NSString *) resourceID;
Get the playing time of a song or accompaniment file.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
resourceIDNSString *the resource ID corresponding to the song or accompaniment.

Details

Get the playing time of a song or accompaniment file. Use case: Can be used to display the playing time information of the song or accompaniment on the view.

  • When to call: After initializing the copyrighted music success [initCopyrightedMusic].
  • Available since: 2.13.0

setScoringLevel:

setScoringLevel:
- (void)setScoringLevel:(int) level;
Set the difficulty level of scoring.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
levelintThe difficulty level of scoring. The level ranges from 0 to 4. The scoring difficulty decreases from 0 to 4.

Details

Users can set the scoring difficulty level through this function.

  • When to call: After calling [initCopyrightedMusic] to initialize copyrighted music successfully, call [startScore] to start scoring.
  • Default value: When this function is not called, the difficulty level of scoring is 4.
  • Available since: 2.22.0
  • Restrictions: This function does not support dynamic settings. After calling this function successfully, the next call to [startScore] will take effect.

startScore:pitchValueInterval:

startScore:pitchValueInterval:
- (int)startScore:(NSString *) resourceID pitchValueInterval:(int) pitchValueInterval;
Start scoring.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
resourceIDNSString *the resource ID corresponding to the accompaniment or accompaniment clip.
pitchValueIntervalintthe time interval of real-time pitch line callback, in milliseconds, the default is 50 milliseconds.

Details

Start the scoring function.After starting scoring, the scoring result OnCurrentPitchValueUpdate callback will be received according to the set callback time interval. Use case: Can be used to display the singing score on the view.

  • When to call: After obtaining verbatim lyrics and playing the accompaniment resources of copyrighted music.
  • Available since: 2.15.0
  • Restrictions: Only support use this api after [startPublishingStream].

pauseScore:

pauseScore:
- (int)pauseScore:(NSString *) resourceID;
Pause scoring.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
resourceIDNSString *the resource ID corresponding to the accompaniment or accompaniment clip.

Details

Pause ongoing scoring,will stop the [OnCurrentPitchValueUpdate] callback. Use case: You can call this interface to pause the scoring function while scoring.

  • When to call: It can be called while grading.
  • Available since: 2.15.0

resumeScore:

resumeScore:
- (int)resumeScore:(NSString *) resourceID;
Resume scoring.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
resourceIDNSString *the resource ID corresponding to the accompaniment or accompaniment clip.

Details

Resume currently paused scoring. Use case: When there is currently paused scoring, this interface can be called to resume the scoring function.

  • When to call: It can be called when there is currently a paused scoring.
  • Available since: 2.15.0

stopScore:

stopScore:
- (int)stopScore:(NSString *) resourceID;
Stop scoring.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
resourceIDNSString *the resource ID corresponding to the accompaniment or accompaniment clip.

Details

End the current rating.The [OnCurrentPitchValueUpdate] callback will be stopped, but the average or total score can still be obtained normally. Use case: You can call this interface to end the scoring while scoring.

  • When to call: It can be called while grading.
  • Available since: 2.15.0

resetScore:

resetScore:
- (int)resetScore:(NSString *) resourceID;
Reset scoring.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
resourceIDNSString *the resource ID corresponding to the accompaniment or accompaniment clip.

Details

Reset the scores that have already been performed,The [OnCurrentPitchValueUpdate] callback will be stopped and the average or total score will be 0. Use case: Often used in scenes where the same song is re-sung.

  • When to call: It can be called after scoring has been performed.
  • Available since: 2.15.0

getPreviousScore:

getPreviousScore:
- (int)getPreviousScore:(NSString *) resourceID;
Get the score of the previous sentence.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
resourceIDNSString *the resource ID corresponding to the accompaniment or accompaniment clip.

Details

Get the score of the previous sentence. Use case: Can be used to display the score of each sentence on the view.

  • When to call: It can be called after playing the copyright accompaniment or accompaniment clip and starting to score.
  • Available since: 2.15.0

getAverageScore:

getAverageScore:
- (int)getAverageScore:(NSString *) resourceID;
Get average score.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
resourceIDNSString *the resource ID corresponding to the accompaniment or accompaniment clip.

Details

Get the average score. Use case: Can be used to display the average score on the view.

  • When to call: It can be called after playing the copyright accompaniment or accompaniment clip and starting to score.
  • Available since: 2.15.0

getTotalScore:

getTotalScore:
- (int)getTotalScore:(NSString *) resourceID;
Get total score .
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
resourceIDNSString *the resource ID corresponding to the accompaniment or accompaniment clip.

Details

Get the total score. Use case: Can be used to display the total score on the view.

  • When to call: It can be called after playing the copyright accompaniment or accompaniment clip and starting to score.
  • Available since: 2.15.0

getFullScore:

getFullScore:
- (int)getFullScore:(NSString *) resourceID;
Get full score .
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
resourceIDNSString *the resource ID corresponding to the accompaniment or accompaniment clip.

Details

Get the full score. Use case: Can be used to display the full score on the view.

  • When to call: It can be called after playing the copyright accompaniment or accompaniment clip and starting to score.
  • Available since: 3.0.2

getStandardPitch:callback:

getStandardPitch:callback:
- (void)getStandardPitch:(NSString *) resourceID callback:(nullable ZegoCopyrightedMusicGetStandardPitchCallback) callback;
Get standard pitch data.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
resourceIDNSString *the resource ID corresponding to the accompaniment or accompaniment clip.
callbacknullable ZegoCopyrightedMusicGetStandardPitchCallbackget standard pitch data result.

Details

Get standard pitch data. Use case: Can be used to display standard pitch lines on the view.

  • Caution: Only accompaniment or climactic clip assets have pitch lines.
  • Available since: 2.15.0

getCurrentPitch:

getCurrentPitch:
- (int)getCurrentPitch:(NSString *) resourceID;
Get real-time pitch data.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
resourceIDNSString *the resource ID corresponding to the song or accompaniment.

Details

Get real-time pitch data. Use case: Can be used to display real-time pitch lines on the view.

  • When to call: It can be called after playing the copyright accompaniment or accompaniment clip and starting to score.
  • Available since: 2.15.0

requestSong:callback:

requestSong:callback:
deprecated
- (void)requestSong:(ZegoCopyrightedMusicRequestConfig *) config callback:(nullable ZegoCopyrightedMusicRequestSongCallback) callback;
[Deprecated] Request a song. Deprecated since 3.0.2, please use the [requestResource] function instead.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
configZegoCopyrightedMusicRequestConfig *request configuration.
callbacknullable ZegoCopyrightedMusicRequestSongCallbackrequest a song result

Details

By requesting a song, you can not only obtain basic information about a song (such as duration, song name, and artist), but also obtain the resource ID for local playback, share_token for sharing with others, and related authentication information. Support by the time, by the user monthly, by the room monthly subscription three ways. Use case: Get copyrighted songs for local playback and sharing.

  • When to call: After initializing the copyrighted music success [initCopyrightedMusic].
  • Caution: This interface will trigger billing. A song may have three sound qualities: normal, high-definition, and lossless. Each sound quality has a different resource file, and each resource file has a unique resource ID.
  • Available since: 2.13.0
Deprecated
Deprecated since 3.0.2, please use the [requestResource] function instead.

requestAccompaniment:callback:

requestAccompaniment:callback:
deprecated
- (void)requestAccompaniment:(ZegoCopyrightedMusicRequestConfig *) config callback:(nullable ZegoCopyrightedMusicRequestAccompanimentCallback) callback;
[Deprecated] Request accompaniment. Deprecated since 3.0.2, please use the [requestResource] function instead.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
configZegoCopyrightedMusicRequestConfig *request configuration.
callbacknullable ZegoCopyrightedMusicRequestAccompanimentCallbackrequest accompaniment result.

Details

You can get the accompaniment resources of the song corresponding to the songID, including resource_id, krc_token, share_token, etc. Supports click-by-point accompaniment. Use case: Get copyrighted accompaniment for local playback and sharing.

  • When to call: After initializing the copyrighted music success [initCopyrightedMusic].
  • Caution: This interface will trigger billing.
  • Available since: 2.13.0
Deprecated
Deprecated since 3.0.2, please use the [requestResource] function instead.

requestAccompanimentClip:callback:

requestAccompanimentClip:callback:
deprecated
- (void)requestAccompanimentClip:(ZegoCopyrightedMusicRequestConfig *) config callback:(nullable ZegoCopyrightedMusicRequestAccompanimentClipCallback) callback;
[Deprecated] Request accompaniment clip. Deprecated since 3.0.2, please use the [requestResource] function instead.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
configZegoCopyrightedMusicRequestConfig *request configuration.
callbacknullable ZegoCopyrightedMusicRequestAccompanimentClipCallbackrequest accompaniment clip result.

Details

You can get the accompaniment clip resources of the song corresponding to the songID, including resource_id, krc_token, share_token, etc. Supports accompaniment clips by pay-per-use. Use case: Get copyrighted accompaniment clip for local playback and sharing.

  • When to call: After initializing the copyrighted music success [initCopyrightedMusic].
  • Caution: This interface will trigger billing.
  • Available since: 2.13.0
Deprecated
Deprecated since 3.0.2, please use the [requestResource] function instead.

getMusicByToken:callback:

getMusicByToken:callback:
deprecated
- (void)getMusicByToken:(NSString *) shareToken callback:(nullable ZegoCopyrightedMusicGetMusicByTokenCallback) callback;
[Deprecated] Get a song or accompaniment. Deprecated since 3.0.2, please use the [getSharedResource] function instead.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
shareTokenNSString *access the corresponding authorization token for a song or accompaniment.
callbacknullable ZegoCopyrightedMusicGetMusicByTokenCallbackget a song or accompaniment result.

Details

After the user successfully obtains the song/accompaniment/accompaniment clip resource, he can get the corresponding shareToken, share the shareToken with other users, and other users call this interface to obtain the shared music resources. Use case: In the online KTV scene, after receiving the song or accompaniment token shared by the lead singer, the chorus obtains the corresponding song or accompaniment through this interface, and then plays it on the local end.

  • When to call: After initializing the copyrighted music success [initCopyrightedMusic].
  • Available since: 2.13.0
Deprecated
Deprecated since 3.0.2, please use the [getSharedResource] function instead.

getLrcLyric:callback:

getLrcLyric:callback:
deprecated
- (void)getLrcLyric:(NSString *) songID callback:(nullable ZegoCopyrightedMusicGetLrcLyricCallback) callback;
[Deprecated] Get lyrics in lrc format. Deprecated since 3.2.1, please use the method with the same name with [vendorID] parameter instead.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
songIDNSString *the ID of the song or accompaniment, the song and accompaniment of a song share the same ID.
callbacknullable ZegoCopyrightedMusicGetLrcLyricCallbackget lyrics result

Details

Get lyrics in lrc format, support parsing lyrics line by line. Use case: Used to display lyrics line by line.

  • When to call: After initializing the copyrighted music success [initCopyrightedMusic].
  • Available since: 2.13.0
Deprecated
Deprecated since 2.14.0, please use the method with the same name with [vendorID] parameter instead.

queryCache:type:

queryCache:type:
deprecated
- (BOOL)queryCache:(NSString *) songID type:(ZegoCopyrightedMusicType) type;
[Deprecated] Query the resource's cache is existed or not. Deprecated since 3.2.1, please use the method with the same name with [vendorID] parameter instead.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
songIDNSString *the ID of the song or accompaniment, the song and accompaniment of a song share the same ID.
typeZegoCopyrightedMusicTypethe song resource type.

Details

Query the resource is existed or not. Use case: Can be used to check the resource's cache is existed or not

  • When to call: After initializing the copyrighted music success [initCopyrightedMusic].
  • Available since: 2.13.0
Deprecated
Deprecated since 2.14.0, please use the method with the same name with [vendorID] parameter instead.

queryCache:type:vendorID:

queryCache:type:vendorID:
deprecated
- (BOOL)queryCache:(NSString *) songID type:(ZegoCopyrightedMusicType) type vendorID:(ZegoCopyrightedMusicVendorID) vendorID;
[Deprecated] Query the resource's cache is existed or not. Deprecated since 3.9.0, please use the method with the same name with [config] parameter instead.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
songIDNSString *the ID of the song or accompaniment, the song and accompaniment of a song share the same ID.
typeZegoCopyrightedMusicTypethe song resource type.
vendorIDZegoCopyrightedMusicVendorIDCopyright music resource song copyright provider.

Details

Query the resource is existed or not, query the Yinsuda resource cache by default Use case: Can be used to check the resource's cache is existed or not

  • When to call: After initializing the copyrighted music success [initCopyrightedMusic].
  • Available since: 3.2.1
Deprecated
Deprecated since 3.9.0, please use the method with the same name with [config] parameter instead.

ZegoCopyrightedMusicConfig

CopyrightedMusic play configuration.

Declared in ZegoExpressDefines.h

Properties

user

user
nonatomic, strong ZegoUser * user

User object instance, configure userID, userName. that the user ID set here needs to be consistent with the user ID set when logging in to the room, otherwise the request for the copyright music background service will fail.

ZegoCopyrightedMusicEventHandler

Declared in ZegoExpressEventHandler.h

Methods

onDownloadProgressUpdate:resourceID:progressRate:

onDownloadProgressUpdate:resourceID:progressRate:
- (void)onDownloadProgressUpdate:(ZegoCopyrightedMusic *) copyrightedMusic resourceID:(NSString *) resourceID progressRate:(float) progressRate;
Callback for download song or accompaniment progress rate.
Declared in ZegoExpressEventHandler.h
NameTypeDescription
copyrightedMusicZegoCopyrightedMusic *Copyrighted music instance that triggers this callback.
resourceIDNSString *The resource ID of the song or accompaniment that triggered this callback.
progressRatefloatdownload progress rate.

onCurrentPitchValueUpdate:resourceID:currentDuration:pitchValue:

onCurrentPitchValueUpdate:resourceID:currentDuration:pitchValue:
- (void)onCurrentPitchValueUpdate:(ZegoCopyrightedMusic *) copyrightedMusic resourceID:(NSString *) resourceID currentDuration:(int) currentDuration pitchValue:(int) pitchValue;
Real-time pitch line callback.
Declared in ZegoExpressEventHandler.h
NameTypeDescription
copyrightedMusicZegoCopyrightedMusic *Copyrighted music instance that triggers this callback.
resourceIDNSString *The resource ID of the song or accompaniment that triggered this callback.
currentDurationintCurrent playback progress.
pitchValueintReal-time pitch accuracy or value.

ZegoCopyrightedMusicGetLyricConfig

The configuration of getting lyric.

Declared in ZegoExpressDefines.h

Properties

songID

songID
nonatomic, copy NSString * songID

the ID of the song.

vendorID

vendorID
nonatomic, assign int vendorID

Copyright music resource song copyright provider.

ZegoCopyrightedMusicGetSharedConfig

The configuration of getting shared resource.

Declared in ZegoExpressDefines.h

Properties

songID

songID
nonatomic, copy NSString * songID

the ID of the song.

vendorID

vendorID
nonatomic, assign ZegoCopyrightedMusicVendorID vendorID

Copyright music resource song copyright provider.

roomID

roomID
nonatomic, copy NSString * roomID

The room ID, the single-room mode can not be passed, and the corresponding room ID must be passed in the multi-room mode. Indicates which room to get resources from.

ZegoCopyrightedMusicGetSharedConfigV2

The configuration of getting shared resource.

Declared in ZegoExpressDefines.h

Properties

songID

songID
nonatomic, copy NSString * songID

the ID of the song.

vendorID

vendorID
nonatomic, assign int vendorID

Copyright music resource song copyright provider. Refer to the value of [ZegoCopyrightedMusicVendorID].

roomID

roomID
nonatomic, copy NSString * roomID

The room ID, the single-room mode can not be passed, and the corresponding room ID must be passed in the multi-room mode. Indicates which room to get resources from.

resourceType

resourceType
nonatomic, assign int resourceType

The resource type of music.

ZegoCopyrightedMusicQueryCacheConfig

The configuration of querying cache.

Declared in ZegoExpressDefines.h

Properties

songID

songID
nonatomic, copy NSString * songID

the ID of the song.

resourceType

resourceType
nonatomic, assign ZegoCopyrightedMusicResourceType resourceType

The resource type of music.

resourceQualityType

resourceQualityType
nonatomic, assign ZegoCopyrightedMusicResourceQualityType resourceQualityType

The resource quality type of music.

vendorID

vendorID
nonatomic, assign ZegoCopyrightedMusicVendorID vendorID

Copyright music resource song copyright provider.

ZegoCopyrightedMusicQueryCacheConfigV2

The configuration of querying cache.

Declared in ZegoExpressDefines.h

Properties

songID

songID
nonatomic, copy NSString * songID

the ID of the song.

resourceType

resourceType
nonatomic, assign int resourceType

The resource type of music. Refer to the value of [ZegoCopyrightedMusicResourceType].

resourceQualityType

resourceQualityType
nonatomic, assign int resourceQualityType

The resource quality type of music. Refer to the value of [ZegoCopyrightedMusicResourceQualityType].

vendorID

vendorID
nonatomic, assign int vendorID

Copyright music resource song copyright provider. Refer to the value of [ZegoCopyrightedMusicVendorID].

ZegoCopyrightedMusicRequestConfig

The configuration of requesting resource.

Declared in ZegoExpressDefines.h

Properties

songID

songID
nonatomic, copy NSString * songID

the ID of the song.

mode

mode
nonatomic, assign ZegoCopyrightedMusicBillingMode mode

VOD billing mode.

vendorID

vendorID
nonatomic, assign ZegoCopyrightedMusicVendorID vendorID

Copyright music resource song copyright provider.

roomID

roomID
nonatomic, copy NSString * roomID

The room ID, the single-room mode can not be passed, and the corresponding room ID must be passed in the multi-room mode. Indicate in which room to order song/accompaniment/accompaniment clip/accompaniment segment.

masterID

masterID
nonatomic, copy NSString * masterID

The master ID, which must be passed when the billing mode is billed by host. Indicate which homeowner to order song/accompaniment/accompaniment clip/accompaniment segment.

sceneID

sceneID
nonatomic, assign int sceneID

The scene ID, indicate the actual business. For details, please consult ZEGO technical support.

ZegoCopyrightedMusicRequestConfigV2

The configuration of requesting resource.

Declared in ZegoExpressDefines.h

Properties

songID

songID
nonatomic, copy NSString * songID

the ID of the song.

mode

mode
nonatomic, assign int mode

VOD billing mode. Refer to the value of [ZegoCopyrightedMusicBillingMode].

vendorID

vendorID
nonatomic, assign int vendorID

Copyright music resource song copyright provider. Refer to the value of [ZegoCopyrightedMusicVendorID].

roomID

roomID
nonatomic, copy NSString * roomID

The room ID, the single-room mode can not be passed, and the corresponding room ID must be passed in the multi-room mode. Indicate in which room to order song/accompaniment/accompaniment clip/accompaniment segment.

masterID

masterID
nonatomic, copy NSString * masterID

The master ID, which must be passed when the billing mode is billed by host. Indicate which homeowner to order song/accompaniment/accompaniment clip/accompaniment segment.

sceneID

sceneID
nonatomic, assign int sceneID

The scene ID, indicate the actual business. For details, please consult ZEGO technical support.

resourceType

resourceType
nonatomic, assign int resourceType

The resource type of music. Refer to the value of [ZegoCopyrightedMusicResourceType].

ZegoCrossAppInfo

Cross APP playing stream configuration.

Declared in ZegoExpressDefines.h

Properties

appID

appID
nonatomic, assign unsigned int appID

AppID for playing streams across apps.

token

token
nonatomic, copy NSString * token

The token that needs to be set.

ZegoCustomAudioConfig

Custom audio configuration.

Declared in ZegoExpressDefines.h

Properties

sourceType

sourceType
nonatomic, assign ZegoAudioSourceType sourceType

Audio capture source type

ZegoCustomAudioProcessConfig

Customize the audio processing configuration object.

Details

Including custom audio acquisition type, sampling rate, channel number, sampling number and other parameters

Declared in ZegoExpressDefines.h

Properties

sampleRate

sampleRate
nonatomic, assign ZegoAudioSampleRate sampleRate

Sampling rate, the sampling rate of the input data expected by the audio pre-processing module in App. If 0, the default is the SDK internal sampling rate.

channel

channel
nonatomic, assign ZegoAudioChannel channel

Number of sound channels, the expected number of sound channels for input data of the audio pre-processing module in App. If 0, the default is the number of internal channels in the SDK

samples

samples
nonatomic, assign int samples

The number of samples required to encode a frame; if samples = 0, the SDK will use the internal sample number, and the SDK will pass the audio data to the external pre-processing module. If the samples! = 0 (the effective value of samples is between [160, 2048]), and the SDK will send audio data to the external preprocessing module that sets the length of sample number.

ZegoCustomPlayerResourceConfig

Custom play stream resource type configuration.

Details

Custom play stream resource type configuration.

Declared in ZegoExpressDefines.h

Properties

beforePublish

beforePublish
nonatomic, assign ZegoResourceType beforePublish

The resource type selected by the play stream before starting the publish stream.

publishing

publishing
nonatomic, assign ZegoResourceType publishing

The type of resource selected by the play stream in the publish stream.

afterPublish

afterPublish
nonatomic, assign ZegoResourceType afterPublish

The type of resource selected by the play stream after stopping the publish stream.

ZegoCustomVideoCaptureConfig

Custom video capture configuration.

Details

Custom video capture, that is, the developer is responsible for collecting video data and sending the collected video data to SDK for video data encoding and publishing to the ZEGO RTC server. This feature is generally used by developers who use third-party beauty features or record game screen living. When you need to use the custom video capture function, you need to set an instance of this class as a parameter to the [enableCustomVideoCapture] function. Because when using custom video capture, SDK will no longer start the camera to capture video data. You need to collect video data from video sources by yourself.

Declared in ZegoExpressDefines.h

Properties

bufferType

bufferType
nonatomic, assign ZegoVideoBufferType bufferType

Custom video capture video frame data type

ZegoCustomVideoProcessConfig

Custom video process configuration.

Declared in ZegoExpressDefines.h

Properties

bufferType

bufferType
nonatomic, assign ZegoVideoBufferType bufferType

Custom video process video frame data type. The default value is [ZegoVideoBufferTypeCVPixelBuffer].

ZegoCustomVideoRenderConfig

Custom video render configuration.

Details

When you need to use the custom video render function, you need to set an instance of this class as a parameter to the [enableCustomVideoRender] function.

Declared in ZegoExpressDefines.h

Properties

bufferType

bufferType
nonatomic, assign ZegoVideoBufferType bufferType

Custom video capture video frame data type

frameFormatSeries

frameFormatSeries
nonatomic, assign ZegoVideoFrameFormatSeries frameFormatSeries

Custom video rendering video frame data format。Useless when set bufferType as [EncodedData]

enableEngineRender

enableEngineRender
nonatomic, assign BOOL enableEngineRender

Whether the engine also renders while customizing video rendering. The default value is [false]. Useless when set bufferType as [EncodedData]

ZegoDataRecordConfig

Record config.

Declared in ZegoExpressDefines.h

Properties

filePath

filePath
nonatomic, copy NSString * filePath

The path to save the recording file, absolute path, need to include the file name, the file name need to specify the suffix, currently supports .mp4/.flv/.aac format files, if multiple recording for the same path, will overwrite the file with the same name. The maximum length should be less than 1024 bytes.

recordType

recordType
nonatomic, assign ZegoDataRecordType recordType

Type of recording media

ZegoDataRecordProgress

File recording progress.

Declared in ZegoExpressDefines.h

Properties

duration

duration
nonatomic, assign unsigned long long duration

Current recording duration in milliseconds

currentFileSize

currentFileSize
nonatomic, assign unsigned long long currentFileSize

Current recording file size in byte

quality

quality
nonatomic, strong ZegoPublishStreamQuality * quality

The quality of current recording file

ZegoDeviceInfo

Device Info.

Details

Including device ID and name

Declared in ZegoExpressDefines.h

Properties

deviceID

deviceID
nonatomic, copy NSString * deviceID

Device ID

deviceName

deviceName
nonatomic, copy NSString * deviceName

Device name

deviceExtraInfo

deviceExtraInfo
nonatomic, copy NSString * deviceExtraInfo

Device extra info, Format: key="value" key2="value2"..., use line break to separate key-value pairs, and use equal sign = to separate key and "value", and there are double quotes around the value

ZegoDummyCaptureImageParams

Dummy capture image params.

Declared in ZegoExpressDefines.h

Properties

path

path
nonatomic, copy NSString * path

Picture file path.

mode

mode
nonatomic, assign ZegoDummyCaptureImageMode mode

Dummy capture image mode.

ZegoDumpDataConfig

Dump data config.

Declared in ZegoExpressDefines.h

Properties

dataType

dataType
nonatomic, assign ZegoDumpDataType dataType

Data type.

ZegoEffectsBeautyParam

Beauty configuration param.

Details

Configure the whiten, rosy, smooth, and sharpen parameters for beauty.

Declared in ZegoExpressDefines.h

Properties

whitenIntensity

whitenIntensity
nonatomic, assign int whitenIntensity

The whiten intensity parameter, the value range is [0,100], and the default is 50.

rosyIntensity

rosyIntensity
nonatomic, assign int rosyIntensity

the rosy intensity parameter, value range [0,100], and the default is 50.

smoothIntensity

smoothIntensity
nonatomic, assign int smoothIntensity

the smooth intensity parameter, value range [0,100], and the default is 50.

sharpenIntensity

sharpenIntensity
nonatomic, assign int sharpenIntensity

the sharpen intensity parameter, value range [0,100], and the default is 50.

ZegoEngineConfig

Advanced engine configuration.

Declared in ZegoExpressDefines.h

Properties

logConfig

logConfig
deprecated
nonatomic, strong, nullable ZegoLogConfig * logConfig

Log configuration, if not set, use the default configuration. It must be set before calling [createEngine] to take effect. If it is set after [createEngine], it will take effect at the next [createEngine] after [destroyEngine].

Deprecated
This property has been deprecated since version 2.3.0, please use the [setLogConfig] function instead.

advancedConfig

advancedConfig
nonatomic, copy, nullable NSDictionary<NSString *, NSString *> * advancedConfig

Other special function switches, if not set, no special function will be used by default. Please contact ZEGO technical support before use.

ZegoEngineProfile

Profile for create engine

Details

Profile for create engine

Declared in ZegoExpressDefines.h

Properties

appID

appID
nonatomic, assign unsigned int appID

Application ID issued by ZEGO for developers, please apply from the ZEGO Admin Console https://console.zegocloud.com The value ranges from 0 to 4294967295.

appSign

appSign
nonatomic, strong NSString * 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'. AppSign 2.17.0 and later allows nil or no transmission. If the token is passed empty or not passed, the token must be entered in the [ZegoRoomConfig] parameter for authentication when the [loginRoom] interface is called to login to the room.

scenario

scenario
nonatomic, assign ZegoScenario scenario

The room scenario. the SDK will optimize the audio and video configuration for the specified scenario to achieve the best effect in this scenario. After specifying the scenario, you can call other APIs to adjusting the audio and video configuration. Differences between scenarios and how to choose a suitable scenario, please refer to https://docs.zegocloud.com/article/14940

ZegoExpLowlightEnhancementParams

Low light enhancement params.

Declared in ZegoExpressDefines.h

Properties

mode

mode
nonatomic, assign ZegoLowlightEnhancementMode mode

Low light enhancement mode.

  • Default value: Off.

type

type
nonatomic, assign ZegoExpLowlightEnhancementType type

Low light enhancement type.

  • Default value: Normal.

ZegoExpressDefines

Declared in ZegoExpressDefines.h

Methods

ZegoDestroyCompletionCallback

ZegoDestroyCompletionCallback
Callback for asynchronous destruction completion.
Declared in ZegoExpressDefines.h

In general, developers do not need to listen to this callback.

ZegoRoomSetRoomExtraInfoCallback

ZegoRoomSetRoomExtraInfoCallback
void(^ZegoRoomSetRoomExtraInfoCallback)((int) errorCode);
Callback for setting room extra information.
Declared in ZegoExpressDefines.h
NameTypeDescription
errorCodeintError code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.

ZegoRoomLoginCallback

ZegoRoomLoginCallback
void(^ZegoRoomLoginCallback)((int) errorCode, (NSDictionary *) extendedData);
Login room result callback.
Declared in ZegoExpressDefines.h
NameTypeDescription
errorCodeintError code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.
extendedDataNSDictionary *Extended Information

ZegoRoomLogoutCallback

ZegoRoomLogoutCallback
void(^ZegoRoomLogoutCallback)((int) errorCode, (NSDictionary *) extendedData);
Logout room result callback.
Declared in ZegoExpressDefines.h
NameTypeDescription
errorCodeintError code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.
extendedDataNSDictionary *Extended Information

ZegoUploadLogResultCallback

ZegoUploadLogResultCallback
void(^ZegoUploadLogResultCallback)((int) errorCode);
Log upload result callback.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
errorCodeintError code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.

Details

After calling [uploadLog] to upload the log, get the upload result through this callback.

  • Use cases: When uploading logs, in order to determine whether the logs are uploaded successfully, you can get them through this callback.
  • Caution: In the case of poor network, the return time of this callback may be longer.

ZegoPublisherSetStreamExtraInfoCallback

ZegoPublisherSetStreamExtraInfoCallback
Callback for setting stream extra information.
Declared in ZegoExpressDefines.h
NameTypeDescription
errorCodeintError code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.

ZegoPublisherUpdateCdnUrlCallback

ZegoPublisherUpdateCdnUrlCallback
void(^ZegoPublisherUpdateCdnUrlCallback)((int) errorCode);
Callback for add/remove CDN URL.
Declared in ZegoExpressDefines.h
NameTypeDescription
errorCodeintError code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.

ZegoPublisherTakeSnapshotCallback

ZegoPublisherTakeSnapshotCallback
void(^ZegoPublisherTakeSnapshotCallback)((int) errorCode, (ZGImage * _Nullable) image);
Results of take publish stream snapshot.
Declared in ZegoExpressDefines.h
NameTypeDescription
errorCodeintError code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.
imageZGImage * _NullableSnapshot image

ZegoPublisherGetVideoEncoderSupportedCallback

ZegoPublisherGetVideoEncoderSupportedCallback
Results of get video encoder supported.
Declared in ZegoExpressDefines.h
NameTypeDescription
supportint0 - does not support the specified encoding capability, 1 - supports the specified encoding capability, 2 - undetermined.

ZegoPlayerTakeSnapshotCallback

ZegoPlayerTakeSnapshotCallback
void(^ZegoPlayerTakeSnapshotCallback)((int) errorCode, (ZGImage * _Nullable) image);
Results of take play stream snapshot.
Declared in ZegoExpressDefines.h
NameTypeDescription
errorCodeintError code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.
imageZGImage * _NullableSnapshot image

ZegoPlayerGetVideoDecoderSupportedCallback

ZegoPlayerGetVideoDecoderSupportedCallback
Results of get video decoder supported.
Declared in ZegoExpressDefines.h
NameTypeDescription
supportint0 - does not support the specified decoding capability, 1 - supports the specified decoding capability, 2 - undetermined.

ZegoMixerStartCallback

ZegoMixerStartCallback
void(^ZegoMixerStartCallback)((int) errorCode, (NSDictionary * _Nullable) extendedData);
Results of starting a mixer task.
Declared in ZegoExpressDefines.h
NameTypeDescription
errorCodeintError code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.
extendedDataNSDictionary * _NullableExtended Information

ZegoMixerStopCallback

ZegoMixerStopCallback
void(^ZegoMixerStopCallback)((int) errorCode);
Results of stoping a mixer task.
Declared in ZegoExpressDefines.h
NameTypeDescription
errorCodeintError code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.

ZegoRealTimeSequentialDataSentCallback

ZegoRealTimeSequentialDataSentCallback
Callback for sending real-time sequential data.
Declared in ZegoExpressDefines.h
NameTypeDescription
errorCodeintError code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.

ZegoIMSendBroadcastMessageCallback

ZegoIMSendBroadcastMessageCallback
void(^ZegoIMSendBroadcastMessageCallback)((int) errorCode, (unsigned long long) messageID);
Callback for sending broadcast messages.
Declared in ZegoExpressDefines.h
NameTypeDescription
errorCodeintError code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.
messageIDunsigned long longID of this message

ZegoIMSendBarrageMessageCallback

ZegoIMSendBarrageMessageCallback
void(^ZegoIMSendBarrageMessageCallback)((int) errorCode, (NSString *) messageID);
Callback for sending barrage message.
Declared in ZegoExpressDefines.h
NameTypeDescription
errorCodeintError code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.
messageIDNSString *ID of this message

ZegoIMSendCustomCommandCallback

ZegoIMSendCustomCommandCallback
void(^ZegoIMSendCustomCommandCallback)((int) errorCode);
Callback for sending custom command.
Declared in ZegoExpressDefines.h
NameTypeDescription
errorCodeintError code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.

ZegoRoomSendTransparentMessageCallback

ZegoRoomSendTransparentMessageCallback
Callback for sending custom command.
Declared in ZegoExpressDefines.h
NameTypeDescription
errorCodeintError code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.

ZegoTestNetworkConnectivityCallback

ZegoTestNetworkConnectivityCallback
Callback for test network connectivity.
Declared in ZegoExpressDefines.h
NameTypeDescription
errorCodeintError code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.
resultZegoTestNetworkConnectivityResult *Network connectivity test results

ZegoNetworkProbeResultCallback

ZegoNetworkProbeResultCallback
void(^ZegoNetworkProbeResultCallback)((int) errorCode, (ZegoNetworkProbeResult *) result);
Callback for network probe.
Declared in ZegoExpressDefines.h
NameTypeDescription
errorCodeintError code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.
resultZegoNetworkProbeResult *Network probe result

ZegoMediaPlayerLoadResourceCallback

ZegoMediaPlayerLoadResourceCallback
void(^ZegoMediaPlayerLoadResourceCallback)((int) errorCode);
Callback for media player loads resources.
Declared in ZegoExpressDefines.h
NameTypeDescription
errorCodeintError code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.

ZegoMediaPlayerSeekToCallback

ZegoMediaPlayerSeekToCallback
void(^ZegoMediaPlayerSeekToCallback)((int) errorCode);
Callback for media player seek to playback progress.
Declared in ZegoExpressDefines.h
NameTypeDescription
errorCodeintError code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.

ZegoMediaPlayerTakeSnapshotCallback

ZegoMediaPlayerTakeSnapshotCallback
void(^ZegoMediaPlayerTakeSnapshotCallback)((int) errorCode, (ZGImage * _Nullable) image);
The callback of the screenshot of the media player playing screen
Declared in ZegoExpressDefines.h
NameTypeDescription
errorCodeintError code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.
imageZGImage * _NullableSnapshot image

ZegoAudioEffectPlayerLoadResourceCallback

ZegoAudioEffectPlayerLoadResourceCallback
Callback for audio effect player loads resources.
Declared in ZegoExpressDefines.h
NameTypeDescription
errorCodeintError code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.

ZegoAudioEffectPlayerSeekToCallback

ZegoAudioEffectPlayerSeekToCallback
void(^ZegoAudioEffectPlayerSeekToCallback)((int) errorCode);
Callback for audio effect player seek to playback progress.
Declared in ZegoExpressDefines.h
NameTypeDescription
errorCodeintError code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.

ZegoCopyrightedMusicInitCallback

ZegoCopyrightedMusicInitCallback
void(^ZegoCopyrightedMusicInitCallback)((int) errorCode);
Callback for copyrighted music init.
Declared in ZegoExpressDefines.h
NameTypeDescription
errorCodeintError code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.

ZegoCopyrightedMusicSendExtendedRequestCallback

ZegoCopyrightedMusicSendExtendedRequestCallback
void(^ZegoCopyrightedMusicSendExtendedRequestCallback)((int) errorCode, (NSString *) command, (NSString *) result);
Callback of sending extended feature request.
Declared in ZegoExpressDefines.h
NameTypeDescription
errorCodeintError code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.
commandNSString *request command.
resultNSString *request result, each request command has corresponding request result.

ZegoCopyrightedMusicGetLrcLyricCallback

ZegoCopyrightedMusicGetLrcLyricCallback
void(^ZegoCopyrightedMusicGetLrcLyricCallback)((int) errorCode, (NSString *) lyrics);
Get lrc format lyrics complete callback.
Declared in ZegoExpressDefines.h
NameTypeDescription
errorCodeintError code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.
lyricsNSString *lrc format lyrics.

ZegoCopyrightedMusicGetKrcLyricByTokenCallback

ZegoCopyrightedMusicGetKrcLyricByTokenCallback
void(^ZegoCopyrightedMusicGetKrcLyricByTokenCallback)((int) errorCode, (NSString *) lyrics);
Get verbatim lyrics complete callback.
Declared in ZegoExpressDefines.h
NameTypeDescription
errorCodeintError code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.
lyricsNSString *verbatim lyrics.

ZegoCopyrightedMusicRequestSongCallback

ZegoCopyrightedMusicRequestSongCallback
void(^ZegoCopyrightedMusicRequestSongCallback)((int) errorCode, (NSString *) resource);
Callback for request song.
Declared in ZegoExpressDefines.h
NameTypeDescription
errorCodeintError code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.
resourceNSString *The JSON string returned by the song ordering service, including song resource information.

ZegoCopyrightedMusicRequestAccompanimentCallback

ZegoCopyrightedMusicRequestAccompanimentCallback
void(^ZegoCopyrightedMusicRequestAccompanimentCallback)((int) errorCode, (NSString *) resource);
Callback for request accompaniment.
Declared in ZegoExpressDefines.h
NameTypeDescription
errorCodeintError code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.
resourceNSString *accompany resource information.

ZegoCopyrightedMusicRequestAccompanimentClipCallback

ZegoCopyrightedMusicRequestAccompanimentClipCallback
void(^ZegoCopyrightedMusicRequestAccompanimentClipCallback)((int) errorCode, (NSString *) resource);
Callback for request accompaniment clip.
Declared in ZegoExpressDefines.h
NameTypeDescription
errorCodeintError code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.
resourceNSString *accompany clip resource information.

ZegoCopyrightedMusicGetMusicByTokenCallback

ZegoCopyrightedMusicGetMusicByTokenCallback
void(^ZegoCopyrightedMusicGetMusicByTokenCallback)((int) errorCode, (NSString *) resource);
Callback for acquire songs or accompaniment through authorization token.
Declared in ZegoExpressDefines.h
NameTypeDescription
errorCodeintError code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.
resourceNSString *song or accompany resource information.

ZegoCopyrightedMusicRequestResourceCallback

ZegoCopyrightedMusicRequestResourceCallback
void(^ZegoCopyrightedMusicRequestResourceCallback)((int) errorCode, (NSString *) resource);
Callback of requesting music resource.
Declared in ZegoExpressDefines.h
NameTypeDescription
errorCodeintError code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.
resourceNSString *The JSON string returned by the song ordering service, including music resource information.

ZegoCopyrightedMusicGetSharedResourceCallback

ZegoCopyrightedMusicGetSharedResourceCallback
void(^ZegoCopyrightedMusicGetSharedResourceCallback)((int) errorCode, (NSString *) resource);
Callback of getting shared music resource.
Declared in ZegoExpressDefines.h
NameTypeDescription
errorCodeintError code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.
resourceNSString *The JSON string returned by the song ordering service, including music resource information.

ZegoCopyrightedMusicDownloadCallback

ZegoCopyrightedMusicDownloadCallback
void(^ZegoCopyrightedMusicDownloadCallback)((int) errorCode);
Callback for download song or accompaniment.
Declared in ZegoExpressDefines.h
NameTypeDescription
errorCodeintError code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.

ZegoCopyrightedMusicGetStandardPitchCallback

ZegoCopyrightedMusicGetStandardPitchCallback
void(^ZegoCopyrightedMusicGetStandardPitchCallback)((int) errorCode, (NSString *) pitch);
Get standard pitch data complete callback.
Declared in ZegoExpressDefines.h
NameTypeDescription
errorCodeintError code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.
pitchNSString *Standard pitch data.

ZegoRangeSceneLoginSceneCallback

ZegoRangeSceneLoginSceneCallback
void(^ZegoRangeSceneLoginSceneCallback)((int) errorCode, (ZegoSceneConfig *) config);
Login scene result callback. Do not call the SDK interface in the callback thread.
Declared in ZegoExpressDefines.h
NameTypeDescription
errorCodeintError code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.
configZegoSceneConfig *State channel count.

ZegoRangeSceneLogoutSceneCallback

ZegoRangeSceneLogoutSceneCallback
void(^ZegoRangeSceneLogoutSceneCallback)((int) errorCode);
Logout scene result callback. Do not call the SDK interface in the callback thread.
Declared in ZegoExpressDefines.h
NameTypeDescription
errorCodeintError code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.

ZegoRangeSceneGetUserCountCallback

ZegoRangeSceneGetUserCountCallback
void(^ZegoRangeSceneGetUserCountCallback)((int) errorCode, (unsigned int) count);
The callback of getting user count in scene. Do not call the SDK interface in the callback thread.
Declared in ZegoExpressDefines.h
NameTypeDescription
errorCodeintError code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.
countunsigned intUser count in scene.

ZegoRangeSceneGetUserListInViewCallback

ZegoRangeSceneGetUserListInViewCallback
void(^ZegoRangeSceneGetUserListInViewCallback)((int) errorCode, (NSArray<NSString *> *) userList);
The callback of getting user list in view. Do not call the SDK interface in the callback thread.
Declared in ZegoExpressDefines.h
NameTypeDescription
errorCodeintError code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.
userListNSArray<NSString *> *User list in view.

ZegoRangeSceneSendCustomCommandCallback

ZegoRangeSceneSendCustomCommandCallback
The callback of send custom command. Do not call the SDK interface in the callback thread.
Declared in ZegoExpressDefines.h
NameTypeDescription
errorCodeintError code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.

ZegoRangeSceneJoinTeamCallback

ZegoRangeSceneJoinTeamCallback
void(^ZegoRangeSceneJoinTeamCallback)((int) errorCode, (unsigned int) teamID);
Join team result callback. Do not call the SDK interface in the callback thread.
Declared in ZegoExpressDefines.h
NameTypeDescription
errorCodeintError code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.
teamIDunsigned intTeam ID.

ZegoRangeSceneLeaveTeamCallback

ZegoRangeSceneLeaveTeamCallback
void(^ZegoRangeSceneLeaveTeamCallback)((int) errorCode, (unsigned int) teamID);
Leave team result callback. Do not call the SDK interface in the callback thread.
Declared in ZegoExpressDefines.h
NameTypeDescription
errorCodeintError code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.
teamIDunsigned intTeam ID.

ZegoRangeSceneCreateItemCallback

ZegoRangeSceneCreateItemCallback
void(^ZegoRangeSceneCreateItemCallback)((int) errorCode, (long long) itemID);
Create item result callback. Do not call the SDK interface in the callback thread.
Declared in ZegoExpressDefines.h
NameTypeDescription
errorCodeintError code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.
itemIDlong longItem ID.

ZegoRangeSceneDestroyItemCallback

ZegoRangeSceneDestroyItemCallback
void(^ZegoRangeSceneDestroyItemCallback)((int) errorCode, (long long) itemID);
Destroy item result callback. Do not call the SDK interface in the callback thread.
Declared in ZegoExpressDefines.h
NameTypeDescription
errorCodeintError code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.
itemIDlong longItem ID.

ZegoRangeSceneBindItemCallback

ZegoRangeSceneBindItemCallback
void(^ZegoRangeSceneBindItemCallback)((int) errorCode, (long long) itemID);
Bind item result callback. Do not call the SDK interface in the callback thread.
Declared in ZegoExpressDefines.h
NameTypeDescription
errorCodeintError code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.
itemIDlong longItem ID.

ZegoRangeSceneUnbindItemCallback

ZegoRangeSceneUnbindItemCallback
void(^ZegoRangeSceneUnbindItemCallback)((int) errorCode, (long long) itemID);
Unbind item result callback. Do not call the SDK interface in the callback thread.
Declared in ZegoExpressDefines.h
NameTypeDescription
errorCodeintError code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.
itemIDlong longItem ID.

ZegoRangeSceneUpdateItemStatusCallback

ZegoRangeSceneUpdateItemStatusCallback
void(^ZegoRangeSceneUpdateItemStatusCallback)((int) errorCode, (long long) itemID);
Update item status result callback. Do not call the SDK interface in the callback thread.
Declared in ZegoExpressDefines.h
NameTypeDescription
errorCodeintError code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.
itemIDlong longItem ID.

ZegoRangeSceneUpdateItemCommandCallback

ZegoRangeSceneUpdateItemCommandCallback
void(^ZegoRangeSceneUpdateItemCommandCallback)((int) errorCode, (long long) itemID);
Update item command result callback. Do not call the SDK interface in the callback thread.
Declared in ZegoExpressDefines.h
NameTypeDescription
errorCodeintError code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.
itemIDlong longItem ID.

ZegoAudioCaptureDeviceEnableCallback

ZegoAudioCaptureDeviceEnableCallback
void(^ZegoAudioCaptureDeviceEnableCallback)((int) errorCode);
Enable audio capture device result callback.
Declared in ZegoExpressDefines.h
NameTypeDescription
errorCodeintError code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.

ZegoExpressEngine

Declared in ZegoExpressEngine.h

Methods

createEngineWithProfile:eventHandler:

static
createEngineWithProfile:eventHandler:
+ (ZegoExpressEngine *)createEngineWithProfile:(ZegoEngineProfile *) profile eventHandler:(nullable id<ZegoEventHandler>) eventHandler;
Create ZegoExpressEngine singleton object and initialize SDK.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
profileZegoEngineProfile *The basic configuration information is used to create the engine.
eventHandlernullable id<ZegoEventHandler>Event notification callback. [nil] means not receiving any callback notifications.It can also be managed later via [setEventHandler]. If [createEngine] is called repeatedly and the [destroyEngine] function is not called to destroy the engine before the second call, the eventHandler will not be updated.

Details

Create ZegoExpressEngine singleton object and initialize SDK.

  • When to call: The engine needs to be created before calling other functions.
  • Caution: The SDK only supports the creation of one instance of ZegoExpressEngine. If you need call [createEngine] multiple times, you need call [destroyEngine] before you call the next [createEngine]. Otherwise it will return the instance which created by [createEngine] you called last time.
  • Available since: 2.14.0
  • Restrictions: None.

Return

engine singleton instance.

destroyEngine:

static
destroyEngine:
+ (void)destroyEngine:(nullable ZegoDestroyCompletionCallback) callback;
Destroy the ZegoExpressEngine singleton object and deinitialize the SDK.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
callbacknullable ZegoDestroyCompletionCallbackNotification callback for destroy engine completion. Developers can listen to this callback to ensure that device hardware resources are released. If the developer only uses SDK to implement audio and video functions, this parameter can be passed [nil].

Details

Destroy the ZegoExpressEngine singleton object and deinitialize the SDK.

  • When to call: When the SDK is no longer used, the resources used by the SDK can be released through this interface
  • Caution: After using [createEngine] to create a singleton, if the singleton object has not been created or has been destroyed, you will not receive related callbacks when calling this function.
  • Available since: 1.1.0
  • Restrictions: None.

sharedEngine

static
sharedEngine
+ (ZegoExpressEngine *)sharedEngine;
Returns the singleton instance of ZegoExpressEngine.
Declared in ZegoExpressEngine.h

If the engine has not been created or has been destroyed, an unusable engine object will be returned.

  • When to call: After creating the engine, before destroying the engine.
  • Available since: 1.1.0
  • Restrictions: None.

Engine singleton instance

setEngineConfig:

static
setEngineConfig:
+ (void)setEngineConfig:(ZegoEngineConfig *) config;
Set advanced engine configuration.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
configZegoEngineConfig *Advanced engine configuration

Details

Used to enable advanced functions.

  • When to call: Different configurations have different call timing requirements. For details, please consult ZEGO technical support.
  • Available since: 1.1.0
  • Restrictions: None.

setLogConfig:

static
setLogConfig:
+ (void)setLogConfig:(ZegoLogConfig *) config;
Set log configuration.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
configZegoLogConfig *log configuration.

Details

If you need to customize the log file size and path, please call this function to complete the configuration.

  • When to call: It must be set before calling [createEngine] to take effect. If it is set after [createEngine], it will take effect at the next [createEngine] after [destroyEngine].
  • Caution: Once this interface is called, the method of setting log size and path via [setEngineConfig] will be invalid.Therefore, it is not recommended to use [setEngineConfig] to set the log size and path.
  • Available since: 2.3.0
  • Restrictions: None.

setLocalProxyConfig:enable:

static
setLocalProxyConfig:enable:
+ (void)setLocalProxyConfig:(NSArray<ZegoProxyInfo *> *) proxyList enable:(BOOL) enable;
Set local proxy config.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
proxyListNSArray<ZegoProxyInfo *> *proxy info.
enableBOOLenable proxy or not.

Details

If you need to use the local proxy feature, please call this function to complete the configuration.

  • When to call: Must be set before calling [createEngine] to take effect, otherwise it will fail.
  • Caution: None.
  • Available since: 3.1.0
  • Restrictions: After [createEngine], can not change the proxy.

setCloudProxyConfig:token:enable:

static
setCloudProxyConfig:token:enable:
+ (void)setCloudProxyConfig:(NSArray<ZegoProxyInfo *> *) proxyList token:(NSString *) token enable:(BOOL) enable;
Set cloud proxy config.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
proxyListNSArray<ZegoProxyInfo *> *proxy info.
tokenNSString *token. if use appsign auth, ignore.
enableBOOLenable proxy or not.

Details

If you need to use the cloud proxy feature, please call this function to complete the configuration.

  • When to call: Must be set before calling [createEngine] to take effect, otherwise it will fail.
  • Caution: None.
  • Available since: 3.1.0
  • Restrictions: After [createEngine], can not change the proxy.

setLicense:

static
setLicense:
+ (void)setLicense:(NSString *) license;
Set license auth.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
licenseNSString *license.

Details

This function needs to be called to complete the configuration when using License authentication charges.

  • When to call: Must be set before calling [createEngine] to take effect, otherwise it will fail.
  • Caution: None.
  • Available since: 3.5.0
  • Restrictions: Does not support midway changes.

setRoomMode:

static
setRoomMode:
+ (void)setRoomMode:(ZegoRoomMode) mode;
Set room mode.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
modeZegoRoomModeRoom mode. Description: Used to set the room mode. Use cases: If you need to enter multiple rooms at the same time for publish-play stream, please turn on the multi-room mode through this interface. Required: True. Default value: ZEGO_ROOM_MODE_SINGLE_ROOM.

Details

If you need to use the multi-room feature, please call this function to complete the configuration.

  • When to call: Must be set before calling [createEngine] to take effect, otherwise it will fail.
  • Caution: None.
  • Available since: 2.9.0
  • Restrictions: If you need to use the multi-room feature, please contact the instant technical support to configure the server support.

setGeoFence:area:

static
setGeoFence:area:
+ (void)setGeoFence:(ZegoGeoFenceType) type area:(NSArray<NSNumber *> *) area;
Set Geo Fence.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
typeZegoGeoFenceTypeGeo fence type. Description: Used to set the geo fence type.
areaNSArray<NSNumber *> *Geo fence area. Description: Used to describe the range of geo fence.

Details

If you need to use the geo fence feature, please call this function to complete the configuration.

  • When to call: Must be set before calling [createEngine] to take effect, otherwise it will fail.
  • Caution: None.
  • Available since: 3.4.0
  • Restrictions: If you need to use the geo fence feature, please contact ZEGO Technical Support.

getVersion

static
getVersion
+ (NSString *)getVersion;
Gets the SDK's version number.
Declared in ZegoExpressEngine.h

If you encounter an abnormality during the running of the SDK, you can submit the problem, log and other information to the ZEGO technical staff to locate and troubleshoot. Developers can also collect current SDK version information through this API, which is convenient for App operation statistics and related issues.

  • When to call: Any time.
  • Caution: None.
  • Available since: 1.1.0
  • Restrictions: None.

SDK version.

setApiCalledCallback:

static
setApiCalledCallback:
+ (void)setApiCalledCallback:(nullable id<ZegoApiCalledEventHandler>) callback;
Set method execution result callback.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
callbacknullable id<ZegoApiCalledEventHandler>Method execution result callback.

Details

Set the setting of the execution result of the calling method. After setting, you can get the detailed information of the result of each execution of the ZEGO SDK method.

  • When to call: Any time.
  • Caution: It is recommended that developers call this interface only when they need to obtain the call results of each interface. For example, when troubleshooting and tracing problems. Developers generally do not need to pay attention to this interface.
  • Available since: 2.3.0
  • Restrictions: None.

isFeatureSupported:

static
isFeatureSupported:
+ (BOOL)isFeatureSupported:(ZegoFeatureType) featureType;
Query whether the current SDK supports the specified feature.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
featureTypeZegoFeatureTypeType of feature to query.

Details

Since the SDK supports feature trimming, some features may be trimmed; you can use this function to quickly determine whether the current SDK supports the specified features, such as querying whether the media player feature is supported.

  • When to call: Any time.
  • Available since: 2.22.0

Return

Whether the specified feature is supported. true: supported; false: not supported.

submitLog

static
submitLog
+ (void)submitLog;
Uploads logs to the ZEGO server.
Declared in ZegoExpressEngine.h

By default, SDK creates and prints log files in the App's default directory. Each log file defaults to a maximum of 5MB. Three log files are written over and over in a circular fashion. When calling this function, SDK will auto package and upload the log files to the ZEGO server.

  • Use cases: Developers can provide a business “feedback” channel in the App. When users feedback problems, they can call this function to upload the local log information of SDK to help locate user problems.
  • When to call: None.
  • Caution: 1.After calling this interface to upload logs, if you call [destroyEngine] or exit the App too quickly, there may be a failure.It is recommended to wait a few seconds, and then call [destroyEngine] or exit the App after receiving the upload success callback. 2.It is supported to call before [createEngine]. If it had called [createEngine] before, the last appid will be used to upload the log, otherwise the log will not be uploaded until the next [createEngine].
  • Available since: 3.7.0
  • Restrictions: The frequency limit is once per minute.

createEngineWithAppID:appSign:isTestEnv:scenario:eventHandler:

static
createEngineWithAppID:appSign:isTestEnv:scenario:eventHandler:
deprecated
+ (ZegoExpressEngine *)createEngineWithAppID:(unsigned int) appID appSign:(NSString *) appSign isTestEnv:(BOOL) isTestEnv scenario:(ZegoScenario) scenario eventHandler:(nullable id<ZegoEventHandler>) eventHandler;
[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](https://docs.zegocloud.com/article/13315) for more details.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
appIDunsigned intApplication ID issued by ZEGO for developers, please apply from the ZEGO Admin Console https://console.zegocloud.com The value ranges from 0 to 4294967295.
appSignNSString *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'. AppSign 2.17.0 and later allows null or no transmission. If the token is passed empty or not passed, the token must be entered in the [ZegoRoomConfig] parameter for authentication when the [loginRoom] interface is called to login to the room.
isTestEnvBOOL[Deprecated] For providing better and more standardized services, starting from 2021-11-16, ZEGO no longer classifies environments into production environments and testing environments. f you create your project in ZEGO Admin Console on/before 2021-11-16, refer to Testing environment deprecation to upgrade the SDK and adjust related codes.
scenarioZegoScenarioThe room scenario. the SDK will optimize the audio and video configuration for the specified scenario to achieve the best effect in this scenario. After specifying the scenario, you can call other APIs to adjusting the audio and video configuration. Differences between scenarios and how to choose a suitable scenario, please refer to https://docs.zegocloud.com/article/14940
eventHandlernullable id<ZegoEventHandler>Event notification callback. [nil] means not receiving any callback notifications.It can also be managed later via [setEventHandler]. If [createEngine] is called repeatedly and the [destroyEngine] function is not called to destroy the engine before the second call, the eventHandler will not be updated.

Details

Create ZegoExpressEngine singleton object and initialize SDK.

  • When to call: The engine needs to be created before calling other functions.
  • Caution: The SDK only supports the creation of one instance of ZegoExpressEngine. If you need call [createEngine] multiple times, you need call [destroyEngine] before you call the next [createEngine]. Otherwise it will return the instance which created by [createEngine] you called last time.
  • Restrictions: None.
Deprecated
Deprecated since 2.14.0, please use the method with the same name without [isTestEnv] parameter instead.

Return

Engine singleton instance.

setEventHandler:

setEventHandler:
- (void)setEventHandler:(nullable id<ZegoEventHandler>) eventHandler;
Sets 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.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
eventHandlernullable id<ZegoEventHandler>Event notification callback. If the eventHandler is set to [nil], all the callbacks set previously will be cleared. Developers should monitor the corresponding callbacks according to their own business scenarios. The main callback functions of the SDK are here.

Details

Set up event notification callbacks, used to monitor callbacks such as engine status changes, room status changes, etc.

  • When to call: After [createEngine].
  • Caution: After calling this function or [createEngine] setting a callback, unless this function is called to clear the callback, setting a callback again will not take effect. After calling [destroyEngine], the event handler that has been set will be invalid and need to be reset after next calling of [createEngine].
  • Available since: 1.1.0
  • Restrictions: None.

setRoomScenario:

setRoomScenario:
- (void)setRoomScenario:(ZegoScenario) scenario;
Set room scenario.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
scenarioZegoScenarioRoom scenario.

Details

You can set the scenario of the room, and the SDK will adopt different optimization strategies for different scenarios in order to obtain better effects; this function does exactly the same thing as the [scenario] parameter in the [profile] configuration of [createEngine].

  • Use cases: This function is suitable for apps in various audio and video business scenarios, such as 1v1 video call (or voice call) scenario and live show scenario; this function can be used to switch scenarios without destroying the engine through [destroyEngine].
  • When to call: Must be set before calling [loginRoom] AND after calling [createEngine].
  • Caution: 1. Users in the same room are recommended to use the same room scenario for best results. 2. Setting the scenario will affect the audio and video bit rate, frame rate, resolution, codec id, audio device mode, audio route type, traffic control, 3A, ear return and other audio and video configurations. If you have special needs, you can call various other APIs to set the above configuration after calling this API. 3. Calling this function will override the scenario specified on [createEngine] or the scenario set by the last call to this function. 4. Calling this function will overwrite the audio and video related configuration you set through APIs such as [setVideoConfig], [setAudioConfig], so it is recommended to set the scenario first and then adjust the audio and video configuration through other APIs.
  • Available since: 3.0.0
  • Restrictions: Once you log in to the room, you are no longer allowed to modify the room scenario. If you need to modify the scenario, you need to log out of the room first. If you log in to multiple rooms, you need to log out of all rooms before you can modify it.

uploadLog

uploadLog
- (void)uploadLog;
Uploads logs to the ZEGO server.
Declared in ZegoExpressEngine.h

By default, SDK creates and prints log files in the App's default directory. Each log file defaults to a maximum of 5MB. Three log files are written over and over in a circular fashion. When calling this function, SDK will auto package and upload the log files to the ZEGO server.

  • Use cases: Developers can provide a business “feedback” channel in the App. When users feedback problems, they can call this function to upload the local log information of SDK to help locate user problems.
  • When to call: After [createEngine].
  • Caution: 1.After calling this interface to upload logs, if you call [destroyEngine] or exit the App too quickly, there may be a failure.It is recommended to wait a few seconds, and then call [destroyEngine] or exit the App after receiving the upload success callback. 2.If you want to call before [createEngine], use the [submitLog] interface.
  • Available since: 1.1.0
  • Restrictions: The frequency limit is once per minute.

uploadLog:

uploadLog:
- (void)uploadLog:(nullable ZegoUploadLogResultCallback) callback;
Uploads logs to the ZEGO server, with callback.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
callbacknullable ZegoUploadLogResultCallbackLog upload result callback.

Details

By default, SDK creates and prints log files in the App's default directory. Each log file defaults to a maximum of 5MB. Three log files are written over and over in a circular fashion. When calling this function, SDK will auto package and upload the log files to the ZEGO server.

  • Use cases: Developers can provide a business “feedback” channel in the App. When users feedback problems, they can call this function to upload the local log information of SDK to help locate user problems.
  • When to call: After [createEngine].
  • Caution: 1.After calling this interface to upload logs, if you call [destroyEngine] or exit the App too quickly, there may be a failure.It is recommended to wait a few seconds, and then call [destroyEngine] or exit the App after receiving the upload success callback. 2.If you want to call before [createEngine], use the [submitLog] interface.
  • Available since: 2.4.0
  • Restrictions: The frequency limit is once per minute.

enableDebugAssistant:

enableDebugAssistant:
- (void)enableDebugAssistant:(BOOL) enable;
Enable the debug assistant. Note, do not enable this feature in the online version! Use only during development phase!
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
enableBOOLWhether to enable the debug assistant.

Details

After enabled, the SDK will print logs to the console, and will pop-up an alert (toast) UI message when there is a problem with calling other SDK functions.

  • Default value: This function is disabled by default.
  • When to call: This function can be called right after [createEngine].
  • Platform differences: The pop-up alert function only supports Android / iOS / macOS / Windows, and the console log function supports all platforms.
  • Caution: Be sure to confirm that this feature is turned off before the app is released to avoid pop-up UI alert when an error occurs in your release version's app. It is recommended to associate the [enable] parameter of this function with the DEBUG variable of the app, that is, only enable the debug assistant in the DEBUG environment.
  • Available since: 2.17.0
  • Restrictions: None.

callExperimentalAPI:

callExperimentalAPI:
- (NSString *)callExperimentalAPI:(NSString *) params;
Call the experimental API.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
paramsNSString *Parameters in the format of a JSON string, please consult ZEGO technical support for details.

Details

ZEGO provides some technical previews or special customization functions in RTC business through this API. If you need to get the use of the function or the details, please consult ZEGO technical support.

  • When to call: After [createEngine].
  • Available since: 2.7.0

Return

Returns an argument in the format of a JSON string, please consult ZEGO technical support for details.

loginRoom:user:

loginRoom:user:
- (void)loginRoom:(NSString *) roomID user:(ZegoUser *) user;
Logs in to a room. You must log in to a room before publishing or playing streams.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
roomIDNSString *Room ID, a string of less 128 bytes in length.
Caution:
1. room ID is defined by yourself.
2. Only support numbers, English characters and '~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', '=', '-', '`', ';', '’', ',', '.', '<', '>', ''.
3. If you need to communicate with the Web SDK, please do not use '%'.
userZegoUser *User object instance, configure userID, userName. Note that the userID needs to be globally unique with the same appID, otherwise the user who logs in later will kick out the user who logged in first.

Details

If the room does not exist, [loginRoom] creates and logs in the room. SDK uses the 'room' to organize users. After users log in to a room, they can use interface such as push stream [startPublishingStream], pull stream [startPlayingStream], send and receive broadcast messages [sendBroadcastMessage], etc.

  • Use cases: In the same room, users can conduct live broadcast, audio and video calls, etc.
  • When to call /Trigger: This interface is called after [createEngine] initializes the SDK.
  • Caution: 1. Apps that use different appIDs cannot intercommunication with each other. 2. SDK supports startPlayingStream audio and video streams from different rooms under the same appID, that is, startPlayingStream audio and video streams across rooms. Since ZegoExpressEngine's room related callback notifications are based on the same room, when developers want to startPlayingStream streams across rooms, developers need to maintain related messages and signaling notifications by themselves. 3. It is strongly recommended that userID corresponds to the user ID of the business APP, that is, a userID and a real user are fixed and unique, and should not be passed to the SDK in a random userID. Because the unique and fixed userID allows ZEGO technicians to quickly locate online problems. 4. After the first login failure due to network reasons or the room is disconnected, the default time of SDK reconnection is 20min.
  • Privacy reminder: Please do not fill in sensitive user information in this interface, including but not limited to mobile phone number, ID number, passport number, real name, etc.
  • Related callbacks: 1. When the user starts to log in to the room, the room is successfully logged in, or the room fails to log in, the [onRoomStateChanged] (Not supported before 2.18.0, please use [onRoomStateUpdate]) callback will be triggered to notify the developer of the status of the current user connected to the room. 2. Different users who log in to the same room can get room related notifications in the same room (eg [onRoomUserUpdate], [onRoomStreamUpdate], etc.), and users in one room cannot receive room signaling notifications in another room. 3. If the network is temporarily interrupted due to network quality reasons, the SDK will automatically reconnect internally. You can get the current connection status of the local room by listening to the [onRoomStateChanged] (Not supported before 2.18.0, please use [onRoomStateUpdate]) callback method, and other users in the same room will receive [onRoomUserUpdate] callback notification. 4. Messages sent in one room (e.g. [setStreamExtraInfo], [sendBroadcastMessage], [sendBarrageMessage], [sendCustomCommand], etc.) cannot be received callback ((eg [onRoomStreamExtraInfoUpdate], [onIMRecvBroadcastMessage], [onIMRecvBarrageMessage], [onIMRecvCustomCommand], etc) in other rooms. Currently, SDK does not provide the ability to send messages across rooms. Developers can integrate the SDK of third-party IM to achieve.
  • Related APIs: 1. Users can call [logoutRoom] to log out. In the case that a user has successfully logged in and has not logged out, if the login interface is called again, the console will report an error and print the error code 1002001. 2. SDK supports multi-room login, please call [setRoomMode] function to select multi-room mode before engine initialization, and then call [loginRoom] to log in to multi-room. 3. Calling [destroyEngine] will also automatically log out.

loginRoom:user:config:

loginRoom:user:config:
- (void)loginRoom:(NSString *) roomID user:(ZegoUser *) user config:(ZegoRoomConfig *) config;
Logs in to a room with advanced room configurations. You must log in to a room before publishing or playing streams.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
roomIDNSString *Room ID, a string of less 128 bytes in length.
Caution:
1. room ID is defined by yourself.
2. Only support numbers, English characters and '~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', '=', '-', '`', ';', '’', ',', '.', '<', '>', ''.
3. If you need to communicate with the Web SDK, please do not use '%'.
userZegoUser *User object instance, configure userID, userName. Note that the userID needs to be globally unique with the same appID, otherwise the user who logs in later will kick out the user who logged in first.
configZegoRoomConfig *Advanced room configuration.

Details

If the room does not exist, [loginRoom] creates and logs in the room. SDK uses the 'room' to organize users. After users log in to a room, they can use interface such as push stream [startPublishingStream], pull stream [startPlayingStream], send and receive broadcast messages [sendBroadcastMessage], etc. To prevent the app from being impersonated by a malicious user, you can add authentication before logging in to the room, that is, the [token] parameter in the ZegoRoomConfig object passed in by the [config] parameter.

  • Use cases: In the same room, users can conduct live broadcast, audio and video calls, etc.
  • When to call /Trigger: This interface is called after [createEngine] initializes the SDK.
  • Caution: 1. Apps that use different appIDs cannot intercommunication with each other. 2. SDK supports startPlayingStream audio and video streams from different rooms under the same appID, that is, startPlayingStream audio and video streams across rooms. Since ZegoExpressEngine's room related callback notifications are based on the same room, when developers want to startPlayingStream streams across rooms, developers need to maintain related messages and signaling notifications by themselves. 3. It is strongly recommended that userID corresponds to the user ID of the business APP, that is, a userID and a real user are fixed and unique, and should not be passed to the SDK in a random userID. Because the unique and fixed userID allows ZEGO technicians to quickly locate online problems. 4. After the first login failure due to network reasons or the room is disconnected, the default time of SDK reconnection is 20min.
  • Privacy reminder: Please do not fill in sensitive user information in this interface, including but not limited to mobile phone number, ID number, passport number, real name, etc.
  • Related callbacks: 1. When the user starts to log in to the room, the room is successfully logged in, or the room fails to log in, the [onRoomStateChanged] (Not supported before 2.18.0, please use [onRoomStateUpdate]) callback will be triggered to notify the developer of the status of the current user connected to the room. 2. Different users who log in to the same room can get room related notifications in the same room (eg [onRoomUserUpdate], [onRoomStreamUpdate], etc.), and users in one room cannot receive room signaling notifications in another room. 3. If the network is temporarily interrupted due to network quality reasons, the SDK will automatically reconnect internally. You can get the current connection status of the local room by listening to the [onRoomStateChanged] (Not supported before 2.18.0, please use [onRoomStateUpdate]) callback method, and other users in the same room will receive [onRoomUserUpdate] callback notification. 4. Messages sent in one room (e.g. [setStreamExtraInfo], [sendBroadcastMessage], [sendBarrageMessage], [sendCustomCommand], etc.) cannot be received callback ((eg [onRoomStreamExtraInfoUpdate], [onIMRecvBroadcastMessage], [onIMRecvBarrageMessage], [onIMRecvCustomCommand], etc) in other rooms. Currently, SDK does not provide the ability to send messages across rooms. Developers can integrate the SDK of third-party IM to achieve.
  • Related APIs: 1. Users can call [logoutRoom] to log out. In the case that a user has successfully logged in and has not logged out, if the login interface is called again, the console will report an error and print the error code 1002001. 2. SDK supports multi-room login, please call [setRoomMode] function to select multi-room mode before engine initialization, and then call [loginRoom] to log in to multi-room. 3. Calling [destroyEngine] will also automatically log out.

loginRoom:user:config:callback:

loginRoom:user:config:callback:
- (void)loginRoom:(NSString *) roomID user:(ZegoUser *) user config:(ZegoRoomConfig *) config callback:(ZegoRoomLoginCallback) callback;
Log 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.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
roomIDNSString *Room ID, a string of less 128 bytes in length.
Caution:
1. room ID is defined by yourself.
2. Only support numbers, English characters and '~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', '=', '-', '`', ';', '’', ',', '.', '<', '>', ''.
3. If you need to communicate with the Web SDK, please do not use '%'.
userZegoUser *User object instance, configure userID, userName. Note that the userID needs to be globally unique with the same appID, otherwise the user who logs in later will kick out the user who logged in first.
configZegoRoomConfig *Advanced room configuration.
callbackZegoRoomLoginCallbackThe callback of this login result, if you need detailed room status, please pay attention to the [onRoomStateChanged] callback. Required: No. Default value: nil.Caution: If the connection is retried multiple times due to network problems, the retry status will not be thrown by this callback.

Details

If the room does not exist, [loginRoom] creates and logs in the room. SDK uses the 'room' to organize users. After users log in to a room, they can use interface such as push stream [startPublishingStream], pull stream [startPlayingStream], send and receive broadcast messages [sendBroadcastMessage], etc. To prevent the app from being impersonated by a malicious user, you can add authentication before logging in to the room, that is, the [token] parameter in the ZegoRoomConfig object passed in by the [config] parameter.

  • Use cases: In the same room, users can conduct live broadcast, audio and video calls, etc.
  • When to call /Trigger: This interface is called after [createEngine] initializes the SDK.
  • Caution: 1. Apps that use different appIDs cannot intercommunication with each other. 2. SDK supports startPlayingStream audio and video streams from different rooms under the same appID, that is, startPlayingStream audio and video streams across rooms. Since ZegoExpressEngine's room related callback notifications are based on the same room, when developers want to startPlayingStream streams across rooms, developers need to maintain related messages and signaling notifications by themselves. 3. It is strongly recommended that userID corresponds to the user ID of the business APP, that is, a userID and a real user are fixed and unique, and should not be passed to the SDK in a random userID. Because the unique and fixed userID allows ZEGO technicians to quickly locate online problems. 4. After the first login failure due to network reasons or the room is disconnected, the default time of SDK reconnection is 20min.
  • Privacy reminder: Please do not fill in sensitive user information in this interface, including but not limited to mobile phone number, ID number, passport number, real name, etc.
  • Related callbacks: 1. When the user starts to log in to the room, the room is successfully logged in, or the room fails to log in, the [onRoomStateChanged] (Not supported before 2.18.0, please use [onRoomStateUpdate]) callback will be triggered to notify the developer of the status of the current user connected to the room. 2. Different users who log in to the same room can get room related notifications in the same room (eg [onRoomUserUpdate], [onRoomStreamUpdate], etc.), and users in one room cannot receive room signaling notifications in another room. 3. If the network is temporarily interrupted due to network quality reasons, the SDK will automatically reconnect internally. You can get the current connection status of the local room by listening to the [onRoomStateChanged] (Not supported before 2.18.0, please use [onRoomStateUpdate]) callback method, and other users in the same room will receive [onRoomUserUpdate] callback notification. 4. Messages sent in one room (e.g. [setStreamExtraInfo], [sendBroadcastMessage], [sendBarrageMessage], [sendCustomCommand], etc.) cannot be received callback ((eg [onRoomStreamExtraInfoUpdate], [onIMRecvBroadcastMessage], [onIMRecvBarrageMessage], [onIMRecvCustomCommand], etc) in other rooms. Currently, SDK does not provide the ability to send messages across rooms. Developers can integrate the SDK of third-party IM to achieve.
  • Related APIs: 1. Users can call [logoutRoom] to log out. In the case that a user has successfully logged in and has not logged out, if the login interface is called again, the console will report an error and print the error code 1002001. 2. SDK supports multi-room login, please call [setRoomMode] function to select multi-room mode before engine initialization, and then call [loginRoom] to log in to multi-room. 3. Calling [destroyEngine] will also automatically log out.

logoutRoom

logoutRoom
- (void)logoutRoom;
Exit the room.
Declared in ZegoExpressEngine.h

This API will log out the current user has logged in the room, if user logs in more than one room, all the rooms will be logged out.

  • Use cases: In the same room, users can conduct live broadcast, audio and video calls, etc.
  • When to call /Trigger: After successfully logging in to the room, if the room is no longer used, the user can call the function [logoutRoom].
  • Caution: 1. Exiting the room will stop all publishing and playing streams for user, and inner audio and video engine will stop, and then SDK will auto stop local preview UI. If you want to keep the preview ability when switching rooms, please use the [switchRoom] method. 2. If the user is not logged in to the room, calling this function will also return success.
  • Related callbacks: After calling this function, you will receive [onRoomStateChanged] (Not supported before 2.18.0, please use [onRoomStateUpdate]) callback notification successfully exits the room, while other users in the same room will receive the [onRoomUserUpdate] callback notification(On the premise of enabling isUserStatusNotify configuration).
  • Related APIs: Users can use [loginRoom], [switchRoom] functions to log in or switch rooms.
  • Available since: 2.9.0
  • Restrictions: None.

logoutRoomWithCallback:

logoutRoomWithCallback:
- (void)logoutRoomWithCallback:(ZegoRoomLogoutCallback) callback;
Exit the room with callback.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
callbackZegoRoomLogoutCallbackThe callback of this logout room result, if you need detailed room status, please pay attention to the [onRoomStateChanged] callback. Required: No. Default value: nil.

Details

This API will log out the current user has logged in the room, if user logs in more than one room, all the rooms will be logged out.

  • Use cases: In the same room, users can conduct live broadcast, audio and video calls, etc.
  • When to call /Trigger: After successfully logging in to the room, if the room is no longer used, the user can call the function [logoutRoom].
  • Caution: 1. Exiting the room will stop all publishing and playing streams for user, and inner audio and video engine will stop, and then SDK will auto stop local preview UI. If you want to keep the preview ability when switching rooms, please use the [switchRoom] method. 2. If the user is not logged in to the room, calling this function will also return success.
  • Related callbacks: After calling this function, you will receive [onRoomStateChanged] (Not supported before 2.18.0, please use [onRoomStateUpdate]) callback notification successfully exits the room, while other users in the same room will receive the [onRoomUserUpdate] callback notification(On the premise of enabling isUserStatusNotify configuration).
  • Related APIs: Users can use [loginRoom], [switchRoom] functions to log in or switch rooms.
  • Available since: 2.9.0
  • Restrictions: None.

logoutRoom:

logoutRoom:
- (void)logoutRoom:(NSString *) roomID;
Exit the room of the specified room ID.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
roomIDNSString *Room ID, a string of up to 128 bytes in length.
Caution:
1. Only support numbers, English characters and '~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', '=', '-', '`', ';', '’', ',', '.', '<', '>', ''.
2. If you need to communicate with the Web SDK, please do not use '%'.

Details

This API will log out the room named roomID.

  • Use cases: In the same room, users can conduct live broadcast, audio and video calls, etc.
  • When to call /Trigger: After successfully logging in to the room, if the room is no longer used, the user can call the function [logoutRoom].
  • Caution: 1. Exiting the room will stop all publishing and playing streams for user, and inner audio and video engine will stop, and then SDK will auto stop local preview UI. If you want to keep the preview ability when switching rooms, please use the [switchRoom] method. 2. If the user logs out to the room, but the incoming 'roomID' is different from the logged-in room name, SDK will return failure.
  • Related callbacks: After calling this function, you will receive [onRoomStateChanged] (Not supported before 2.18.0, please use [onRoomStateUpdate]) callback notification successfully exits the room, while other users in the same room will receive the [onRoomUserUpdate] callback notification(On the premise of enabling isUserStatusNotify configuration).
  • Related APIs: Users can use [loginRoom], [switchRoom] functions to log in or switch rooms.
  • Available since: 1.1.0
  • Restrictions: None.

logoutRoomWithCallback:callback:

logoutRoomWithCallback:callback:
- (void)logoutRoomWithCallback:(NSString *) roomID callback:(ZegoRoomLogoutCallback) callback;
Exit the room of the specified room ID with callback.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
roomIDNSString *Room ID, a string of up to 128 bytes in length.
Caution:
1. Only support numbers, English characters and '~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', '=', '-', '`', ';', '’', ',', '.', '<', '>', ''.
2. If you need to communicate with the Web SDK, please do not use '%'.
callbackZegoRoomLogoutCallbackThe callback of this logout room result, if you need detailed room status, please pay attention to the [onRoomStateChanged] callback. Required: No. Default value: nil.

Details

This API will log out the room named roomID.

  • Use cases: In the same room, users can conduct live broadcast, audio and video calls, etc.
  • When to call /Trigger: After successfully logging in to the room, if the room is no longer used, the user can call the function [logoutRoom].
  • Caution: 1. Exiting the room will stop all publishing and playing streams for user, and inner audio and video engine will stop, and then SDK will auto stop local preview UI. If you want to keep the preview ability when switching rooms, please use the [switchRoom] method. 2. If the user logs out to the room, but the incoming 'roomID' is different from the logged-in room name, SDK will return failure.
  • Related callbacks: After calling this function, you will receive [onRoomStateChanged] (Not supported before 2.18.0, please use [onRoomStateUpdate]) callback notification successfully exits the room, while other users in the same room will receive the [onRoomUserUpdate] callback notification(On the premise of enabling isUserStatusNotify configuration).
  • Related APIs: Users can use [loginRoom], [switchRoom] functions to log in or switch rooms.
  • Available since: 1.1.0
  • Restrictions: None.

switchRoom:toRoomID:

switchRoom:toRoomID:
- (void)switchRoom:(NSString *) fromRoomID toRoomID:(NSString *) toRoomID;
Switch the room.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
fromRoomIDNSString *Current roomID.
toRoomIDNSString *The next roomID.

Details

Using this interface allows users to quickly switch from one room to another room.

  • Use cases: If you need to quickly switch to the next room, you can call this function.
  • When to call /Trigger: After successfully login room.
  • Caution: 1. When this function is called, all streams currently publishing or playing will stop (but the local preview will not stop). 2. Multi-room mode is supported in version 3.5.0 (use the function [setRoomMode] to set ZegoRoomMode to ZEGO_ROOM_MODE_MULTI_ROOM). 3. If a Token is passed in for login when logging into the room [loginRoom], the [switchroom] interface must be used with the config parameter and the corresponding Token value passed in when switching rooms.
  • Privacy reminder: Please do not fill in sensitive user information in this interface, including but not limited to mobile phone number, ID number, passport number, real name, etc.
  • Related callbacks: When the user call the [switchRoom] function, the [onRoomStateChanged] (Not supported before 2.18.0, please use [onRoomStateUpdate]) callback will be triggered to notify the developer of the status of the current user connected to the room.
  • Related APIs: Users can use the [logoutRoom] function to log out of the room.
  • Available since: 1.14.0
  • Restrictions: None.

switchRoom:toRoomID:config:

switchRoom:toRoomID:config:
- (void)switchRoom:(NSString *) fromRoomID toRoomID:(NSString *) toRoomID config:(ZegoRoomConfig *) config;
Switch the room with advanced room configurations.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
fromRoomIDNSString *Current roomID.
toRoomIDNSString *The next roomID.
configZegoRoomConfig *Advanced room configuration.

Details

Using this interface allows users to quickly switch from one room to another room.

  • Use cases: if you need to quickly switch to the next room, you can call this function.
  • When to call /Trigger: After successfully login room.
  • Caution: 1. When this function is called, all streams currently publishing or playing will stop (but the local preview will not stop). 2. To prevent the app from being impersonated by a malicious user, you can add authentication before logging in to the room, that is, the [token] parameter in the ZegoRoomConfig object passed in by the [config] parameter. This parameter configuration affects the room to be switched over. 3. Multi-room mode is supported in version 3.5.0 (use the function [setRoomMode] to set ZegoRoomMode to ZEGO_ROOM_MODE_MULTI_ROOM). 4. If a Token is passed in for login when logging into the room [loginRoom], the [switchroom] interface must be used with the config parameter and the corresponding Token value passed in when switching rooms.
  • Privacy reminder: Please do not fill in sensitive user information in this interface, including but not limited to mobile phone number, ID number, passport number, real name, etc.
  • Related callbacks: When the user call the [switchRoom] function, the [onRoomStateChanged] (Not supported before 2.18.0, please use [onRoomStateUpdate]) callback will be triggered to notify the developer of the status of the current user connected to the room.
  • Related APIs: Users can use the [logoutRoom] function to log out of the room.
  • Available since: 1.15.0
  • Restrictions: None.

renewToken:roomID:

renewToken:roomID:
- (void)renewToken:(NSString *) token roomID:(NSString *) roomID;
Renew token.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
tokenNSString *The token that needs to be renew.
roomIDNSString *Room ID.

Details

After the developer receives [onRoomTokenWillExpire], they can use this API to update the token to ensure that the subsequent RTC functions are normal.

  • Use cases: Used when the token is about to expire.
  • When to call /Trigger: After the developer receives [onRoomTokenWillExpire].
  • Caution: The token contains important information such as the user's room permissions, publish stream permissions, and effective time, please refer to https://docs.zegocloud.com/article/11649.
  • Related callbacks: None.
  • Related APIs: None.
  • Available since: 2.8.0
  • Restrictions: None.

setRoomExtraInfo:forKey:roomID:callback:

setRoomExtraInfo:forKey:roomID:callback:
- (void)setRoomExtraInfo:(NSString *) value key:(NSString *) forKey roomID:(NSString *) roomID callback:(nullable ZegoRoomSetRoomExtraInfoCallback) callback;
Set room extra information.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
valueNSString *value if the extra info.
keyNSString *key of the extra info.
roomIDNSString *Room ID.
callbacknullable ZegoRoomSetRoomExtraInfoCallbackCallback for setting room extra information.

Details

The user can call this function to set the extra info of the room.

  • Use cases: You can set some room-related business attributes, such as whether someone is Co-hosting.
  • When to call /Trigger: After logging in the room successful.
  • Caution: For key and value restrictions, please refer to Restrictions. Newly set values ​​will overwrite old ones.
  • Related callbacks: Other users in the same room will be notified through the [onRoomExtraInfoUpdate] callback function.
  • Related APIs: None.

getRoomStreamList:streamListType:

getRoomStreamList:streamListType:
- (ZegoRoomStreamList *)getRoomStreamList:(NSString *) roomID streamListType:(ZegoRoomStreamListType) streamListType;
Get room stream list.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
roomIDNSString *Room ID.
streamListTypeZegoRoomStreamListTypeGet type

Details

Get room stream list.

  • Use cases: Get room stream list.
  • When to call /Trigger: After logging in the room successful.
  • Caution: This interface is to get a real-time internal stream list, which may be inaccurate when the room is disconnected from the service. Do not call this interface with high frequency.
  • Related APIs: None.
  • Available since: 3.12.0

Return

return stream list

startPublishingStream:

startPublishingStream:
- (void)startPublishingStream:(NSString *) streamID;
Start publishing a stream.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
streamIDNSString *Stream ID, a string of up to 256 characters.
Caution:
1. Stream ID is defined by you.
2. 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.
3. Only support numbers, English characters and '-', '_'.

Details

Users push their local audio and video streams to the ZEGO RTC server or CDN, and other users in the same room can pull the audio and video streams to watch through the streamID or CDN pull stream address.

  • Use cases: It can be used to publish streams in real-time connecting wheat, live broadcast and other scenarios.
  • When to call: After [loginRoom].
  • Caution: 1. Before start to publish the stream, the user can choose to call [setVideoConfig] to set the relevant video parameters, and call [startPreview] to preview the video. 2. Other users in the same room can get the streamID by monitoring the [onRoomStreamUpdate] event callback after the local user publishing stream successfully. 3. In the case of poor network quality, user publish may be interrupted, and the SDK will attempt to reconnect. You can learn about the current state and error information of the stream published by monitoring the [onPublisherStateUpdate] event.
  • Available since: 1.1.0
  • Restrictions: None.

startPublishingStream:channel:

startPublishingStream:channel:
- (void)startPublishingStream:(NSString *) streamID channel:(ZegoPublishChannel) channel;
Starts publishing a stream (for the specified channel). You can call this function to publish a second stream.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
streamIDNSString *Stream ID, a string of up to 256 characters.
Caution:
1. Stream ID is defined by you.
2. 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.
3. Only support numbers, English characters and '-', '_'.
channelZegoPublishChannelPublish stream channel.

Details

Users push their local audio and video streams to the ZEGO RTC server or CDN, and other users in the same room can pull the audio and video streams to watch through the streamID or CDN pull stream address.

  • Use cases: It can be used to publish streams in real-time connecting wheat, live broadcast and other scenarios.
  • When to call: After [loginRoom].
  • Caution: 1. Before start to publish the stream, the user can choose to call [setVideoConfig] to set the relevant video parameters, and call [startPreview] to preview the video. 2. Other users in the same room can get the streamID by monitoring the [onRoomStreamUpdate] event callback after the local user publishing stream successfully. 3. In the case of poor network quality, user publish may be interrupted, and the SDK will attempt to reconnect. You can learn about the current state and error information of the stream published by monitoring the [onPublisherStateUpdate] event.
  • Available since: 1.1.0
  • Restrictions: None.

startPublishingStream:config:channel:

startPublishingStream:config:channel:
- (void)startPublishingStream:(NSString *) streamID config:(ZegoPublisherConfig *) config channel:(ZegoPublishChannel) channel;
Starts publishing a stream. Support multi-room mode.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
streamIDNSString *Stream ID, a string of up to 256 characters.
Caution:
1. Stream ID is defined by you.
2. 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.
3. Only support numbers, English characters and '-', '_'.
configZegoPublisherConfig *Advanced publish configuration.
channelZegoPublishChannelPublish stream channel.

Details

Users push their local audio and video streams to the ZEGO RTC server or CDN, and other users in the same room can pull the audio and video streams to watch through the streamID or CDN pull stream address.

  • Use cases: It can be used to publish streams in real-time connecting wheat, live broadcast and other scenarios.
  • When to call: After [loginRoom].
  • Caution: 1. Before start to publish the stream, the user can choose to call [setVideoConfig] to set the relevant video parameters, and call [startPreview] to preview the video. 2. Other users in the same room can get the streamID by monitoring the [onRoomStreamUpdate] event callback after the local user publishing stream successfully. 3. In the case of poor network quality, user publish may be interrupted, and the SDK will attempt to reconnect. You can learn about the current state and error information of the stream published by monitoring the [onPublisherStateUpdate] event. 4. To call [SetRoomMode] function to select multiple rooms, the room ID must be specified explicitly.
  • Available since: 1.1.0
  • Restrictions: None.

startPublishingStreamInScene:channel:config:

startPublishingStreamInScene:channel:config:
- (void)startPublishingStreamInScene:(NSString *) streamID channel:(ZegoPublishChannel) channel config:(ZegoScenePublisherConfig *) config;
Starts publishing a stream in RangeScene scene.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
streamIDNSString *Stream ID, a string of up to 256 characters.
Caution:
1. Stream ID is defined by you.
2. 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.
3. Only support numbers, English characters and '-', '_'.
channelZegoPublishChannelPublish stream channel.
configZegoScenePublisherConfig *Advanced scene publish configuration.

Details

Users push their local audio and video streams to the ZEGO RTC server.

  • Use cases: Starts publishing a stream in RangeScene scene.
  • When to call: After [loginScene].
  • Caution: None.
  • Available since: 3.0.0
  • Restrictions: None.

stopPublishingStream

stopPublishingStream
- (void)stopPublishingStream;
Stops publishing a stream.
Declared in ZegoExpressEngine.h

The user stops sending local audio and video streams, and other users in the room will receive a stream deletion notification.

  • Use cases: It can be used to stop publish streams in real-time connecting wheat, live broadcast and other scenarios.
  • When to call: After [startPublishingStream].
  • Caution: 1. After stopping the streaming, other users in the same room can receive the delete notification of the stream by listening to the [onRoomStreamUpdate] callback. 2. If the user has initiated publish flow, this function must be called to stop the publish of the current stream before publishing the new stream (new streamID), otherwise the new stream publish will return a failure. 3. After stopping streaming, the developer should stop the local preview based on whether the business situation requires it.
  • Available since: 1.1.0
  • Restrictions: None.

stopPublishingStream:

stopPublishingStream:
- (void)stopPublishingStream:(ZegoPublishChannel) channel;
Stops publishing a stream (for the specified channel).
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
channelZegoPublishChannelPublish stream channel.

Details

The user stops sending local audio and video streams, and other users in the room will receive a stream deletion notification.

  • Use cases: It can be used to stop publish streams in real-time connecting wheat, live broadcast and other scenarios.
  • When to call: After [startPublishingStream].
  • Caution: 1. After stopping the streaming, other users in the same room can receive the delete notification of the stream by listening to the [onRoomStreamUpdate] callback. 2. If the user has initiated publish flow, this function must be called to stop the publish of the current stream before publishing the new stream (new streamID), otherwise the new stream publish will return a failure. 3. After stopping streaming, the developer should stop the local preview based on whether the business situation requires it.
  • Available since: 1.1.0
  • Restrictions: None.

setStreamExtraInfo:callback:

setStreamExtraInfo:callback:
- (void)setStreamExtraInfo:(NSString *) extraInfo callback:(nullable ZegoPublisherSetStreamExtraInfoCallback) callback;
Sets the extra information of the stream being published.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
extraInfoNSString *Stream extra information, a string of up to 1024 characters.
callbacknullable ZegoPublisherSetStreamExtraInfoCallbackSet stream extra information execution result notification.

Details

Use this function to set the extra info of the stream. The stream extra information is an extra information identifier of the stream ID. Unlike the stream ID, which cannot be modified during the publishing process, the stream extra information can be modified midway through the stream corresponding to the stream ID. Developers can synchronize variable content related to stream IDs based on stream additional information.

  • When to call: After the engine is created [createEngine], Called before and after [startPublishingStream] can both take effect.
  • Caution: Act on the main publish channel ZegoPublishChannel.Main.
  • Related callbacks: Other users in the same room will be notified through the [onRoomStreamExtraInfoUpdate] callback function.
  • Available since: 1.1.0
  • Restrictions: None.

setStreamExtraInfo:channel:callback:

setStreamExtraInfo:channel:callback:
- (void)setStreamExtraInfo:(NSString *) extraInfo channel:(ZegoPublishChannel) channel callback:(nullable ZegoPublisherSetStreamExtraInfoCallback) callback;
Sets the extra information of the stream being published for the specified publish channel.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
extraInfoNSString *Stream extra information, a string of up to 1024 characters.
channelZegoPublishChannelPublish stream channel.
callbacknullable ZegoPublisherSetStreamExtraInfoCallbackSet stream extra information execution result notification.

Details

Use this function to set the extra info of the stream. The stream extra information is an extra information identifier of the stream ID. Unlike the stream ID, which cannot be modified during the publishing process, the stream extra information can be modified midway through the stream corresponding to the stream ID. Developers can synchronize variable content related to stream IDs based on stream additional information.

  • When to call: After the engine is created [createEngine], Called before and after [startPublishingStream] can both take effect.
  • Related callbacks: Users can obtain the execution result of the function through [ZegoPublisherSetStreamExtraInfoCallback] callback.
  • Available since: 1.1.0
  • Restrictions: None.

startPreview:

startPreview:
- (void)startPreview:(ZegoCanvas *) canvas;
Starts/Updates the local video preview.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
canvasZegoCanvas *The view used to display the preview image. If the view is set to nil, no preview will be made.

Details

The user can see his own local image by calling this function.

  • Use cases: It can be used for local preview in real-time connecting wheat, live broadcast and other scenarios.
  • When to call: After [createEngine].
  • Caution: 1. The preview function does not require you to log in to the room or publish the stream first. But after exiting the room, SDK internally actively stops previewing by default. 2. Local view and preview modes can be updated by calling this function again. The user can only preview on one view. If you call [startPreview] again to pass in a new view, the preview screen will only be displayed in the new view. 3. You can set the mirror mode of the preview by calling the [setVideoMirrorMode] function. The default preview setting is image mirrored. 4. When this function is called, the audio and video engine module inside SDK will start really, and it will start to try to collect audio and video.
  • Available since: 1.1.0
  • Restrictions: None.

startPreview:channel:

startPreview:channel:
- (void)startPreview:(ZegoCanvas *) canvas channel:(ZegoPublishChannel) channel;
Starts/Updates the local video preview (for the specified channel).
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
canvasZegoCanvas *The view used to display the preview image. If the view is set to nil, no preview will be made.
channelZegoPublishChannelPublish stream channel

Details

The user can see his own local image by calling this function.

  • Use cases: It can be used for local preview in real-time connecting wheat, live broadcast and other scenarios.
  • When to call: After [createEngine].
  • Caution: 1. The preview function does not require you to log in to the room or publish the stream first. But after exiting the room, SDK internally actively stops previewing by default. 2. Local view and preview modes can be updated by calling this function again. The user can only preview on one view. If you call [startPreview] again to pass in a new view, the preview screen will only be displayed in the new view. 3. You can set the mirror mode of the preview by calling the [setVideoMirrorMode] function. The default preview setting is image mirrored. 4. When this function is called, the audio and video engine module inside SDK will start really, and it will start to try to collect audio and video.
  • Available since: 1.1.0
  • Restrictions: None.

startPreview

startPreview
- (void)startPreview;
Starts the local audio preview.
Declared in ZegoExpressEngine.h

Call this function after creating the engine and before publishing/playing a stream, and then the engine will start to capture audio.

  • Use cases: Can check whether the audio equipment works ok by calling this function and by the soundlevel function of Engine.
  • When to call: After [createEngine].
  • Caution: 1. The preview function does not require you to log in to the room or publish the stream first. But after exiting the room, SDK internally actively stops previewing by default. 2. When this function is called, the audio engine module inside SDK will start, and it will start to try to collect audio.
  • Available since: 1.1.0
  • Restrictions: None.

stopPreview

stopPreview
- (void)stopPreview;
Stops the local preview.
Declared in ZegoExpressEngine.h

This function can be called to stop the preview when the preview is not needed locally.

  • Caution: Stopping the preview will not affect the publish stream and playing stream functions.
  • Available since: 1.1.0

stopPreview:

stopPreview:
- (void)stopPreview:(ZegoPublishChannel) channel;
Stops the local preview (for the specified channel).
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
channelZegoPublishChannelPublish stream channel

Details

This function can be called to stop the preview when the preview is not needed locally.

  • Caution: Stopping the preview will not affect the publish stream and playing stream functions.
  • Available since: 1.1.0

setVideoConfig:

setVideoConfig:
- (void)setVideoConfig:(ZegoVideoConfig *) config;
Sets up the video configurations.
Declared in ZegoExpressEngine.h

Parameters

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

Details

Set the video frame rate, bit rate, video capture resolution, and video encoding output resolution.

  • Use cases: Recommended configuration in different business scenarios https://docs.zegocloud.com/article/12122.
  • Default value: The default video capture resolution is 360p, the video encoding output resolution is 360p, the bit rate is 600 kbps, and the frame rate is 15 fps.
  • When to call: After [createEngine].
  • Caution: Developers should note that the wide and high resolution of the mobile end is opposite to the wide and high resolution of the PC. For example, in the case of 360p, the resolution of the mobile end is 360x640, and the resolution of the PC end is 640x360.
  • Available since: 1.1.0
  • Restrictions: It is necessary to set the relevant video configuration before [startPreview], and only support the modification of the encoding resolution, the bit rate and the frame rate after [startPreview].

setVideoConfig:channel:

setVideoConfig:channel:
- (void)setVideoConfig:(ZegoVideoConfig *) config channel:(ZegoPublishChannel) channel;
Sets up the video configurations (for the specified channel).
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
configZegoVideoConfig *Video configuration, the SDK provides a common setting combination of resolution, frame rate and bit rate, they also can be customized.
channelZegoPublishChannelPublish stream channel.

Details

Set the video frame rate, bit rate, video capture resolution, and video encoding output resolution.

  • Default value: The default video capture resolution is 360p, the video encoding output resolution is 360p, the bit rate is 600 kbps, and the frame rate is 15 fps.
  • When to call: After [createEngine].
  • Caution: Developers should note that the wide and high resolution of the mobile end is opposite to the wide and high resolution of the PC. For example, in the case of 360p, the resolution of the mobile end is 360x640, and the resolution of the PC end is 640x360.
  • Available since: 1.1.0
  • Restrictions: It is necessary to set the relevant video configuration before [startPreview], and only support the modification of the encoding resolution, the bit rate and the frame rate after [startPreview].

getVideoConfig

getVideoConfig
- (ZegoVideoConfig *)getVideoConfig;
Gets the current video configurations.
Declared in ZegoExpressEngine.h

This function can be used to get the main publish channel's current video frame rate, bit rate, video capture resolution, and video encoding output resolution.

Video configuration object

getVideoConfig:

getVideoConfig:
- (ZegoVideoConfig *)getVideoConfig:(ZegoPublishChannel) channel;
Gets the current video configurations (for the specified channel).
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
channelZegoPublishChannelPublish stream channel

Details

This function can be used to get the specified publish channel's current video frame rate, bit rate, video capture resolution, and video encoding output resolution.

Return

Video configuration object

setPublishDualStreamConfig:channel:

setPublishDualStreamConfig:channel:
- (void)setPublishDualStreamConfig:(NSArray<ZegoPublishDualStreamConfig *> *) configList channel:(ZegoPublishChannel) channel;
Set dual stream config.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
configListNSArray<ZegoPublishDualStreamConfig *> *config info.
channelZegoPublishChannelZegoPublishChannel.

Details

Set the stream config.

  • When to call: This must take effect when the codecID specified in the call to [ZegoExpressEngine > setVideoConfig] is ZegoVideoCodecIDH264DualStream after [createEngine] is called.
  • Caution: Width, height, resolution and bitrate are all greater than zero to take effect.
  • Available since: 3.7.0
  • Restrictions: To take effect, the parameters of flow and small flow must be specified at the same time. The resolution ratio of flow and small flow must be the same. For example, both are 4:3 .

setVideoMirrorMode:

setVideoMirrorMode:
- (void)setVideoMirrorMode:(ZegoVideoMirrorMode) mirrorMode;
Sets the video mirroring mode.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
mirrorModeZegoVideoMirrorModeMirror mode for previewing or publishing the stream.

Details

Set whether the local preview video and the published video have mirror mode enabled. For specific mirroring mode, please refer to https://docs.zegocloud.com/article/12122.

  • When to call: After [createEngine].
  • Available since: 1.1.0
  • Restrictions: This setting only works if the SDK is responsible for rendering.

setVideoMirrorMode:channel:

setVideoMirrorMode:channel:
- (void)setVideoMirrorMode:(ZegoVideoMirrorMode) mirrorMode channel:(ZegoPublishChannel) channel;
Sets the video mirroring mode (for the specified channel).
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
mirrorModeZegoVideoMirrorModeMirror mode for previewing or publishing the stream.
channelZegoPublishChannelPublish stream channel.

Details

Set whether the local preview video and the published video have mirror mode enabled. For specific mirroring mode.

  • When to call: After [createEngine].
  • Available since: 1.1.0
  • Restrictions: This setting only works if the SDK is responsible for rendering.

setAppOrientation:

setAppOrientation:
- (void)setAppOrientation:(UIInterfaceOrientation) orientation;
Set the video orientation.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
orientationUIInterfaceOrientationVideo orientation.

Details

Set the video orientation.

  • Use cases: When users use mobile devices to conduct live broadcasts or video calls, they can set different video directions according to the scene.
  • When to call: After [createEngine].
  • Available since: 1.1.0
  • Restrictions: None.

setAppOrientation:channel:

setAppOrientation:channel:
- (void)setAppOrientation:(UIInterfaceOrientation) orientation channel:(ZegoPublishChannel) channel;
Sets the video orientation (for the specified channel).
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
orientationUIInterfaceOrientationVideo orientation.
channelZegoPublishChannelPublish stream channel.

Details

Set the video orientation.

  • Use cases: When users use mobile devices to conduct live broadcasts or video calls, they can set different video directions according to the scene.
  • When to call: After [createEngine].
  • Available since: 1.1.0
  • Restrictions: Currently only supports iOS and Android platforms.

setAudioConfig:

setAudioConfig:
- (void)setAudioConfig:(ZegoAudioConfig *) config;
Sets up the audio configurations.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
configZegoAudioConfig *Audio config.

Details

You can set the combined value of the audio codec, bit rate, and audio channel through this function. If the preset value cannot meet the developer's scenario, the developer can set the parameters according to the business requirements.

  • Default value: The default audio config refers to the default value of [ZegoAudioConfig].
  • When to call: After the engine is created [createEngine], and before publishing [startPublishingStream].
  • Caution: Act on the main publish channel ZegoPublishChannel.Main.
  • Related APIs: [getAudioConfig].
  • Available since: 1.3.4
  • Restrictions: None.

setAudioConfig:channel:

setAudioConfig:channel:
- (void)setAudioConfig:(ZegoAudioConfig *) config channel:(ZegoPublishChannel) channel;
Sets up the audio configurations for the specified publish channel.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
configZegoAudioConfig *Audio config.
channelZegoPublishChannelPublish stream channel.

Details

You can set the combined value of the audio codec, bit rate, and audio channel through this function. If the preset value cannot meet the developer's scenario, the developer can set the parameters according to the business requirements.

  • Default value: The default audio config refers to the default value of [ZegoAudioConfig].
  • When to call: After the engine is created [createEngine], and before publishing [startPublishingStream].
  • Related APIs: [getAudioConfig].
  • Available since: 1.3.4
  • Restrictions: None.

getAudioConfig

getAudioConfig
- (ZegoAudioConfig *)getAudioConfig;
Gets the current audio configurations.
Declared in ZegoExpressEngine.h

You can get the current audio codec, bit rate, and audio channel through this function.

  • When to call: After the engine is created [createEngine].
  • Caution: Act on the main publish channel ZegoPublishChannel.Main.
  • Related APIs: [setAudioConfig].
  • Available since: 1.8.0
  • Restrictions: None.

Audio config.

getAudioConfig:

getAudioConfig:
- (ZegoAudioConfig *)getAudioConfig:(ZegoPublishChannel) channel;
Gets the current audio configurations from the specified publish channel.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
channelZegoPublishChannelPublish stream channel.

Details

You can get the current audio codec, bit rate, and audio channel through this function.

  • When to call: After the engine is created [createEngine].
  • Related APIs: [setAudioConfig].
  • Available since: 1.8.0
  • Restrictions: None.

Return

Audio config.

setPublishStreamEncryptionKey:

setPublishStreamEncryptionKey:
- (void)setPublishStreamEncryptionKey:(NSString *) key;
Set encryption key for the publishing stream.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
keyNSString *The encryption key, note that the key length only supports 16/24/32 bytes.

Details

Support calling this function to update the encryption key while publishing stream.

  • When to call: After the engine is created [createEngine], Called before and after [startPublishingStream] can both take effect.
  • Caution: that developers need to update the player's decryption key before updating the publisher's encryption key. Act on the main publish channel ZegoPublishChannel.Main.
  • Related APIs: Calling [stopPublishingStream] or [logoutRoom] will clear the encryption key.
  • Available since: 1.19.0
  • Restrictions: This function is only valid when publishing stream to the Zego RTC server.

setPublishStreamEncryptionKey:channel:

setPublishStreamEncryptionKey:channel:
- (void)setPublishStreamEncryptionKey:(NSString *) key channel:(ZegoPublishChannel) channel;
Set encryption key for the publishing stream for the specified publish channel.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
keyNSString *The encryption key, note that the key length only supports 16/24/32 bytes.
channelZegoPublishChannelPublish stream channel.

Details

Support calling this function to update the encryption key while publishing stream.

  • When to call: After the engine is created [createEngine], Called before and after [startPublishingStream] can both take effect.
  • Caution: that developers need to update the player's decryption key before updating the publisher's encryption key.
  • Related APIs: Calling [stopPublishingStream] or [logoutRoom] will clear the encryption key.
  • Available since: 1.19.0
  • Restrictions: This function is only valid when publishing stream to the Zego RTC server.

takePublishStreamSnapshot:

takePublishStreamSnapshot:
- (void)takePublishStreamSnapshot:(ZegoPublisherTakeSnapshotCallback) callback;
Take a snapshot of the publishing stream.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
callbackZegoPublisherTakeSnapshotCallbackResults of take publish stream snapshot.

Details

Take a snapshot of the publishing stream.

  • When to call: Called this function after calling [startPublishingStream] or [startPreview].
  • Caution: The resolution of the snapshot is the encoding resolution set in [setVideoConfig]. If you need to change it to capture resolution, please call [setCapturePipelineScaleMode] to change the capture pipeline scale mode to [Post]. Act on the main publish channel ZegoPublishChannel.Main.
  • Related callbacks: The screenshot result will be called back through [ZegoPublisherTakeSnapshotCallback] (Windows HBITMAP; macOS/iOS CGImageRef; Linux QImage; Android Bitmap).
  • Related APIs: [takePlayStreamSnapshot].
  • Available since: 1.17.0
  • Restrictions: None.

takePublishStreamSnapshot:channel:

takePublishStreamSnapshot:channel:
- (void)takePublishStreamSnapshot:(ZegoPublisherTakeSnapshotCallback) callback channel:(ZegoPublishChannel) channel;
Take a snapshot of the publishing stream for the specified publish channel.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
callbackZegoPublisherTakeSnapshotCallbackResults of take publish stream snapshot.
channelZegoPublishChannelPublish stream channel.

Details

Take a snapshot of the publishing stream.

  • When to call: Called this function after calling [startPublishingStream] or [startPreview].
  • Caution: The resolution of the snapshot is the encoding resolution set in [setVideoConfig]. If you need to change it to capture resolution, please call [setCapturePipelineScaleMode] to change the capture pipeline scale mode to [Post].
  • Related callbacks: The screenshot result will be called back through [ZegoPublisherTakeSnapshotCallback].
  • Related APIs: [takePlayStreamSnapshot].
  • Available since: 1.17.0
  • Restrictions: None.

takePublishStreamSnapshotByConfig:callback:channel:

takePublishStreamSnapshotByConfig:callback:channel:
- (void)takePublishStreamSnapshotByConfig:(ZegoPublisherTakeSnapshotConfig *) config callback:(ZegoPublisherTakeSnapshotCallback) callback channel:(ZegoPublishChannel) channel;
Take a snapshot of the publishing stream for the specified publish channel.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
configZegoPublisherTakeSnapshotConfig *The config of snapshot
callbackZegoPublisherTakeSnapshotCallbackResults of take publish stream snapshot.
channelZegoPublishChannelPublish stream channel.

Details

Take a snapshot of the publishing stream.

  • When to call: Called this function after calling [startPublishingStream] or [startPreview].
  • Caution: The resolution of the snapshot is the encoding resolution set in [setVideoConfig]. If you need to change it to capture resolution, please call [setCapturePipelineScaleMode] to change the capture pipeline scale mode to [Post].
  • Related callbacks: The screenshot result will be called back through [ZegoPublisherTakeSnapshotCallback].
  • Related APIs: [takePlayStreamSnapshot].
  • Available since: 3.22.0
  • Restrictions: None.

mutePublishStreamAudio:

mutePublishStreamAudio:
- (void)mutePublishStreamAudio:(BOOL) mute;
Stops or resumes sending the audio part of a stream.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
muteBOOLWhether to stop sending audio streams, true means not to send audio stream, and false means sending audio stream. The default is false.

Details

This function can be called when publishing the stream to realize not publishing the audio data stream. The SDK still collects and processes the audio, but send muted audio frame packets to the network. Use case: Users can call this interface when they do not want to publish any audio data. This interface does not affect [onBeforeAudioPrepAudioData].

  • When to call: Called after the engine is created [createEngine] can take effect.
  • Caution: Act on the main publish channel ZegoPublishChannel.Main.
  • Related callbacks: If you stop sending audio streams, the remote user that play stream of local user publishing stream can receive Mute status change notification by monitoring [onRemoteMicStateUpdate] callbacks.
  • Related APIs: [mutePublishStreamVideo].
  • Available since: 1.1.0
  • Restrictions: None.

mutePublishStreamAudio:channel:

mutePublishStreamAudio:channel:
- (void)mutePublishStreamAudio:(BOOL) mute channel:(ZegoPublishChannel) channel;
Stops or resumes sending the audio part of a stream for the specified channel.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
muteBOOLWhether to stop sending audio streams, true means not to send audio stream, and false means sending audio stream. The default is false.
channelZegoPublishChannelPublish stream channel.

Details

This function can be called when publishing the stream to realize not publishing the audio data stream. The SDK still collects and processes the audio, but send muted audio frame packets to the network. Use case: Users can call this interface when they do not want to publish any audio data. This interface does not affect [onBeforeAudioPrepAudioData].

  • When to call: Called after the engine is created [createEngine] can take effect.
  • Related callbacks: If you stop sending audio streams, the remote user that play stream of local user publishing stream can receive Mute status change notification by monitoring [onRemoteMicStateUpdate] callbacks.
  • Related APIs: [mutePublishStreamVideo].
  • Available since: 1.1.0
  • Restrictions: None.

mutePublishStreamVideo:

mutePublishStreamVideo:
- (void)mutePublishStreamVideo:(BOOL) mute;
Stops or resumes sending the video part of a stream.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
muteBOOLWhether to stop sending video streams, true means not to send video stream, and false means sending video stream. The default is false.

Details

This function can be called when publishing the stream to realize not publishing the video stream. The local camera can still work normally, can capture, preview and process video images normally, but does not send the video data to the network.

  • When to call: Called after the engine is created [createEngine] can take effect.
  • Caution: Act on the main publish channel ZegoPublishChannel.Main.
  • Related callbacks: If you stop sending video streams locally, the remote user that play stream of local user publishing stream can receive Mute status change notification by monitoring [onRemoteCameraStateUpdate] callbacks.
  • Related APIs: [mutePublishStreamAudio].
  • Available since: 1.1.0
  • Restrictions: None.

mutePublishStreamVideo:channel:

mutePublishStreamVideo:channel:
- (void)mutePublishStreamVideo:(BOOL) mute channel:(ZegoPublishChannel) channel;
Stops or resumes sending the video part of a stream for the specified channel.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
muteBOOLWhether to stop sending video streams, true means not to send video stream, and false means sending video stream. The default is false.
channelZegoPublishChannelPublish stream channel.

Details

This function can be called when publishing the stream to realize not publishing the video stream. The local camera can still work normally, can capture, preview and process video images normally, but does not send the video data to the network.

  • When to call: Called after the engine is created [createEngine] can take effect.
  • Related callbacks: If you stop sending video streams locally, the remote user that play stream of local user publishing stream can receive Mute status change notification by monitoring [onRemoteCameraStateUpdate] callbacks.
  • Related APIs: [mutePublishStreamAudio].
  • Available since: 1.1.0
  • Restrictions: None.

setStreamAlignmentProperty:channel:

setStreamAlignmentProperty:channel:
- (void)setStreamAlignmentProperty:(int) alignment channel:(ZegoPublishChannel) channel;
Enable or disable the stream precision alignment function.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
alignmentintWhether to enable the stream mixing precision alignment function.
channelZegoPublishChannelPublish stream channel

Details

Use this interface to enable stream alignment, the SDK will attach network time information to the stream when publishing it for accurate stream alignment. Use case: Generally used in scenarios such as KTV where stream mixing alignment is required.

  • When to call: After the engine is created [createEngine].
  • Caution: If you need to align each stream through network time when playing multiple streams or mixed streams, you need to call [startPublishingStream] to publish the stream and [forceSynchronousNetworkTime] in [ZegoPublisherConfig] is 1 to enable network time synchronization.
  • Related APIs: [startMixerTask], [startAutoMixerTask]
  • Available since: 2.11.0.

enableTrafficControl:property:

enableTrafficControl:property:
- (void)enableTrafficControl:(BOOL) enable property:(ZegoTrafficControlProperty) property;
Enables or disables traffic control.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
enableBOOLWhether to enable traffic control. The default is ture.
propertyZegoTrafficControlPropertyAdjustable property of traffic control, bitmask OR format. Should be one or the combinations of [ZegoTrafficControlProperty] enumeration. [AdaptiveFPS] as default.

Details

Enabling traffic control allows the SDK to adjust the audio and video streaming bitrate according to the current upstream network environment conditions, or according to the counterpart's downstream network environment conditions in a one-to-one interactive scenario, to ensure smooth results. At the same time, you can further specify the attributes of traffic control to adjust the corresponding control strategy.

  • Default value: Enable.
  • When to call: After the engine is created [createEngine], Called before [startPublishingStream] can take effect.
  • Caution: Act on the main publish channel ZegoPublishChannel.Main.
  • Available since: 1.5.0
  • Restrictions: Only support RTC publish.

enableTrafficControl:property:channel:

enableTrafficControl:property:channel:
- (void)enableTrafficControl:(BOOL) enable property:(ZegoTrafficControlProperty) property channel:(ZegoPublishChannel) channel;
Enables or disables the traffic control for the specified publish channel.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
enableBOOLWhether to enable traffic control. The default is ture.
propertyZegoTrafficControlPropertyAdjustable property of traffic control, bitmask format. Should be one or the combinations of [ZegoTrafficControlProperty] enumeration. [AdaptiveFPS] as default.
channelZegoPublishChannelPublish stream channel.

Details

Enabling traffic control allows the SDK to adjust the audio and video streaming bitrate according to the current upstream network environment conditions, or according to the counterpart's downstream network environment conditions in a one-to-one interactive scenario, to ensure smooth results. At the same time, you can further specify the attributes of traffic control to adjust the corresponding control strategy.

  • Default value: Enable.
  • When to call: After the engine is created [createEngine], Called before [startPublishingStream] can take effect.
  • Available since: 1.5.0
  • Restrictions: Only support RTC publish.

setMinVideoBitrateForTrafficControl:mode:

setMinVideoBitrateForTrafficControl:mode:
- (void)setMinVideoBitrateForTrafficControl:(int) bitrate mode:(ZegoTrafficControlMinVideoBitrateMode) mode;
Set the minimum video bitrate threshold for traffic control.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
bitrateintMinimum video bitrate threshold for traffic control(kbps).
modeZegoTrafficControlMinVideoBitrateModeVideo sending mode below the minimum bitrate.

Details

Set the control strategy when the video bitrate reaches the lowest threshold during flow control. When the bitrate is lower than the minimum threshold, you can choose not to send video data or send it at a very low frame bitrate.

  • Default value: There is no control effect of the lowest threshold of video bitrate.
  • When to call: After the engine is created [createEngine], Called before [startPublishingStream] can take effect.
  • Caution: Act on the main publish channel ZegoPublishChannel.Main.
  • Related APIs: [enableTrafficControl].
  • Available since: 1.1.0
  • Restrictions: The traffic control must be turned on [enableTrafficControl].

setMinVideoBitrateForTrafficControl:mode:channel:

setMinVideoBitrateForTrafficControl:mode:channel:
- (void)setMinVideoBitrateForTrafficControl:(int) bitrate mode:(ZegoTrafficControlMinVideoBitrateMode) mode channel:(ZegoPublishChannel) channel;
Sets the minimum video bitrate for traffic control for the specified publish channel.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
bitrateintMinimum video bitrate (kbps).
modeZegoTrafficControlMinVideoBitrateModeVideo sending mode below the minimum bitrate.
channelZegoPublishChannelPublish stream channel.

Details

Set the control strategy when the video bitrate reaches the lowest threshold during flow control. When the bitrate is lower than the minimum threshold, you can choose not to send video data or send it at a very low frame bitrate.

  • Default value: There is no control effect of the lowest threshold of video bitrate.
  • When to call: After the engine is created [createEngine], Called before [startPublishingStream] can take effect.
  • Related APIs: [enableTrafficControl].
  • Available since: 1.1.0
  • Restrictions: The traffic control must be turned on [enableTrafficControl].

setMinVideoFpsForTrafficControl:channel:

setMinVideoFpsForTrafficControl:channel:
- (void)setMinVideoFpsForTrafficControl:(int) fps channel:(ZegoPublishChannel) channel;
Sets the minimum video frame rate threshold for traffic control.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
fpsintThe minimum video frame rate threshold for traffic control(fps).
channelZegoPublishChannelPublish stream channel.

Details

When enabling traffic control [enableTrafficControl], and its parameter [property] includes the attribute AdaptiveFPS, the minimum frame rate of the video will not be lower than the value set by the [setMinVideoFpsForTrafficControl] interface. A value of 0 indicates no limit.

  • Default value: There is no control effect of the lowest threshold of video frame rate.
  • When to call: The call takes effect after the engine [createEngine] is created.
  • Related APIs: [enableTrafficControl].
  • Caution: If you need to cancel the limit of the setting value, you can set it to 0.
  • Available since: 2.17.0
  • Restrictions: The traffic control must be turned on [enableTrafficControl]. And its parameter [property] must contain AdaptiveFPS, Please refer to [ZegoTrafficControlProperty] for details.

setMinVideoResolutionForTrafficControl:height:channel:

setMinVideoResolutionForTrafficControl:height:channel:
- (void)setMinVideoResolutionForTrafficControl:(int) width height:(int) height channel:(ZegoPublishChannel) channel;
Sets the minimum video resolution threshold for traffic control.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
widthintThe flow controls the width of the lowest video resolution.
heightintThe flow controls the height of the lowest video resolution.
channelZegoPublishChannelPublish stream channel.

Details

When enabling traffic control [enableTrafficControl], and its parameter [property] includes the attribute AdaptiveResolution, the minimum resolution of the video will not be lower than the value set by the [setMinVideoResolutionForTrafficControl] interface. A value of 0 indicates no limit.

  • Default value: There is no control effect of the lowest threshold of video resolution.
  • When to call: The call takes effect after the engine [createEngine] is created.
  • Related APIs: [enableTrafficControl].
  • Caution: If you need to cancel the limit of the setting value, you can set width and height to 0.
  • Available since: 2.17.0
  • Restrictions: The traffic control must be turned on [enableTrafficControl]. And its parameter [property] must contain AdaptiveResolution, Please refer to [ZegoTrafficControlProperty] for details.

setTrafficControlFocusOn:

setTrafficControlFocusOn:
- (void)setTrafficControlFocusOn:(ZegoTrafficControlFocusOnMode) mode;
Set the factors of concern that trigger traffic control.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
modeZegoTrafficControlFocusOnModeWhen LOCAL_ONLY is selected, only the local network status is concerned. When choosing REMOTE, also take into account the remote network.

Details

Use this interface to control whether to start traffic control due to poor remote network conditions.

  • Default value: Default is ZegoTrafficControlFounsOnRemote.
  • When to call: After the engine is created [createEngine], Called before [startPublishingStream] can take effect.
  • Related APIs: [enableTrafficControl.
  • Available since: 2.4.0
  • Restrictions: The traffic control must be turned on [enableTrafficControl].

setTrafficControlFocusOn:channel:

setTrafficControlFocusOn:channel:
- (void)setTrafficControlFocusOn:(ZegoTrafficControlFocusOnMode) mode channel:(ZegoPublishChannel) channel;
Set the factors of concern that trigger traffic control for the specified publish channel.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
modeZegoTrafficControlFocusOnModeWhen LOCAL_ONLY is selected, only the local network status is concerned. When choosing REMOTE, also take into account the remote network.
channelZegoPublishChannelPublish stream channel.

Details

Use this interface to control whether to start traffic control due to poor remote network conditions.

  • Default value: Default is disable.
  • When to call: After the engine is created [createEngine], Called before [startPublishingStream] can take effect.
  • Related APIs: [enableTrafficControl.
  • Available since: 2.4.0
  • Restrictions: The traffic control must be turned on [enableTrafficControl].

setCaptureVolume:

setCaptureVolume:
- (void)setCaptureVolume:(int) volume;
Sets the audio recording volume for stream publishing.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
volumeintThe volume gain percentage, the range is 0 ~ 200, and the default value is 100, which means 100% of the original collection volume of the device.

Details

This function is used to perform gain processing based on the device's collected volume. The local user can control the sound level of the audio stream sent to the remote end.

  • Default value: Default is 100.
  • When to call: After creating the engine [createEngine].
  • Related APIs: Set the playing stream volume [setPlayVolume].
  • Available since: 1.13.0
  • Restrictions: The capture volume can be dynamically set during publishing.

setAudioCaptureStereoMode:

setAudioCaptureStereoMode:
- (void)setAudioCaptureStereoMode:(ZegoAudioCaptureStereoMode) mode;
Set audio capture stereo mode.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
modeZegoAudioCaptureStereoModeAudio stereo capture mode.

Details

This function is used to set the audio capture channel mode. When the developer turns on the stereo capture, using a special stereo capture device, the stereo audio data can be captured and streamed.

  • Use cases: In some professional scenes, users are particularly sensitive to sound effects, such as voice radio and musical instrument performance. At this time, support for stereo and high-quality sound is required.
  • Default value: The default is None, which means mono capture.
  • When to call: It needs to be called after [createEngine], before [startPublishingStream], [startPlayingStream], [startPreview], [createMediaPlayer], [createAudioEffectPlayer] and [createRealTimeSequentialDataManager].
  • Related APIs: When streaming, you need to enable the stereo audio encoding function through the [setAudioConfig] interface at the same time.
  • Available since: 1.15.0 (iOS/Android/Windows/OHOS); support macOS since 2.16.0
  • Restrictions: If you need to enable stereo capture, you also need to meet the following conditions: For iOS/Android, you need to connect an external audio device that supports stereo capture and be at the media volume. For macOS, it needs to be at the media volume. For Windows, an external audio device that supports stereo capture is required.

addPublishCdnUrl:streamID:callback:

addPublishCdnUrl:streamID:callback:
- (void)addPublishCdnUrl:(NSString *) targetURL streamID:(NSString *) streamID callback:(nullable ZegoPublisherUpdateCdnUrlCallback) callback;
Adds a target CDN URL to which the stream will be relayed from ZEGO RTC server.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
targetURLNSString *CDN relay address, supported address format is rtmp, rtmps.
streamIDNSString *Stream ID.
callbacknullable ZegoPublisherUpdateCdnUrlCallbackThe execution result of update the relay CDN operation.

Details

Forward audio and video streams from ZEGO RTC servers to custom CDN content distribution networks with high latency but support for high concurrent pull streams.

  • Use cases: 1. It is often used in large-scale live broadcast scenes that do not have particularly high requirements for delay. 2. Since ZEGO RTC server itself can be configured to support CDN(content distribution networks), this function is mainly used by developers who have CDN content distribution services themselves. 3. This function supports dynamic relay to the CDN content distribution network, so developers can use this function as a disaster recovery solution for CDN content distribution services.
  • When to call: After calling the [createEngine] function to create the engine.
  • Caution: Removing URLs retweeted to CDN requires calling [removePublishCdnUrl], calling [stopPublishingStream] will not remove URLs publish to CDN.
  • Related APIs: Remove URLs that are re-pushed to the CDN [removePublishCdnUrl].
  • Available since: 1.1.0
  • Restrictions: When the [enablePublishDirectToCDN] function is set to true to publish the stream straight to the CDN, then calling this function will have no effect.

addPublishCdnUrl:streamID:timeout:callback:

addPublishCdnUrl:streamID:timeout:callback:
- (void)addPublishCdnUrl:(NSString *) targetURL streamID:(NSString *) streamID timeout:(int) timeout callback:(nullable ZegoPublisherUpdateCdnUrlCallback) callback;
Adds a target CDN URL to which the stream will be relayed from ZEGO RTC server.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
targetURLNSString *CDN relay address, supported address format is rtmp, rtmps.
streamIDNSString *Stream ID.
timeoutintTimeout. Callback if it does not start in the time. Default is 0, which means no timeout. Valid range is [5, 600], in seconds. Less than 0 will be reset to 0, 1 to 4 will be reset to 5, and a greater than 600 will be reset to 600.
callbacknullable ZegoPublisherUpdateCdnUrlCallbackThe execution result of update the relay CDN operation.

Details

Forward audio and video streams from ZEGO RTC servers to custom CDN content distribution networks with high latency but support for high concurrent pull streams.

  • Use cases: 1. It is often used in large-scale live broadcast scenes that do not have particularly high requirements for delay. 2. Since ZEGO RTC server itself can be configured to support CDN(content distribution networks), this function is mainly used by developers who have CDN content distribution services themselves. 3. This function supports dynamic relay to the CDN content distribution network, so developers can use this function as a disaster recovery solution for CDN content distribution services.
  • When to call: After calling the [createEngine] function to create the engine.
  • Caution: Removing URLs retweeted to CDN requires calling [removePublishCdnUrl], calling [stopPublishingStream] will not remove URLs publish to CDN.
  • Related APIs: Remove URLs that are re-pushed to the CDN [removePublishCdnUrl].
  • Available since: 1.1.0
  • Restrictions: When the [enablePublishDirectToCDN] function is set to true to publish the stream straight to the CDN, then calling this function will have no effect.

removePublishCdnUrl:streamID:callback:

removePublishCdnUrl:streamID:callback:
- (void)removePublishCdnUrl:(NSString *) targetURL streamID:(NSString *) streamID callback:(nullable ZegoPublisherUpdateCdnUrlCallback) callback;
Deletes the specified CDN URL, which is used for relaying streams from ZEGO RTC server to CDN.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
targetURLNSString *CDN relay address, supported address format rtmp.
streamIDNSString *Stream ID.
callbacknullable ZegoPublisherUpdateCdnUrlCallbackThe execution result of update the relay CDN operation.

Details

When a CDN forwarding address has been added via [addPublishCdnUrl], this function is called when the stream needs to be stopped.

  • When to call: After calling the [createEngine] function to create the engine, When you don't need to continue publish to the CDN.
  • Caution: This function does not stop publishing audio and video stream to the ZEGO ZEGO RTC server.
  • Related APIs: Add URLs that are re-pushed to the CDN [addPublishCdnUrl].
  • Available since: 1.1.0
  • Restrictions: When the [enablePublishDirectToCDN] function is set to true to publish the stream straight to the CDN, then calling this function will have no effect.

enablePublishDirectToCDN:config:

enablePublishDirectToCDN:config:
- (void)enablePublishDirectToCDN:(BOOL) enable config:(ZegoCDNConfig *) config;
Whether to directly push to CDN (without going through the ZEGO RTC server).
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
enableBOOLWhether to enable direct publish CDN, true: enable direct publish CDN, false: disable direct publish CDN.
configZegoCDNConfig *CDN configuration, if nil, use Zego's background default configuration.

Details

Whether to publish streams directly from the client to CDN without passing through Zego RTC server.

  • Use cases: It is often used in large-scale live broadcast scenes that do not have particularly high requirements for delay.
  • Default value: The default is false, and direct push is not enabled.
  • When to call: After creating the engine [createEngine], before starting to push the stream [startPublishingStream].
  • Caution: The Direct Push CDN feature does not pass through the ZEGO Real-Time Audio and Video Cloud during network transmission, so you cannot use ZEGO's ultra-low latency audio and video services.
  • Related APIs: Dynamic re-push to CDN function [addPublishCdnUrl], [removePublishCdnUrl].
  • Available since: 1.5.0

enablePublishDirectToCDN:config:channel:

enablePublishDirectToCDN:config:channel:
- (void)enablePublishDirectToCDN:(BOOL) enable config:(ZegoCDNConfig *) config channel:(ZegoPublishChannel) channel;
Whether to directly push to CDN (without going through the ZEGO RTC server), for the specified channel.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
enableBOOLWhether to enable direct publish CDN, true: enable direct publish CDN, false: disable direct publish CDN.
configZegoCDNConfig *CDN configuration, if nil, use Zego's background default configuration.
channelZegoPublishChannelPublish stream channel.

Details

Whether to publish streams directly from the client to CDN without passing through Zego RTC server.

  • Use cases: It is often used in large-scale live broadcast scenes that do not have particularly high requirements for delay.
  • Default value: The default is false, and direct push is not enabled.
  • When to call: After creating the engine [createEngine], before starting to push the stream [startPublishingStream].
  • Caution: The Direct Push CDN feature does not pass through the ZEGO Real-Time Audio and Video Cloud during network transmission, so you cannot use ZEGO's ultra-low latency audio and video services.
  • Related APIs: Dynamic re-push to CDN function [addPublishCdnUrl], [removePublishCdnUrl].
  • Available since: 1.5.0

setPublishWatermark:isPreviewVisible:

setPublishWatermark:isPreviewVisible:
- (void)setPublishWatermark:(ZegoWatermark *) watermark isPreviewVisible:(BOOL) isPreviewVisible;
Sets up the stream watermark before stream publishing.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
watermarkZegoWatermark *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.
isPreviewVisibleBOOLWhether the watermark can be seen in the local preview.

Details

Set watermark for publish stream screen.

  • Use cases: It is often used to identify the source of the publish.
  • When to call: After creating the engine through [createEngine] function.
  • Caution: The layout of the watermark cannot exceed the video encoding resolution of the stream. It can be set at any time before or during the publishing stream.
  • Available since: 1.1.0

setPublishWatermark:isPreviewVisible:channel:

setPublishWatermark:isPreviewVisible:channel:
- (void)setPublishWatermark:(ZegoWatermark *) watermark isPreviewVisible:(BOOL) isPreviewVisible channel:(ZegoPublishChannel) channel;
Sets up the stream watermark before stream publishing (for the specified channel).
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
watermarkZegoWatermark *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.
isPreviewVisibleBOOLthe watermark is visible on local preview
channelZegoPublishChannelPublish stream channel.

Details

Set watermark for publish stream screen.

  • Use cases: It is often used to identify the source of the publish.
  • When to call: After creating the engine through [createEngine] function.
  • Caution: The layout of the watermark cannot exceed the video encoding resolution of the stream. It can be set at any time before or during the publishing stream.
  • Available since: 1.1.0

setSEIConfig:

setSEIConfig:
- (void)setSEIConfig:(ZegoSEIConfig *) config;
Set the Supplemental Enhancement Information type.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
configZegoSEIConfig *SEI configuration. The SEI defined by ZEGO is used by default.

Details

By default, the SDK wraps the data with ZEGO's self-defined SEI type, which is not specified by the SEI standard. When the developer needs to use a third-party decoder to decode the SEI, the correct SEI will not be decoded and the [setSEIConfig] interface needs to be called to change the type of the SEI sent by the SDK to UserUnregister type.

  • Use cases: This function needs to be executed when the developer uses a third-party decoder to decode the SEI.
  • When to call: After creating the engine [createEngine], before starting to push the stream [startPublishingStream].
  • Available since: 1.18.0
  • Restrictions: None.

sendSEI:

sendSEI:
- (void)sendSEI:(NSData *) data;
Sends Supplemental Enhancement Information.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
dataNSData *SEI data.

Details

While pushing the stream to transmit the audio and video stream data, the stream media enhancement supplementary information is sent to synchronize some other additional information.

  • Use cases: Generally used in scenes such as synchronizing music lyrics or precise video layout, you can choose to send SEI.
  • When to call: After starting to push the stream [startPublishingStream].
  • Caution: 1. Due to network issues, frame loss may occur, which means SEI information may also be lost. To address this situation, it is advisable to send it multiple times within a limited frequency. 2. Even if the [enableCamera] interface is called to turn off the camera or [mutePublishStreamVideo] is used to stop sending video data, SEI can still be successfully sent; as long as the playback side does not call the [mutePlayStreamVideo] interface to stop pulling audio data, SEI can still be received normally. 3. If the SDK does not support the video module but does support the SEI functional module, SEI information can still be sent normally.
  • Related APIs: After the pusher sends the SEI, the puller can obtain the SEI content by monitoring the callback of [onPlayerRecvSEI].
  • Available since: 1.1.0
  • Restrictions: Do not exceed 30 times per second, and the SEI data length is limited to 4096 bytes.

sendSEI:channel:

sendSEI:channel:
- (void)sendSEI:(NSData *) data channel:(ZegoPublishChannel) channel;
Sends Supplemental Enhancement Information to the specified publish channel.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
dataNSData *SEI data.
channelZegoPublishChannelPublish stream channel.

Details

While pushing the stream to transmit the audio and video stream data, the stream media enhancement supplementary information is sent to synchronize some other additional information.

  • Use cases: Generally used in scenes such as synchronizing music lyrics or precise video layout, you can choose to send SEI.
  • When to call: After starting to push the stream [startPublishingStream].
  • Caution: 1. Due to network issues, frame loss may occur, which means SEI information may also be lost. To address this situation, it is advisable to send it multiple times within a limited frequency. 2. Even if the [enableCamera] interface is called to turn off the camera or [mutePublishStreamVideo] is used to stop sending video data, SEI can still be successfully sent; as long as the playback side does not call the [mutePlayStreamVideo] interface to stop pulling audio data, SEI can still be received normally. 3. If the SDK does not support the video module but does support the SEI functional module, SEI information can still be sent normally.
  • Related APIs: After the pusher sends the SEI, the puller can obtain the SEI content by monitoring the callback of [onPlayerRecvSEI].
  • Available since: 1.1.0
  • Restrictions: Do not exceed 30 times per second, and the SEI data length is limited to 4096 bytes.

sendSEISyncWithCustomVideo:timeStampNs:channel:

sendSEISyncWithCustomVideo:timeStampNs:channel:
- (void)sendSEISyncWithCustomVideo:(NSData *) data timeStampNs:(unsigned long long) timeStampNs channel:(ZegoPublishChannel) channel;
Send the media supplementary enhancement information synchronized with the current video frame during custom video capture.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
dataNSData *SEI data.
timeStampNsunsigned long longvideo frame reference time, UNIX timestamp, in nanosecond.
channelZegoPublishChannelPublish stream channel.

Details

When using custom video capture, push the stream to transmit the video stream data, and send the stream media enhancement supplementary information to synchronize some other additional information, which is synchronized with the current video frame.

  • Use cases: Generally used in scenes that need to be played back in strong synchronization with the video frame, such as video karaoke, video and lyrics are strongly synchronized; or scenes that need to be accurate to the frame level for strategic processing.
  • When to call: To ensure that the SEI is synchronized with the current video frame, it must be called before sending the video frame data.
  • Caution: The sent SEI information follows the video frame. Due to network problems, there may be frame loss. At this time, the SEI will follow the next frame of video data. Therefore, in order to keep the SEI synchronized with the video frame, you should avoid sending SEI continuously; only when using SurfaceTexture on the Android platform , Need to pass the time stamp parameter timeStampNs, otherwise the parameter is invalid.
  • Related APIs: After the pusher sends the SEI, the puller can obtain the SEI content by monitoring the callback of [onPlayerRecvSEI].
  • Available since: 2.15.0
  • Restrictions: Only used for custom video capture; only supports video-driven SEI sending; you should try to avoid calling this interface to send SEI continuously; to ensure that SEI is synchronized with the current video frame, it must be kept in the same thread as the interface for sending custom video frame data; SEI data length is limited to 4096 bytes.

sendAudioSideInfo:timeStampMs:channel:

sendAudioSideInfo:timeStampMs:channel:
- (void)sendAudioSideInfo:(NSData *) data timeStampMs:(double) timeStampMs channel:(ZegoPublishChannel) channel;
Send audio side information.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
dataNSData *Audio side info data.
timeStampMsdoubletimeStampMs, derived from custom audio processing, in milliseconds. If you fill in 0, it is sent along with the frame that is currently ready to be sent.
channelZegoPublishChannelPublish stream channel.

Details

While streaming audio data, send audio side information to synchronize some additional information.

  • Use cases: In the carousel scene, the audio data channel is required to carry accompanying information, such as timestamps to help align the accompaniment, and the need to know who the user is currently singing, whether to amplify the volume, and so on.
  • When to call: After starting to push the stream [startPublishingStream].
  • Caution: 1. Audio side information is driven by audio data, so audio data must be pushed (audio side information may be lost when the DTX function is enabled via the interface [setEngineConfig]). 2. Due to network issues, audio side information may be lost, and the SDK is responsible for transmission but does not guarantee reliability.
  • Related APIs: After the pusher sends the side information, the puller can obtain the side information content by monitoring the callback of [onPlayerRecvAudioSideInfo].
  • Available since: 2.19.0
  • Restrictions: 1. This function is only valid when publishing stream to the Zego RTC server and it also doesn't work when retweeting the stream from the RTC server to the CDN. 2. The audio side information data length is limited to 1024 bytes.

enableHardwareEncoder:

enableHardwareEncoder:
- (void)enableHardwareEncoder:(BOOL) enable;
Enables or disables hardware encoding.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
enableBOOLWhether to enable hardware encoding, true: enable hardware encoding, false: disable hardware encoding.

Details

Whether to use the hardware encoding function when publishing the stream, the GPU is used to encode the stream and to reduce the CPU usage.

  • When to call: The setting can take effect before the stream published. If it is set after the stream published, the stream should be stopped first before it takes effect.
  • Caution: Because hard-coded support is not particularly good for a few models, SDK uses software encoding by default. If the developer finds that the device is hot when publishing a high-resolution audio and video stream during testing of some models, you can consider calling this function to enable hard coding.
  • Available since: 1.1.0

setCapturePipelineScaleMode:

setCapturePipelineScaleMode:
- (void)setCapturePipelineScaleMode:(ZegoCapturePipelineScaleMode) mode;
Sets 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.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
modeZegoCapturePipelineScaleModeThe capture scale timing mode.
  • When to call: This function needs to be set before call [startPreview] or [startPublishingStream].
  • Caution: The main effect is Whether the local preview is affected when the acquisition resolution is different from the encoding resolution.
  • Available since: 1.1.0

setDummyCaptureImagePath:channel:

setDummyCaptureImagePath:channel:
- (void)setDummyCaptureImagePath:(NSString *) filePath channel:(ZegoPublishChannel) channel;
Set the path of the static picture would be published when the camera is closed.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
filePathNSString *Picture file path
channelZegoPublishChannelPublish channel.

Details

Set the path of the static picture would be published when enableCamera(false) is called, it would start to publish static pictures, and when enableCamera(true) is called, it would end publishing static pictures. Use case: The developer wants to display a static picture when the camera is closed. For example, when the anchor exits the background, the camera would be actively closed. At this time, the audience side needs to display the image of the anchor temporarily leaving.

  • When to call: After the engine is initialized, call this API to configure the parameters before closing the camera.
  • Caution: 1. The static picture cannot be seen in the local preview. 2. External filters, mirroring, watermarks, and snapshots are all invalid. 3. If the picture aspect ratio is inconsistent with the set code aspect ratio, it will be cropped according to the code aspect ratio. 4. To publish the audio stream, you must call this interface again and set the image path to empty to avoid video billing.
  • Platform differences: 1. Windows: Fill in the location of the picture directly, such as "D://dir//image.jpg". 2. iOS: If it is a full path, add the prefix "file:", such as @"file:/var/image.png"; If it is a assets picture path, add the prefix "asset:", such as @"asset
    ". 3. Android: If it is a full path, add the prefix "file:", such as "file:/sdcard/image.png"; If it is a assets directory path, add the prefix "asset:", such as "asset
    .png". 4. Flutter: If it is a absolute path, add the prefix "file:", such as "file:/sdcard/image.png"; If it is a assets resources directory path, add the prefix "flutter-asset://", such as "flutter-asset://assets/watermark.png". 5. UniApp: Only absolute paths are supported. You need to add a "file:" prefix, such as: "file:/sdcard/image.png".
  • Restrictions: 1. Supported picture types are JPEG/JPG, PNG, BMP, HEIF. 2. The function is only for SDK video capture and does not take effect for custom video capture. 3. Not supported that the filePath is a network link.

setDummyCaptureImageParams:channel:

setDummyCaptureImageParams:channel:
- (void)setDummyCaptureImageParams:(ZegoDummyCaptureImageParams *) params channel:(ZegoPublishChannel) channel;
Set the params of the static picture would be published when the camera is closed.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
paramsZegoDummyCaptureImageParams *Dummy capture image params.
channelZegoPublishChannelPublish channel.

Details

Set the params of the static picture would be published when enableCamera(false) is called, it would start to publish static pictures, and when enableCamera(true) is called, it would end publishing static pictures. Use case: The developer wants to display a static picture when the camera is closed. For example, when the anchor exits the background, the camera would be actively closed. At this time, the audience side needs to display the image of the anchor temporarily leaving.

  • When to call: After the engine is initialized, call this API to configure the parameters before closing the camera.
  • Caution: 1. The static picture cannot be seen in the local preview. 2. External filters, mirroring, watermarks, and snapshots are all invalid. 3. If the picture aspect ratio is inconsistent with the set code aspect ratio, it will be cropped according to the code aspect ratio. 4. To publish the audio stream, you must call this interface again and set the image path to empty to avoid video billing.
  • Platform differences: 1. Windows: Fill in the location of the picture directly, such as "D://dir//image.jpg". 2. iOS: If it is a full path, add the prefix "file:", such as @"file:/var/image.png"; If it is a assets picture path, add the prefix "asset:", such as @"asset
    ". 3. Android: If it is a full path, add the prefix "file:", such as "file:/sdcard/image.png"; If it is a assets directory path, add the prefix "asset:", such as "asset
    .png". 4. Flutter: If it is a absolute path, add the prefix "file:", such as "file:/sdcard/image.png"; If it is a assets resources directory path, add the prefix "flutter-asset://", such as "flutter-asset://assets/watermark.png". 5. UniApp: Only absolute paths are supported. You need to add a "file:" prefix, such as: "file:/sdcard/image.png".
  • Restrictions: 1. Supported picture types are JPEG/JPG, PNG, BMP, HEIF. 2. The function is only for SDK video capture and does not take effect for custom video capture. 3. Not supported that the filePath is a network link.

enableH265EncodeFallback:

enableH265EncodeFallback:
- (void)enableH265EncodeFallback:(BOOL) enable;
Whether to enable H.265 encoding to automatically downgrade to H.264 encoding.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
enableBOOLWhether to enable H.265 coding automatically fallback to H.264 coding, true: enable, false: disable, and the default value is true

Details

When using H.265 encoding to push the stream, whether to enable the strategy of automatically degrading H.265 encoding to H.264 encoding under abnormal circumstances.After enabling automatic downgrade, when H.265 encoding is not supported or H.265 encoding fails, the SDK will try to downgrade and use H.264 encoding to push the stream.After turning off automatic downgrade, when H.265 encoding is not supported or H.265 encoding fails, the direct streaming fails.

  • Use cases: In the Co-hosting and Showroom Live Streaming scenarios, use H265 encoding to push the stream to save CDN traffic without degrading the picture quality. Default Value: When this interface is not called, the default is yes, which means that H.265 encoding is turned on and automatically downgraded to H.264 encoding.
  • When to call: After creating the engine, call the [startPublishingStream] function before pushing the stream.
  • Related callbacks: When the H.265 encoding is automatically downgraded to the H.264 encoding strategy, the [onPublisherVideoEncoderChanged] callback will be triggered when the encoding method changes.
  • Caution: When downgrading from H.265 to H.264 encoding occurs during the streaming process, if you are recording local video or cloud recording, multiple recording files will be generated, which needs to be dealt with.
  • Available since: 2.12.0

isVideoEncoderSupported:

isVideoEncoderSupported:
- (BOOL)isVideoEncoderSupported:(ZegoVideoCodecID) codecID;
Whether the specified video encoding type is supported.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
codecIDZegoVideoCodecIDVideo codec id. Required: Yes.

Details

Whether the specified video encoding is supported depends on the following aspects, whether the hardware model supports hard encoding, whether the performance of the hardware model supports soft encoding, and whether the SDK has the encoding module.

  • When to call: After creating the engine.
  • Caution: It is recommended that users call this interface to obtain H.265 encoding support capability before publish stream with H.265 encoding, if not supported, you can use other encodings for publish, such as H.264.On the mobile platform, the SDK only supports H.265 hardware encoding, and it is affected by the model and hardware capabilities.
  • Available since: 2.12.0 and above

Return

Whether the specified video encoding is supported.Value range: true means support, you can use this encoding format for publish; false means the is not supported, and the encoding format cannot be used for publish.

isVideoEncoderSupported:codecBackend:

isVideoEncoderSupported:codecBackend:
- (int)isVideoEncoderSupported:(ZegoVideoCodecID) codecID codecBackend:(ZegoVideoCodecBackend) codecBackend;
Whether the specified video encoding type and implementation are supported.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
codecIDZegoVideoCodecIDVideo codec id. Required: Yes.
codecBackendZegoVideoCodecBackendBackend implementation of encoder. Required: Yes.

Details

Whether the specified video encoding is supported depends on the following aspects, whether the hardware model supports hard encoding, whether the performance of the hardware model supports soft encoding, and whether the SDK has the encoding module.

  • When to call: After creating the engine.
  • Caution: It is recommended that users call this interface to obtain H.265 encoding support capability before publish stream with H.265 encoding, if not supported, you can use other encodings for publish, such as H.264.On the mobile platform, the SDK only supports H.265 hardware encoding, and it is affected by the model and hardware capabilities.
  • Available since: 3.0.0 and above

Return

Whether the specified video encoding format is supported; 0 means not supported, and the encoding format cannot be used for publish stream; 1 means support, you can use this encoding format for publish stream; 2 means not confirmed, it is recommended to call this interface later.

getVideoEncoderSupported:codecBackend:callback:

getVideoEncoderSupported:codecBackend:callback:
- (void)getVideoEncoderSupported:(ZegoVideoCodecID) codecID codecBackend:(ZegoVideoCodecBackend) codecBackend callback:(nullable ZegoPublisherGetVideoEncoderSupportedCallback) callback;
Whether the specified video encoding type and implementation are supported.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
codecIDZegoVideoCodecIDVideo codec id. Required: Yes.
codecBackendZegoVideoCodecBackendBackend implementation of encoder. Required: Yes.
callbacknullable ZegoPublisherGetVideoEncoderSupportedCallbackResults of get video encoder supported.

Details

Whether the specified video encoding is supported depends on the following aspects, whether the hardware model supports hard encoding, whether the performance of the hardware model supports soft encoding, and whether the SDK has the encoding module.

  • When to call: After creating the engine.
  • Caution: It is recommended that users call this interface to obtain H.265 encoding support capability before publish stream with H.265 encoding, if not supported, you can use other encodings for publish, such as H.264.On the mobile platform, the SDK only supports H.265 hardware encoding, and it is affected by the model and hardware capabilities.
  • Available since: 3.23.0 and above

setAppOrientationMode:

setAppOrientationMode:
- (void)setAppOrientationMode:(ZegoOrientationMode) mode;
Set the orientation mode of the video.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
modeZegoOrientationModeOrientation mode of the video.

Details

In order to simplify the complexity of processing video screen rotation for mobile developers, the SDK supports setting multiple video orientation modes, and developers can choose different modes according to the needs of the scene.

  • Use cases: Scenarios for live streaming or video calls using mobile devices.
  • Default value: Custom mode.
  • When to call: This function needs to be valid after calling [createEngine] and before calling preview [startPreview] or push stream [startPublishingStream].
  • Caution:
    1. It is valid for all channels.
    2. The adaptive mode takes effect in preview, streaming, and mixed streaming scenarios. It does not support external video capture, media player, cloud recording, local recording, or publishing/playing stream through CDN.
  • Related APIs: You can call the [setAppOrientation] function to set the orientation of the App in custom mode.
  • Available since: 2.23.0

setLowlightEnhancement:channel:

setLowlightEnhancement:channel:
- (void)setLowlightEnhancement:(ZegoLowlightEnhancementMode) mode channel:(ZegoPublishChannel) channel;
Set low light enhancement.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
modeZegoLowlightEnhancementModeLow light enhancement mode.
channelZegoPublishChannelPublish stream channel.

Details

According to the set low-light enhancement mode, the brightness of the image captured by the camera is enhanced, which is compatible with the beauty function. Users can watch the effect while previewing and toggle the low-light enhancement mode in real time.

  • Use cases: The environment on the streaming end is dark, or the frame rate set by the camera is high, which causes the picture to be dark, and the subject cannot be displayed or recognized normally.
  • Default value: Off.
  • When to call: After creating the engine [createEngine].
  • Available since: 2.21.0

setLowlightEnhancementParams:channel:

setLowlightEnhancementParams:channel:
- (void)setLowlightEnhancementParams:(ZegoExpLowlightEnhancementParams *) params channel:(ZegoPublishChannel) channel;
Set low light enhancement params.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
paramsZegoExpLowlightEnhancementParams *Low light enhancement params.
channelZegoPublishChannelPublish stream channel.

Details

According to the set low-light enhancement mode, the brightness of the image captured by the camera is enhanced, which is compatible with the beauty function. Users can watch the effect while previewing and toggle the low-light enhancement mode in real time.

  • Use cases: The environment on the streaming end is dark, or the frame rate set by the camera is high, which causes the picture to be dark, and the subject cannot be displayed or recognized normally.
  • When to call: After creating the engine [createEngine].
  • Available since: 3.19.0

setVideoDenoiseParams:channel:

setVideoDenoiseParams:channel:
- (void)setVideoDenoiseParams:(ZegoVideoDenoiseParams *) params channel:(ZegoPublishChannel) channel;
Set video denoise params.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
paramsZegoVideoDenoiseParams *Video denoise params.
channelZegoPublishChannelPublish stream channel.

Details

Set video denoise parameters, including mode and strength.

  • Default value: Off.
  • When to call: After creating the engine [createEngine].
  • Platform differences: Only supports iOS and Android.
  • Available since: 3.18.0

setVideoSource:

setVideoSource:
- (int)setVideoSource:(ZegoVideoSourceType) source;
Set video capture source.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
sourceZegoVideoSourceTypeVideo capture source.

Details

Set video capture source for switching between different video capture sources.

  • Use cases: Typically used in educational scenarios that require switching between different video capture sources.
  • When to call: After the engine is created [createEngine].
  • Caution: 1. Act on the main publish channel ZegoPublishChannel.Main.
  1. Main push channel ZegoPublishChannel.Main does not support using ZegoVideoSourceType.Player and ZegoVideoSourceType.MainPublishChannel video source type.
  • Available since: 3.1.0
  • Restrictions: None.

setVideoSource:instanceID:

setVideoSource:instanceID:
- (int)setVideoSource:(ZegoVideoSourceType) source instanceID:(unsigned int) instanceID;
Set a video capture instance as the video capture source.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
sourceZegoVideoSourceTypeVideo capture source.
instanceIDunsigned intVideo capture source instance id.

Details

Set video capture source for switching between different video capture sources.

  • Use cases: Typically used in educational scenarios that require switching between different video capture sources.
  • When to call: After the engine is created [createEngine].
  • Caution: 1. Act on the main publish channel ZegoPublishChannel.Main.
  1. Main push channel ZegoPublishChannel.Main does not support using ZegoVideoSourceType.Player and ZegoVideoSourceType.MainPublishChannel video source type.
  • Available since: 3.1.0
  • Restrictions: None.

setVideoSource:channel:

setVideoSource:channel:
- (int)setVideoSource:(ZegoVideoSourceType) source channel:(ZegoPublishChannel) channel;
Set video capture source for the specified channel.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
sourceZegoVideoSourceTypeVideo capture source.
channelZegoPublishChannelPublish stream channel.

Details

Set video capture source for switching between different video capture sources.

  • Use cases: Typically used in educational scenarios that require switching between different video capture sources.
  • When to call: After the engine is created [createEngine].
  • Caution: 1. Main push channel ZegoPublishChannel.Main does not support using ZegoVideoSourceType.Player and ZegoVideoSourceType.MainPublishChannel video source type.
  1. When using ZegoVideoSourceType.Player and ZegoVideoSourceType.MainPublishChannel video source type in aux publish channel ZegoPublishChannel.Aux, must ensure that physical device works on main publish channel ZegoPublishChannel.Main.
  2. Preemptive video sources are not allowed to be used on multiple channels at the same time, such as ZegoVideoSourceType.Camera and ZegoVideoSourceType.ScreenCapture.
  3. The other publish channel can copy the main publish channel only when the main publish channel uses internal video capture. A maximum of one copy is supported.
  4. When using ZegoVideoSourceType.Player video source type, please ensure that the ZegoMediaPlayer instance is created successfully.
  • Available since: 3.1.0
  • Restrictions: None.

setVideoSource:instanceID:channel:

setVideoSource:instanceID:channel:
- (int)setVideoSource:(ZegoVideoSourceType) source instanceID:(unsigned int) instanceID channel:(ZegoPublishChannel) channel;
Set a video capture instance as video capture source for the specified channel.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
sourceZegoVideoSourceTypeVideo capture source.
instanceIDunsigned intVideo capture source instance id.
channelZegoPublishChannelPublish stream channel.

Details

Set video capture source for switching between different video capture sources.

  • Use cases: Typically used in educational scenarios that require switching between different video capture sources.
  • When to call: After the engine is created [createEngine].
  • Caution: 1. Main push channel ZegoPublishChannel.Main does not support using ZegoVideoSourceType.Player and ZegoVideoSourceType.MainPublishChannel video source type.
  1. When using ZegoVideoSourceType.Player and ZegoVideoSourceType.MainPublishChannel video source type in aux publish channel ZegoPublishChannel.Aux, must ensure that physical device works on main publish channel ZegoPublishChannel.Main.
  2. Preemptive video sources are not allowed to be used on multiple channels at the same time, such as ZegoVideoSourceType.Camera and ZegoVideoSourceType.ScreenCapture.
  3. The other publish channel can copy the main publish channel only when the main publish channel uses internal video capture. A maximum of one copy is supported.
  4. When using ZegoVideoSourceType.Player video source type, please ensure that the ZegoMediaPlayer instance is created successfully.
  • Available since: 3.1.0
  • Restrictions: None.

setAudioSource:

setAudioSource:
- (int)setAudioSource:(ZegoAudioSourceType) source;
Set audio capture source.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
sourceZegoAudioSourceTypeAudio capture source.

Details

Set audio capture source for switching between different audio capture sources.

  • Use cases: Typically used in educational scenarios that require switching between different audio capture sources.
  • When to call: After the engine is created [createEngine].
  • Caution: 1. Act on the main publish channel ZegoPublishChannel.Main.
  1. Main push channel ZegoPublishChannel.Main does not support using ZegoAudioSourceType.MediaPlayer and ZegoAudioSourceType.MainPublishChannel audio source type.
  • Available since: 3.1.0
  • Restrictions: None.

setAudioSource:channel:

setAudioSource:channel:
- (int)setAudioSource:(ZegoAudioSourceType) source channel:(ZegoPublishChannel) channel;
Set audio capture source for the specified channel.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
sourceZegoAudioSourceTypeAudio capture source.
channelZegoPublishChannelPublish stream channel.

Details

Set audio capture source for switching between different audio capture sources.

  • Use cases: Typically used in educational scenarios that require switching between different audio capture sources.
  • When to call: After the engine is created [createEngine].
  • Caution: 1. Main push channel ZegoPublishChannel.Main does not support using ZegoAudioSourceType.MediaPlayer and ZegoAudioSourceType.MainPublishChannel audio source type.
  1. When using ZegoAudioSourceType.MediaPlayer and ZegoAudioSourceType.MainPublishChannel audio source type in aux publish channel ZegoPublishChannel.Aux, must ensure that physical device works on main publish channel ZegoPublishChannel.Main.
  2. Preemptive audio sources are not allowed to be used on multiple channels at the same time, such as ZegoAudioSourceType.Microphone.
  3. When using ZegoAudioSourceType.MediaPlayer audio source type, please ensure that the ZegoMediaPlayer instance is created successfully.
  • Available since: 3.1.0

setAudioSource:config:

setAudioSource:config:
- (int)setAudioSource:(ZegoAudioSourceType) source config:(ZegoAudioSourceMixConfig *) config;
Set audio capture source with audio mix config.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
sourceZegoAudioSourceTypeAudio capture source.
configZegoAudioSourceMixConfig *Audio capture source mix config.

Details

Set audio capture source for switching between different audio capture sources.

  • Use cases: Typically used in educational scenarios that require switching between different audio capture sources.
  • When to call: After the engine is created [createEngine].
  • Caution: 1. Act on the main publish channel ZegoPublishChannel.Main.
  1. Main push channel ZegoPublishChannel.Main does not support using ZegoAudioSourceType.MediaPlayer and ZegoAudioSourceType.MainPublishChannel audio source type.
  • Available since: 3.1.0
  • Restrictions: None.

enableVideoObjectSegmentation:type:channel:

enableVideoObjectSegmentation:type:channel:
- (void)enableVideoObjectSegmentation:(BOOL) enable type:(ZegoObjectSegmentationType) type channel:(ZegoPublishChannel) channel;
Enable video object segmentation.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
enableBOOLWhether to enable video object segmentation, off by default.
typeZegoObjectSegmentationTypeThe type of object segmentation.
channelZegoPublishChannelPublish stream channel.

Details

Video object segmentation and transmission is a technology that separates the video object (in most cases, a person) in a rectangular video through an AI algorithm at the push end, transmits it in the RTC network, and renders it at the stream playing end.

  • Use cases: Scenes where the object in the video needs to be separated from the background, such as mixed reality, multi-person interaction scenes, and so on.
  • When to call:
  1. After the engine is created [createEngine].
  2. If you want to listen to the [onVideoObjectSegmentationStateChanged] callback, you need to call [startPublishingStream] or [startPreview].
  • Caution: This feature requires special braiding, please contact ZEGO Technical Support
  • Related callbacks: Listen for changes of the object segmentation state through [onVideoObjectSegmentationStateChanged].
  • Related APIs: Use [enableAlphaChannelVideoEncoder] to support the transparent background encoding of the divided object, and then publish the stream, you can render the object with a transparent background effect on the stream playing side.
  • Available since: 3.4.0
  • Restrictions: Enabling object segmentation is a time-consuming operation, and it is not necessary to turn it on and off frequently.

enableVideoObjectSegmentation:config:channel:

enableVideoObjectSegmentation:config:channel:
- (void)enableVideoObjectSegmentation:(BOOL) enable config:(ZegoObjectSegmentationConfig *) config channel:(ZegoPublishChannel) channel;
Enable video object segmentation.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
enableBOOLWhether to enable video object segmentation, off by default.
configZegoObjectSegmentationConfig *The type of object segmentation.
channelZegoPublishChannelPublish stream channel.

Details

Video object segmentation and transmission is a technology that separates the video object (in most cases, a person) in a rectangular video through an AI algorithm at the push end, transmits it in the RTC network, and renders it at the stream playing end.

  • Use cases: Scenes where the object in the video needs to be separated from the background, such as mixed reality, multi-person interaction scenes, and so on.
  • When to call: After the engine is created [createEngine].
  • Caution: This feature requires special braiding, please contact ZEGO Technical Support
  • Related callbacks: When the object segmentation is turned on or off, the notification of the object segmentation state can be received through [onVideoObjectSegmentationStateChanged].
  • Related APIs: Use [enableAlphaChannelVideoEncoder] to support the transparent background encoding of the divided object, and then publish the stream, you can render the object with a transparent background effect on the stream playing side.
  • Available since: 3.6.0
  • Restrictions: Enabling object segmentation is a time-consuming operation, and it is not necessary to turn it on and off frequently.

enableAlphaChannelVideoEncoder:alphaLayout:channel:

enableAlphaChannelVideoEncoder:alphaLayout:channel:
- (void)enableAlphaChannelVideoEncoder:(BOOL) enable alphaLayout:(ZegoAlphaLayoutType) alphaLayout channel:(ZegoPublishChannel) channel;
Enable video encoder alpha channel support.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
enableBOOLEnable video encoder alpha channel support, off by default.
alphaLayoutZegoAlphaLayoutTypeSpecify the layout position of the alpha channel data.
channelZegoPublishChannelPublish stream channel.

Details

Enable the alpha channel support of the video encoder on the stream publishing end, and encode the split video body for streaming.

  • Use cases: Scenes where the object in the video needs to be separated from the background, such as mixed reality, multi-person interaction scenes, and so on.
  • When to call: After creating the engine.
  • Available since: 3.4.0

enableVideoEncoderEnhancement:enhanceLevel:channel:

enableVideoEncoderEnhancement:enhanceLevel:channel:
- (void)enableVideoEncoderEnhancement:(BOOL) enable enhanceLevel:(float) enhanceLevel channel:(ZegoPublishChannel) channel;
Enable video encoder enhancement.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
enableBOOLWhether to enable, true: enable, false: disable
enhanceLevelfloatenhance_level [0.0,1.5], advise 0.9
channelZegoPublishChannelPublish stream channel.

Details

Call this function to enable or disable video encoder enhancement.

  • Use cases: Commonly used in video calling, live streaming, and similar scenarios.
  • Default value: When this function is not called, video encoder enhancement is not enabled by default.
  • When to call: It needs to be called after [createEngine].
  • Available since: 3.23.0

setCameraStabilizationMode:channel:

setCameraStabilizationMode:channel:
- (void)setCameraStabilizationMode:(int) mode channel:(ZegoPublishChannel) channel;
Set the camera stabilization mode.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
modeintThe camera stabilization mode.
iOS
Apple AVCaptureVideoStabilizationMode definition for details. The default value is 0.
Android:AUTO:-1, OFF:0. The default value is 0.
channelZegoPublishChannelPublish stream channel.

Details

Set the camera stabilization mode. Use case: Users can use this function to set the camera stabilization mode to reduce the impact of camera shake on video collection.

  • When to call: Called after the engine is created [createEngine].
  • Platform differences: Only supports iPhone and Android.
  • Available since: 3.13.0
  • Restrictions: Only supports internal video capture.

enableAuxBgmBalance:

enableAuxBgmBalance:
- (void)enableAuxBgmBalance:(BOOL) enable;
Turn on or off the adaptive mode to adjust the volume of the human voice according to the volume of the BGM.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
enableBOOLTurn on or off the adaptive mode to adjust the volume of the human voice according to the volume of the BGM.

Details

Turn on or off the adaptive mode to adjust the volume of the human voice according to the volume of the BGM to balance the volume of the human voice and the BGM. Default is off.

  • When to call: Called after the engine is created [createEngine].
  • Available since: 3.18.0
  • Restrictions: This interface will take effect only when the [EnableAux] interface of the media player is called to enable aux.

enableFaceDetection:channel:

enableFaceDetection:channel:
- (void)enableFaceDetection:(BOOL) enable channel:(ZegoPublishChannel) channel;
Turn on or off the face detection.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
enableBOOLTurn on or off the face detection.
channelZegoPublishChannelPublish stream channel.

Details

Turn on or off the face detection. Default is on.

  • When to call: Called after the engine is created [createEngine].
  • Related callbacks: Detect results will be called back through [onPublisherFaceDetectInfo].
  • Available since: 3.20.0
  • Restrictions: This interface is disabled when using custom video capture.

startPlayingStream:canvas:

startPlayingStream:canvas:
- (void)startPlayingStream:(NSString *) streamID canvas:(ZegoCanvas *) canvas;
Starts playing a stream from ZEGO RTC server.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
streamIDNSString *Stream ID, a string of up to 256 characters.
Caution:
Only support numbers, English characters and '-', '_'.
canvasZegoCanvas *The view used to display the play audio and video stream's image. When the view is set to [nil], no video is displayed, only audio is played.

Details

Play audio and video streams from the ZEGO RTC server.

  • Use cases: In the real-time scenario, developers can listen to the [onRoomStreamUpdate] event callback to obtain the new stream information in the room where they are located, and call this interface to pass in streamID for play streams.
  • When to call: After [loginRoom].
  • Caution: 1. The developer can update the player canvas by calling this function again (the streamID must be the same). 2. After the first play stream failure due to network reasons or the play stream is interrupted, the default time for SDK reconnection is 20min. 3. In the case of poor network quality, user play may be interrupted, the SDK will try to reconnect, and the current play status and error information can be obtained by listening to the [onPlayerStateUpdate] event. please refer to https://docs.zegocloud.com/faq/reconnect. 4. Playing the stream ID that does not exist, the SDK continues to try to play after calling this function. After the stream ID is successfully published, the audio and video stream can be actually played.
  • Available since: 1.1.0
  • Restrictions: None.

startPlayingStream:canvas:config:

startPlayingStream:canvas:config:
- (void)startPlayingStream:(NSString *) streamID canvas:(ZegoCanvas *) canvas config:(ZegoPlayerConfig *) config;
Starts playing a stream from ZEGO RTC server or from third-party CDN. Support multi-room mode.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
streamIDNSString *Stream ID, a string of up to 256 characters.
Caution:
Only support numbers, English characters and '-', '_'.
canvasZegoCanvas *The view used to display the play audio and video stream's image. When the view is set to [nil], no video is displayed, only audio is played.
configZegoPlayerConfig *Advanced player configuration Room [roomID] in [ZegoPlayerConfig] is the login roomID.

Details

Play audio and video streams from the ZEGO RTC server or CDN.

  • Use cases: In real-time or live broadcast scenarios, developers can listen to the [onRoomStreamUpdate] event callback to obtain the new stream information in the room where they are located, and call this interface to pass in streamID for play streams.
  • When to call: After [loginRoom].
  • Caution: 1. The developer can update the player canvas by calling this function again (the streamID must be the same). 2. After the first play stream failure due to network reasons or the play stream is interrupted, the default time for SDK reconnection is 20min. 3. In the case of poor network quality, user play may be interrupted, the SDK will try to reconnect, and the current play status and error information can be obtained by listening to the [onPlayerStateUpdate] event. please refer to https://docs.zegocloud.com/faq/reconnect. 4. Playing the stream ID that does not exist, the SDK continues to try to play after calling this function. After the stream ID is successfully published, the audio and video stream can be actually played.
  • Available since: 1.1.0
  • Restrictions: None.

startPlayingStream:

startPlayingStream:
- (void)startPlayingStream:(NSString *) streamID;
Starts playing a stream from ZEGO RTC server, without Canvas, it is more suitable for pure audio stream.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
streamIDNSString *Stream ID, a string of up to 256 characters.
Caution:
Only support numbers, English characters and '-', '_'.

Details

Play audio streams from the ZEGO RTC server or CDN.

  • Use cases: In the real-time scenario, developers can listen to the [onRoomStreamUpdate] event callback to obtain the new stream information in the room where they are located, and call this interface to pass in streamID for play streams.
  • When to call: After [loginRoom].
  • Caution: 1. After the first play stream failure due to network reasons or the play stream is interrupted, the default time for SDK reconnection is 20min. 2. In the case of poor network quality, user play may be interrupted, the SDK will try to reconnect, and the current play status and error information can be obtained by listening to the [onPlayerStateUpdate] event. please refer to https://docs.zegocloud.com/faq/reconnect. 3. Playing the stream ID that does not exist, the SDK continues to try to play after calling this function. After the stream ID is successfully published, the audio stream can be actually played.
  • Available since: 1.1.0
  • Restrictions: None.

startPlayingStream:config:

startPlayingStream:config:
- (void)startPlayingStream:(NSString *) streamID config:(ZegoPlayerConfig *) config;
Starts playing a stream from ZEGO RTC server or from third-party CDN, without Canvas, it is more suitable for pure audio stream.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
streamIDNSString *Stream ID, a string of up to 256 characters.
Caution:
Only support numbers, English characters and '-', '_'.
configZegoPlayerConfig *Advanced player configuration.

Details

Play audio streams from the ZEGO RTC server or CDN.

  • Use cases: In real-time or live broadcast scenarios, developers can listen to the [onRoomStreamUpdate] event callback to obtain the new stream information in the room where they are located, and call this interface to pass in streamID for play streams.
  • When to call: After [loginRoom].
  • Caution: 1. After the first play stream failure due to network reasons or the play stream is interrupted, the default time for SDK reconnection is 20min. 2. In the case of poor network quality, user play may be interrupted, the SDK will try to reconnect, and the current play status and error information can be obtained by listening to the [onPlayerStateUpdate] event. please refer to https://docs.zegocloud.com/faq/reconnect. 3. Playing the stream ID that does not exist, the SDK continues to try to play after calling this function. After the stream ID is successfully published, the audio stream can be actually played.
  • Available since: 1.1.0
  • Restrictions: None.

startPlayingStreamInScene:canvas:config:

startPlayingStreamInScene:canvas:config:
- (void)startPlayingStreamInScene:(NSString *) streamID canvas:(ZegoCanvas *) canvas config:(ZegoScenePlayerConfig *) config;
Starts playing a stream from ZEGO RTC server or from third-party CDN when using RangeScene.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
streamIDNSString *Stream ID, a string of up to 256 characters.
Caution:
Only support numbers, English characters and '-', '_'.
canvasZegoCanvas *The view used to display the play audio and video stream's image. When the view is set to [nil], no video is displayed, only audio is played.
configZegoScenePlayerConfig *Advanced scene player configuration.

Details

Play audio and video streams from the ZEGO RTC server or CDN.

  • Use cases: When using RangeScene, users can use this function to customize play the streaming.
  • When to call: After [loginScene].
  • Caution: 1. The developer can update the player canvas by calling this function again (the streamID must be the same). 2. After the first play stream failure due to network reasons or the play stream is interrupted, the default time for SDK reconnection is 20min. 3. In the case of poor network quality, user play may be interrupted, the SDK will try to reconnect, and the current play status and error information can be obtained by listening to the [onPlayerStateUpdate] event. please refer to https://docs.zegocloud.com/faq/reconnect. 4. Playing the stream ID that does not exist, the SDK continues to try to play after calling this function. After the stream ID is successfully published, the audio and video stream can be actually played.
  • Available since: 3.4.0
  • Restrictions: None.

startPlayingStreamInScene:config:

startPlayingStreamInScene:config:
- (void)startPlayingStreamInScene:(NSString *) streamID config:(ZegoScenePlayerConfig *) config;
Starts playing a stream from ZEGO RTC server or from third-party CDN when using RangeScene, without Canvas, it is more suitable for pure audio stream.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
streamIDNSString *Stream ID, a string of up to 256 characters.
Caution:
Only support numbers, English characters and '-', '_'.
configZegoScenePlayerConfig *Advanced scene player configuration.

Details

Play audio and video streams from the ZEGO RTC server or CDN.

  • Use cases: When using RangeScene, users can use this function to customize play the streaming.
  • When to call: After [loginScene].
  • Caution: 1. The developer can update the player canvas by calling this function again (the streamID must be the same). 2. After the first play stream failure due to network reasons or the play stream is interrupted, the default time for SDK reconnection is 20min. 3. In the case of poor network quality, user play may be interrupted, the SDK will try to reconnect, and the current play status and error information can be obtained by listening to the [onPlayerStateUpdate] event. please refer to https://docs.zegocloud.com/faq/reconnect. 4. Playing the stream ID that does not exist, the SDK continues to try to play after calling this function. After the stream ID is successfully published, the audio and video stream can be actually played.
  • Available since: 3.3.0
  • Restrictions: None.

switchPlayingStream:toStreamID:config:

switchPlayingStream:toStreamID:config:
- (void)switchPlayingStream:(NSString *) fromStreamID toStreamID:(NSString *) toStreamID config:(ZegoPlayerConfig *) config;
Switch from playing a certain stream to playing another stream.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
fromStreamIDNSString *Stream ID, a string of up to 256 characters.
Caution:
Only support numbers, English characters and '-', '_'.
toStreamIDNSString *Stream ID, a string of up to 256 characters.
Caution:
Only support numbers, English characters and '-', '_'.
configZegoPlayerConfig *Advanced player configuration.

Details

Smoothly switch from one flv stream to another flv stream.

  • Use cases: For the same stream, there may be multiple streams with different resolutions. When the network quality deteriorates, in order to ensure the streaming quality, the streaming end can choose to switch from a high-resolution stream to a low-resolution stream..
  • When to call: After [startPlayingStream].
  • Related callbacks:
  1. The result of the switching request can be obtained through the [onPlayerSwitched] event.
  2. When the stream is switched successfully, the current streaming status can be known through the [onPlayerStateUpdate] event.
  3. When switching streams fails, there may not necessarily be an [onPlayerStateUpdate] event notification.
  • Available since: 3.16.0
  • Restrictions: Only supports flv protocol stream.

stopPlayingStream:

stopPlayingStream:
- (void)stopPlayingStream:(NSString *) streamID;
Stops playing a stream.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
streamIDNSString *Stream ID.

Details

Play audio and video streams from the ZEGO RTC server.

  • Use cases: In the real-time scenario, developers can listen to the [onRoomStreamUpdate] event callback to obtain the delete stream information in the room where they are located, and call this interface to pass in streamID for stop play streams.
  • When to call: After [loginRoom].
  • Caution: 1. When stopped, the attributes set for this stream previously, such as [setPlayVolume], [mutePlayStreamAudio], [mutePlayStreamVideo], etc., will be invalid and need to be reset when playing the the stream next time.
  1. After stopping pulling, the iOS platform view will clear the last frame by default and keep the background color of the view. The Android platform view remains at the last frame by default. If you need to clear the last frame, please contact ZEGO technical support.
  • Available since: 1.1.0
  • Restrictions: None.

setPlayStreamDecryptionKey:streamID:

setPlayStreamDecryptionKey:streamID:
- (void)setPlayStreamDecryptionKey:(NSString *) key streamID:(NSString *) streamID;
Set decryption key for the playing stream.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
keyNSString *The decryption key, note that the key length only supports 16/24/32 bytes.
streamIDNSString *Stream ID.

Details

When streaming, the audio and video data will be decrypted according to the set key.

  • Use cases: Usually used in scenarios that require high security for audio and video calls.
  • When to call: after [createEngine], after the play stream can be changed at any time.
  • Related APIs: [setPublishStreamEncryptionKey]Set the publish stream encryption key.
  • Caution: This interface can only be called if encryption is set on the publish. Calling [stopPlayingStream] or [logoutRoom] will clear the decryption key.
  • Available since: 1.19.0
  • Restrictions: This function is only valid when calling from Zego RTC or L3 server.

setPlayStreamCrossAppInfo:streamID:

setPlayStreamCrossAppInfo:streamID:
- (void)setPlayStreamCrossAppInfo:(ZegoCrossAppInfo *) info streamID:(NSString *) streamID;
Set up cross App playing stream information.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
infoZegoCrossAppInfo *Information for cross App playing stream.
streamIDNSString *Stream ID.

Details

This information is used for authentication before playing a stream or when retrying playing a stream.

  • Use cases: Used in scenarios that playing streams across apps.
  • When to call: after [createEngine], after the play stream can be changed at any time.
  • Caution: Calling [stopPlayingStream] or [logoutRoom] will clear this information.
  • Available since: 2.19.0
  • Restrictions: This function is only valid when playing stream from Zego RTC server.

takePlayStreamSnapshot:callback:

takePlayStreamSnapshot:callback:
- (void)takePlayStreamSnapshot:(NSString *) streamID callback:(ZegoPlayerTakeSnapshotCallback) callback;
Take a snapshot of the playing stream.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
streamIDNSString *Stream ID to be snapshot.
callbackZegoPlayerTakeSnapshotCallbackResults of take play stream snapshot.

Details

Take a screenshot of the specified stream ID.

  • When to call: after called [startPlayingStream].
  • Related callbacks: [onPlayerTakeSnapshotResult] Screenshot data callback.
  • Available since: 1.17.0
  • Restrictions: None.

setPlayVolume:streamID:

setPlayVolume:streamID:
- (void)setPlayVolume:(int) volume streamID:(NSString *) streamID;
Sets the stream playback volume.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
volumeintVolume percentage. The value ranges from 0 to 200, and the default value is 100.
streamIDNSString *Stream ID.

Details

Set the sound size of the stream, the local user can control the playback volume of the audio stream.

  • When to call: after called [startPlayingStream].
  • Related APIs: [setAllPlayStreamVolume] Set all stream volume.
  • Caution: You need to reset after [stopPlayingStream] and [startPlayingStream]. This function and the [setAllPlayStreamVolume] function overwrite each other, and the last call takes effect.
  • Available since: 1.16.0
  • Restrictions: None.

setAllPlayStreamVolume:

setAllPlayStreamVolume:
- (void)setAllPlayStreamVolume:(int) volume;
Sets the all stream playback volume.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
volumeintVolume percentage. The value ranges from 0 to 200, and the default value is 100.

Details

Set the sound size of the stream, the local user can control the playback volume of the audio stream.

  • When to call: after called [startPlayingStream].
  • Related APIs: [setPlayVolume] Set the specified streaming volume.
  • Caution: Set the specified streaming volume and [setAllPlayStreamVolume] interface to override each other, and the last call takes effect.
  • Available since: 2.3.0
  • Restrictions: None.

setPlayStreamVideoType:streamID:

setPlayStreamVideoType:streamID:
- (void)setPlayStreamVideoType:(ZegoVideoStreamType) streamType streamID:(NSString *) streamID;
Set play video stream type.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
streamTypeZegoVideoStreamTypeVideo stream type.
streamIDNSString *Stream ID.

Details

When the publish stream sets the codecID to SVC through [setVideoConfig], the puller can dynamically set and select different stream types (small resolution is one-half of the standard layer).

  • Use cases: In general, when the network is weak or the rendered UI window is small, you can choose to pull videos with small resolutions to save bandwidth.
  • When to call: before or after called [startPlayingStream].
  • Available since: 2.3.0
  • Restrictions: None.

setPlayStreamBufferIntervalRange:min:max:

setPlayStreamBufferIntervalRange:min:max:
- (void)setPlayStreamBufferIntervalRange:(NSString *) streamID min:(unsigned int) min max:(unsigned int) max;
Set the adaptive adjustment interval range of the buffer for playing stream.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
streamIDNSString *Stream ID.
minunsigned intThe lower limit of the buffer adaptation interval, in milliseconds. The default value is 0ms.
maxunsigned intThe upper limit of the buffer adaptation interval, in milliseconds. The default value is 4000ms.

Details

Set the range of adaptive adjustment of the internal buffer of the sdk when streaming is 0-4000ms.

  • Use cases: Generally, in the case of a poor network environment, adjusting and increasing the playback buffer of the pull stream will significantly reduce the audio and video freezes, but will increase the delay.
  • When to call: after called [createEngine], if it has been set, you need to reset it every time you play the stream again.
  • Caution: When the upper limit of the cache interval set by the developer exceeds 4000ms, the value will be 4000ms. When the upper limit of the cache interval set by the developer is less than the lower limit of the cache interval, the upper limit will be automatically set as the lower limit.
  • Available since: 2.1.0
  • Restrictions: None.

setPlayStreamFocusOn:

setPlayStreamFocusOn:
- (void)setPlayStreamFocusOn:(NSString *) streamID;
Set the weight of the pull stream priority.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
streamIDNSString *Stream ID.

Details

Set the weight of the streaming priority.

  • Use cases: This interface can be used when developers need to prioritize the quality of a audio and video stream in business(do not use in pure audio case). For example: in class scene, if students pull multiple streams, you can set high priority for teacher stream.
  • When to call: after called [startPlayingStream].
  • Caution: By default, all streams have the same weight. Only one stream can be set with high priority, whichever is set last. After the flow is stopped, the initial state is automatically restored, and all flows have the same weight.When the local network is not good, while ensuring the focus flow, other stalls may be caused more.
  • Available since: 1.1.0
  • Restrictions: None.

mutePlayStreamAudio:streamID:

mutePlayStreamAudio:streamID:
- (void)mutePlayStreamAudio:(BOOL) mute streamID:(NSString *) streamID;
Whether the pull stream can receive the specified audio data.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
muteBOOLWhether it can receive the audio data of the specified remote user when streaming, "true" means prohibition, "false" means receiving, the default value is "false".
streamIDNSString *Stream ID.

Details

In the process of real-time audio and video interaction, local users can use this function to control whether to receive audio data from designated remote users when pulling streams as needed. When the developer does not receive the audio receipt, the hardware and network overhead can be reduced.

  • Use cases: Call this function when developers need to quickly close and restore remote audio. Compared to re-flow, it can greatly reduce the time and improve the interactive experience.
  • When to call: This function can be called after calling [createEngine].
  • Caution:
  1. When used together with [muteAllPlayAudioStreams], they can override each other's configurations.
  2. When used together with [muteAllPlayStreamAudio], this function only works when the [muteAllPlayStreamAudio] function is set to false.
  3. After stopping streaming, any properties previously set for this stream such as [setPlayVolume], [mutePlayStreamAudio], [mutePlayStreamVideo] and other streaming-related configurations will become invalid and need to be reset before the next stream is pulled.
  • Related APIs: You can call the [muteAllPlayStreamAudio] function to control whether to receive all audio data. When the two functions [muteAllPlayStreamAudio] and [mutePlayStreamAudio] are set to false at the same time, the local user can receive the audio data of the remote user when the stream is pulled: 1. When the [muteAllPlayStreamAudio(true)] function is called, it is globally effective, that is, local users will be prohibited from receiving all remote users' audio data. At this time, the [mutePlayStreamAudio] function will not take effect whether it is called before or after [muteAllPlayStreamAudio].2. When the [muteAllPlayStreamAudio(false)] function is called, the local user can receive the audio data of all remote users. At this time, the [mutePlayStreamAudio] function can be used to control whether to receive a single audio data. Calling the [mutePlayStreamAudio(true, streamID)] function allows the local user to receive audio data other than the streamID; calling the [mutePlayStreamAudio(false, streamID)] function allows the local user to receive all audio data.
  • Available since: 1.1.0

mutePlayStreamVideo:streamID:

mutePlayStreamVideo:streamID:
- (void)mutePlayStreamVideo:(BOOL) mute streamID:(NSString *) streamID;
Whether the pull stream can receive the specified video data.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
muteBOOLWhether it is possible to receive the video data of the specified remote user when streaming, "true" means prohibition, "false" means receiving, the default value is "false". The default value for automatically played streams within the SDK is false.
streamIDNSString *Stream ID.

Details

In the process of real-time video and video interaction, local users can use this function to control whether to receive video data from designated remote users when pulling streams as needed. When the developer does not receive the video data, the hardware and network overhead can be reduced.

  • Use cases: This function can be called when developers need to quickly close and resume watching remote video. Compared to re-flow, it can greatly reduce the time and improve the interactive experience.
  • When to call: This function can be called after calling [createEngine].
  • Caution:
  1. When used together with [muteAllPlayVideoStreams], they can override each other's configurations.
  2. When used together with [muteAllPlayStreamAudio], this function only works when the [muteAllPlayStreamVideo] function is set to false.
  3. When you mute the video stream, the view remains at the last frame by default, if you need to clear the last frame, please contact ZEGO technical support.
  4. After stopping streaming, any properties previously set for this stream such as [setPlayVolume], [mutePlayStreamAudio], [mutePlayStreamVideo] and other streaming-related configurations will become invalid and need to be reset before the next stream is pulled.
  • Related APIs: You can call the [muteAllPlayStreamVideo] function to control whether to receive all video data. When the two functions [muteAllPlayStreamVideo] and [mutePlayStreamVideo] are set to false at the same time, the local user can receive the video data of the remote user when the stream is pulled: 1. When the [muteAllPlayStreamVideo(true)] function is called, it will take effect globally, that is, local users will be prohibited from receiving all remote users' video data. At this time, the [mutePlayStreamVideo] function will not take effect whether it is called before or after [muteAllPlayStreamVideo]. 2. When the [muteAllPlayStreamVideo(false)] function is called, the local user can receive the video data of all remote users. At this time, the [mutePlayStreamVideo] function can be used to control whether to receive a single video data. Call the [mutePlayStreamVideo(true, streamID)] function, the local user can receive other video data other than the streamID; call the [mutePlayStreamVideo(false, streamID)] function, the local user can receive all the video data.
  • Available since: 1.1.0

muteAllPlayStreamAudio:

muteAllPlayStreamAudio:
- (void)muteAllPlayStreamAudio:(BOOL) mute;
Can the pull stream receive all audio data. (When set to true, calling [mutePlayStreamAudio] will not take effect)
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
muteBOOLWhether it is possible to receive audio data from all remote users when streaming, "true" means prohibition, "false" means receiving, and the default value is "false".

Details

In the process of real-time audio and video interaction, local users can use this function to control whether to receive audio data from all remote users when pulling streams (including the audio streams pushed by users who have newly joined the room after calling this function). By default, users can receive audio data pushed by all remote users after joining the room. When the developer does not receive the audio receipt, the hardware and network overhead can be reduced.

  • Use cases: Call this function when developers need to quickly close and restore remote audio. Compared to re-flow, it can greatly reduce the time and improve the interactive experience.
  • When to call: This function can be called after calling [createEngine].
  • Caution: This function cannot be used together with [muteAllPlayAudioStreams] throughout the SDK lifecycle.
  • Related APIs: You can call the [mutePlayStreamAudio] function to control whether to receive a single piece of audio data. When the two functions [muteAllPlayStreamAudio] and [mutePlayStreamAudio] are set to false at the same time, the local user can receive the audio data of the remote user when the stream is pulled: 1. When the [muteAllPlayStreamAudio(true)] function is called, it takes effect globally, that is, local users will be prohibited from receiving audio data from all remote users. At this time, the [mutePlayStreamAudio] function will not take effect no matter if the [mutePlayStreamAudio] function is called before or after [muteAllPlayStreamAudio]. 2. When the [muteAllPlayStreamAudio(false)] function is called, the local user can receive the audio data of all remote users. At this time, the [mutePlayStreamAudio] function can be used to control whether to receive a single audio data. Calling the [mutePlayStreamAudio(true, streamID)] function allows the local user to receive audio data other than the streamID; calling the [mutePlayStreamAudio(false, streamID)] function allows the local user to receive all audio data.
  • Available since: 2.4.0

muteAllPlayAudioStreams:

muteAllPlayAudioStreams:
- (void)muteAllPlayAudioStreams:(BOOL) mute;
Can the pull stream receive all audio data.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
muteBOOLWhether it is possible to receive audio data from all remote users when streaming, "true" means prohibition, "false" means receiving, and the default value is "false".

Details

In the process of real-time audio and video interaction, local users can use this function to control whether to receive audio data from all remote users when pulling streams (including the audio streams pushed by users who have newly joined the room after calling this function). By default, users can receive audio data pushed by all remote users after joining the room. When the developer does not receive the audio receipt, the hardware and network overhead can be reduced.

  • Use cases: Call this function when developers need to quickly close and restore remote audio. Compared to re-flow, it can greatly reduce the time and improve the interactive experience.
  • When to call: This function can be called after calling [createEngine].
  • Caution: This function cannot be used together with [muteAllPlayStreamAudio] throughout the SDK lifecycle.
  • Related APIs: You can call the [mutePlayStreamAudio] function to control whether to receive a single piece of audio data. When the two functions [muteAllPlayStreamAudio] and [mutePlayStreamAudio] are set to false at the same time, the local user can receive the audio data of the remote user when the stream is pulled: 1. When the [muteAllPlayStreamAudio(true)] function is called, it takes effect globally, that is, local users will be prohibited from receiving audio data from all remote users. At this time, the [mutePlayStreamAudio] function will not take effect no matter if the [mutePlayStreamAudio] function is called before or after [muteAllPlayStreamAudio]. 2. When the [muteAllPlayStreamAudio(false)] function is called, the local user can receive the audio data of all remote users. At this time, the [mutePlayStreamAudio] function can be used to control whether to receive a single audio data. Calling the [mutePlayStreamAudio(true, streamID)] function allows the local user to receive audio data other than the streamID; calling the [mutePlayStreamAudio(false, streamID)] function allows the local user to receive all audio data.
  • Available since: 3.10.0

muteAllPlayStreamVideo:

muteAllPlayStreamVideo:
- (void)muteAllPlayStreamVideo:(BOOL) mute;
Can the pull stream receive all video data. (When set to true, calling [mutePlayStreamVideo] will not take effect)
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
muteBOOLWhether it is possible to receive all remote users' video data when streaming, "true" means prohibition, "false" means receiving, and the default value is "false".

Details

In the process of real-time video and video interaction, local users can use this function to control whether to receive all remote users' video data when pulling the stream (including the video stream pushed by the new user who joins the room after calling this function). By default, users can receive video data pushed by all remote users after joining the room. When the developer does not receive the video data, the hardware and network overhead can be reduced.

  • Use cases: This function can be called when developers need to quickly close and resume watching remote video. Compared to re-flow, it can greatly reduce the time and improve the interactive experience.
  • When to call: This function can be called after calling [createEngine].
  • Caution:
  1. This function cannot be used together with [muteAllPlayVideoStreams] throughout the SDK lifecycle.
  2. When you mute the video stream, the view remains at the last frame by default, if you need to clear the last frame, please contact ZEGO technical support.
  • Related APIs: You can call the [mutePlayStreamVideo] function to control whether to receive a single piece of video data. When the two functions [muteAllPlayStreamVideo] and [mutePlayStreamVideo] are set to false at the same time, the local user can receive the video data of the remote user when the stream is pulled: 1. When the [muteAllPlayStreamVideo(true)] function is called, it will take effect globally, that is, the local user will be prohibited from receiving all remote users' video data. At this time, the [mutePlayStreamVideo] function will not take effect whether it is called before or after [muteAllPlayStreamVideo]. 2. When the [muteAllPlayStreamVideo(false)] function is called, the local user can receive the video data of all remote users. At this time, the [mutePlayStreamVideo] function can be used to control whether to receive a single video data. Call the [mutePlayStreamVideo(true, streamID)] function, the local user can receive other video data other than the streamID; call the [mutePlayStreamVideo(false, streamID)] function, the local user can receive all the video data.
  • Available since: 2.4.0

muteAllPlayVideoStreams:

muteAllPlayVideoStreams:
- (void)muteAllPlayVideoStreams:(BOOL) mute;
Can the pull stream receive all video data.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
muteBOOLWhether it is possible to receive all remote users' video data when streaming, "true" means prohibition, "false" means receiving, and the default value is "false".

Details

In the process of real-time video and video interaction, local users can use this function to control whether to receive all remote users' video data when pulling the stream (including the video stream pushed by the new user who joins the room after calling this function). By default, users can receive video data pushed by all remote users after joining the room. When the developer does not receive the video data, the hardware and network overhead can be reduced.

  • Use cases: This function can be called when developers need to quickly close and resume watching remote video. Compared to re-flow, it can greatly reduce the time and improve the interactive experience.
  • When to call: This function can be called after calling [createEngine].
  • Caution:
  1. This function cannot be used together with [muteAllPlayStreamVideo] throughout the SDK lifecycle.
  2. When you mute the video stream, the view remains at the last frame by default, if you need to clear the last frame, please contact ZEGO technical support.
  • Related APIs: You can call the [mutePlayStreamVideo] function to control whether to receive a single piece of video data.
  • Available since: 3.10.0

enableHardwareDecoder:

enableHardwareDecoder:
- (void)enableHardwareDecoder:(BOOL) enable;
Enables or disables hardware decoding.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
enableBOOLWhether to turn on hardware decoding switch, true: enable hardware decoding, false: disable hardware decoding.

Details

Control whether hardware decoding is used when playing streams, with hardware decoding enabled the SDK will use the GPU for decoding, reducing CPU usage.

  • Use cases: If developers find that the device heats up badly when playing large resolution audio and video streams during testing on some models, consider calling this function to enable hardware decoding.
  • Default value: Hardware decoding is disabled by default when this interface is not called.
  • When to call: This function needs to be called after [createEngine] creates an instance.
  • Caution: Need to be called before calling [startPlayingStream], if called after playing the stream, it will only take effect after stopping the stream and re-playing it. Once this configuration has taken effect, it will remain in force until the next call takes effect.
  • Available since: 1.1.0
  • Restrictions: None.

enableCheckPoc:

enableCheckPoc:
- (void)enableCheckPoc:(BOOL) enable;
Enables or disables frame order detection.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
enableBOOLWhether to turn on frame order detection, true: enable check poc, false: disable check poc.

Details

Control whether to turn on frame order detection.

  • Use cases: Turning on frame order detection when pulling cdn's stream will prevent splash screens.
  • Default value: Turn on frame order detection by default when this interface is not called.
  • When to call: This function needs to be called after [createEngine] creates an instance.
  • Caution: Turn off frame order detection during playing stream may result in a brief splash screen.
  • Available since: 1.1.0
  • Restrictions: None.

isVideoDecoderSupported:

isVideoDecoderSupported:
- (BOOL)isVideoDecoderSupported:(ZegoVideoCodecID) codecID;
Whether the specified video decoding format is supported.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
codecIDZegoVideoCodecIDVideo codec id.Required: Yes.

Details

Whether the specified video decoding is supported depends on the following aspects: whether the hardware model supports hard decoding, whether the performance of the hardware model supports soft decoding, and whether the SDK includes the decoding module.

  • When to call: After creating the engine.
  • Caution: It is recommended that users call this interface to obtain the H.265 decoding support capability before pulling the H.265 stream. If it is not supported, the user can pull the stream of other encoding formats, such as H.264.
  • Available since: 2.12.0

Return

Whether the specified video decoding format is supported; true means supported, you can use this decoding format for playing stream; false means not supported, the SDK does not recommend users to play streams of this encoding format. If users force the play, low frame rates may occur.

isVideoDecoderSupported:codecBackend:

isVideoDecoderSupported:codecBackend:
- (int)isVideoDecoderSupported:(ZegoVideoCodecID) codecID codecBackend:(ZegoVideoCodecBackend) codecBackend;
Whether the specified video decoding format is supported.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
codecIDZegoVideoCodecIDVideo codec id. Required: Yes.
codecBackendZegoVideoCodecBackendBackend implementation of decoder. Required: Yes.

Details

Whether the specified video decoding is supported depends on the following aspects: whether the hardware model supports hard decoding, whether the performance of the hardware model supports soft decoding, and whether the SDK includes the decoding module.

  • When to call: After creating the engine.
  • Caution: It is recommended that users call this interface to obtain the H.265 decoding support capability before pulling the H.265 stream. If it is not supported, the user can pull the stream of other encoding formats, such as H.264.
  • Available since: 3.0.0

Return

Whether the specified video decoding format is supported; 0 means not supported, and the decoding format cannot be used for play stream; 1 means support, you can use this decoding format for playing stream; 2 means not confirmed, it is recommended to call this interface later.

getVideoDecoderSupported:codecBackend:callback:

getVideoDecoderSupported:codecBackend:callback:
- (void)getVideoDecoderSupported:(ZegoVideoCodecID) codecID codecBackend:(ZegoVideoCodecBackend) codecBackend callback:(nullable ZegoPlayerGetVideoDecoderSupportedCallback) callback;
Whether the specified video decoding type and implementation are supported.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
codecIDZegoVideoCodecIDVideo codec id. Required: Yes.
codecBackendZegoVideoCodecBackendBackend implementation of decoder. Required: Yes.
callbacknullable ZegoPlayerGetVideoDecoderSupportedCallbackResults of get video decoder supported.

Details

Whether the specified video decoding is supported depends on the following aspects: whether the hardware model supports hard decoding, whether the performance of the hardware model supports soft decoding, and whether the SDK includes the decoding module.

  • When to call: After creating the engine.
  • Caution: It is recommended that users call this interface to obtain the H.265 decoding support capability before pulling the H.265 stream. If it is not supported, the user can pull the stream of other encoding formats, such as H.264.
  • Available since: 3.23.0

setPlayStreamsAlignmentProperty:

setPlayStreamsAlignmentProperty:
- (void)setPlayStreamsAlignmentProperty:(ZegoStreamAlignmentMode) mode;
Set the play stream alignment properties.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
modeZegoStreamAlignmentModeSetting the stream alignment mode.

Details

When playing at the streaming end, control whether the playing RTC stream needs to be accurately aligned. If necessary, all the streams that contain precise alignment parameters will be aligned; if not, all streams are not aligned. Use case: It is often used in scenes that require to play multiple streams alignment such as KTV to ensure that users can switch between singing anchors, ordinary Maishangyu chat anchors, and Maixia audiences at any time during use.

  • Default value: If this interface is not called, the default is not aligned.
  • When to call: Called after [createEngine]. Call the interface repeatedly, and the latest setting is valid.
  • Related APIs: Set the precise alignment parameter of the stream channel [setStreamAlignmentProperty].
  • Available since: 2.14.0

enableVideoSuperResolution:enable:

enableVideoSuperResolution:enable:
- (void)enableVideoSuperResolution:(NSString *) streamID enable:(BOOL) enable;
Enable video super resolution.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
streamIDNSString *The ID of the stream that currently needs to turn on or off overscore.
enableBOOLWhether to enable super resolution, it is not enabled by default.

Details

Whether to enable video super resolution when playing stream, the resolution of the played video can be doubled at the stream playing end through video super resolution. For example, the original resolution is 640x360, and the super-resolution is 1280x720.

  • Use cases: Live streaming scenario.
  • When to call: Video super resolution is only valid for playing stream video. Needs to be called after [initVideoSuperResolution].
  • Caution:
  1. This function requires a special package, please contact ZEGO technical support;
  2. This function will consume extra system resources. In order to ensure user experience, ZEGO can only enable video super resolution for one stream, and the original video resolution is not recommended to exceed 640 × 360.
  • Related callbacks: Developer can use the [onPlayerVideoSuperResolutionUpdate] callback to monitor the video super resolution status change.
  • Available since: 3.0.0

initVideoSuperResolution

initVideoSuperResolution
- (void)initVideoSuperResolution;
Init video super resolution.
Declared in ZegoExpressEngine.h

After the super resolution is initialized, the super resolution function can be used normally

  • Use cases: Live streaming scenario.
  • When to call: Video super resolution is only valid for playing stream video. Needs to be called after [createEngine].
  • Caution:
  1. Initializing the video screen is divided into time-consuming operations, and frequent initialization and de-initialization are not recommended;
  2. This function requires a special package, please contact ZEGO technical support.
  • Available since: 3.3.0

uninitVideoSuperResolution

uninitVideoSuperResolution
- (void)uninitVideoSuperResolution;
Uninit video super resolution.
Declared in ZegoExpressEngine.h

After deinitializing the super resolution, the SDK will release the resources occupied by the super resolution and make the super resolution function unavailable.

  • Use cases: Live streaming scenario.
  • When to call: Needs to be called after [initVideoSuperResolution].
  • Caution: Initializing the video screen is divided into time-consuming operations, and frequent initialization and de-initialization are not recommended.
  • Available since: 3.3.0

updatePlayingCanvas:canvas:

updatePlayingCanvas:canvas:
- (int)updatePlayingCanvas:(NSString *) streamID canvas:(ZegoCanvas *) canvas;
Update playing canvas.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
streamIDNSString *Stream ID, a string of up to 256 characters.
Caution:
Only support numbers, English characters and '-', '_'.
canvasZegoCanvas *The view used to display the play audio and video stream's image. When the view is set to [nil], no video is displayed, only audio is played.

Details

This interface will update playing view. Use case: The user can call this function to update canvas display video.

  • When to call: After calling the [startPlayingStream] interface.
  • Caution: None.
  • Restrictions: None.

Return

Error code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details.

setPlayingCanvas:updateType:canvas:

setPlayingCanvas:updateType:canvas:
- (int)setPlayingCanvas:(NSString *) streamID updateType:(ZegoViewUpdateType) updateType canvas:(ZegoCanvas *) canvas;
Setting up playing canvas.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
streamIDNSString *Stream ID, a string of up to 256 characters.
Caution:
Only support numbers, English characters and '-', '_'.
updateTypeZegoViewUpdateTypeUpdate type.
canvasZegoCanvas *The view used to display the play audio and video stream's image.

Details

This interface can add, delete and update playing view. Use case: The user can call this function to add, delete and update canvas display video.

  • When to call: After calling the [startPlayingStream] interface.
  • Caution: None.
  • Restrictions: None.

Return

Error code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details.

startMixerTask:callback:

startMixerTask:callback:
- (void)startMixerTask:(ZegoMixerTask *) task callback:(nullable ZegoMixerStartCallback) callback;
Starts a stream mixing task.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
taskZegoMixerTask *Mixing task object. Required: Yes.
callbacknullable ZegoMixerStartCallbackStart notification of mixing task results.Required: No. Caution: Passing [nil] means not receiving callback notifications.

Details

Initiate a mixing stream request to the ZEGO RTC server, the server will look for the stream currently being pushed, and mix the layers according to the parameters of the mixing stream task requested by the SDK. When you need to update a mixing task, that is, when the input stream increases or decreases, you need to update the input stream list. At this time, you can update the field of the [ZegoMixerTask] object inputList and call this function again to pass in the same [ZegoMixerTask] object to update the mixing task.

  • Use cases: It is often used when multiple video images are required to synthesize a video using mixed streaming, such as education, live broadcast of teacher and student images.
  • When to call: After calling [loginRoom] to log in to the room.
  • Caution: Due to the performance considerations of the client device, the SDK muxing is to start the mixing task on the ZEGO RTC server for mixing. If an exception occurs when the mixing task is requested to start, for example, the most common mixing input stream does not exist, the error code will be given from the callback callback. If a certain input stream does not exist in the middle, the muxing task will automatically retry to pull this input stream for 90 seconds, and will not retry after 90 seconds. If all input streams no longer exist, the server will automatically stop the mixing task after 90 seconds.
  • Related callbacks: [OnMixerRelayCDNStateUpdate] can be used to obtain the CDN status update notification of the mixed stream repost, and the sound update notification of each single stream in the mixed stream can be obtained through [onMixerSoundLevelUpdate].
  • Related APIs: the mixing task can be stopped by the [stopMixerTask] function.
  • Available since: 1.2.1
  • Restrictions: None.

stopMixerTask:callback:

stopMixerTask:callback:
- (void)stopMixerTask:(ZegoMixerTask *) task callback:(nullable ZegoMixerStopCallback) callback;
Stops a stream mixing task.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
taskZegoMixerTask *Mixing task object. Required: Yes.
callbacknullable ZegoMixerStopCallbackStop stream mixing task result callback notification.Required: No. Caution: Passing [nil] means not receiving callback notifications.

Details

Initiate a request to end the mixing task to the ZEGO RTC server.

  • Use cases: It is often used when multiple video images are required to synthesize a video using mixed streaming, such as education, live broadcast of teacher and student images.
  • When to call: After calling [startMixerTask] to start mixing.
  • Caution: If the developer starts the next mixing task without stopping the previous mixing task, the previous mixing task will not automatically stop until the input stream of the previous mixing task does not exist for 90 seconds. Before starting the next mixing task, you should stop the previous mixing task, so that when an anchor has already started the next mixing task to mix with other anchors, the audience is still pulling the output stream of the previous mixing task.
  • Related APIs: You can start mixing by using the [startMixerTask] function.
  • Available since: 1.2.1
  • Restrictions: None.

startAutoMixerTask:callback:

startAutoMixerTask:callback:
- (void)startAutoMixerTask:(ZegoAutoMixerTask *) task callback:(nullable ZegoMixerStartCallback) callback;
Starts an auto stream mixing task.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
taskZegoAutoMixerTask *Auto mix stream task object
callbacknullable ZegoMixerStartCallbackStart auto mix stream task result callback notification

Details

Local users can use this function to start an auto stream mixing task, all streams in a room wil be mixed. Currently, only audio streams can be mixed. When auto stream mixing is enabled, the audio of all streams in the room is automatically mixed, and any further pushed streams in the room are automatically mixed into the final output stream.

  • Use cases: Often used in voice chat room scenarios.
  • When to call: After the engine is created, user can call this function to enable auto stream mixing in the target room if the target room has already been created
  • Caution: Before starting the next auto stream mixing task in the same room, call [stopAutoMixerTask] function to end the last auto stream mixing task. Otherwise, when one anchor has started the next auto stream mixing task and other anchors have started the next auto stream mixing task, the audience still pulls the output stream of the first auto stream mixing task. If the user does not end the current auto stream mixing task, the task will automatically end after the room does not exist or the input streams do not exist for 90 seconds.
  • Related callbacks: Users can obtain the execution result of the function through [ZegoMixerStartCallback] callback.Users can get automatic mixed flow information through [onAutoMixerSoundLevelUpdate] callback.
  • Related APIs: Users can call [stopAutoMixerTask] function to stop an auto stream mixing task.

stopAutoMixerTask:callback:

stopAutoMixerTask:callback:
- (void)stopAutoMixerTask:(ZegoAutoMixerTask *) task callback:(nullable ZegoMixerStopCallback) callback;
Stops an auto stream mixing task.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
taskZegoAutoMixerTask *Auto mix stream task object
callbacknullable ZegoMixerStopCallbackStop auto mix stream task result callback notification

Details

Local users can use this function to stop an auto stream mixing task.

  • Use cases: Often used in voice chat room scenarios.
  • When to call: Call this function after [startAutoMixerTask] function is called to start an auto stream mixing task.
  • Caution: Before calling [startAutoMixerTask] function to start the next auto stream mixing task in the same room, call this function to end the last auto stream mixing task. Otherwise, when one anchor has started the next auto stream mixing task and other anchors have started the next auto stream mixing task, the audience still pulls the output stream of the first auto stream mixing task. If the user does not end the current auto stream mixing task, the task will automatically end after the room does not exist or the input streams do not exist for 90 seconds.
  • Related callbacks: Users can obtain the execution result of the function through [ZegoMixerStopCallback] callback.
  • Related APIs: Users can call [startAutoMixerTask] function to start an auto stream mixing task.
  • Available since: 2.10.0

muteMicrophone:

muteMicrophone:
- (void)muteMicrophone:(BOOL) mute;
Mutes or unmutes the microphone.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
muteBOOLWhether to mute (disable) the microphone, true: mute (disable) microphone, false: enable microphone.

Details

This function is used to control whether to use the collected audio data. Mute (turn off the microphone) will use the muted data to replace the audio data collected by the device for streaming. At this time, the microphone device will still be occupied. Use case: Users can call this interface by only turning off the human voice collected by the microphone and not turning off the music sound of the media player. This interface affects [onBeforeAudioPrepAudioData].

  • Default value: The default is false, which means no muting.
  • When to call: After creating the engine [createEngine].
  • Related APIs: Developers who want to control whether to use microphone on the UI should use this function to avoid unnecessary performance overhead by using the [enableAudioCaptureDevice]. You can use [isMicrophoneMuted] to check if the microphone is muted.
  • Available since: 1.1.0
  • Restrictions: None.

isMicrophoneMuted

isMicrophoneMuted
- (BOOL)isMicrophoneMuted;
Checks whether the microphone is muted.
Declared in ZegoExpressEngine.h

Used to determine whether the microphone is set to mute.

  • When to call: After creating the engine [createEngine].
  • Related APIs: [muteMicrophone].
  • Available since: 1.1.0
  • Restrictions: None.

Whether the microphone is muted; true: the microphone is muted; false: the microphone is enable (not muted).

muteSpeaker:

muteSpeaker:
- (void)muteSpeaker:(BOOL) mute;
Mutes or unmutes the audio output speaker.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
muteBOOLWhether to mute (disable) speaker audio output, true: mute (disable) speaker audio output, false: enable speaker audio output.

Details

After mute speaker, all the SDK sounds will not play, including playing stream, mediaplayer, etc.

  • Default value: The default is false, which means no muting.
  • When to call: After creating the engine [createEngine].
  • Available since: 1.1.0
  • Restrictions: None.

isSpeakerMuted

isSpeakerMuted
- (BOOL)isSpeakerMuted;
Checks whether the audio output speaker is muted.
Declared in ZegoExpressEngine.h

Used to determine whether the audio output is muted.

  • When to call: After creating the engine [createEngine].
  • Related APIs: [muteSpeaker].
  • Available since: 1.1.0
  • Restrictions: None.

Whether the speaker is muted; true: the speaker is muted; false: the speaker is enable (not muted).

getAudioDeviceList:

getAudioDeviceList:
- (NSArray<ZegoDeviceInfo *> *)getAudioDeviceList:(ZegoAudioDeviceType) deviceType;
Gets a list of audio devices.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
deviceTypeZegoAudioDeviceTypeAudio device type

Details

Only for Windows / macOS / Linux

Return

Audo device List

getDefaultAudioDeviceID:

getDefaultAudioDeviceID:
- (NSString *)getDefaultAudioDeviceID:(ZegoAudioDeviceType) deviceType;
Get the device ID of the default audio device.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
deviceTypeZegoAudioDeviceTypeAudio device type

Details

Only for Windows / macOS / Linux

Return

Default Audio device ID

useAudioDevice:deviceType:

useAudioDevice:deviceType:
- (void)useAudioDevice:(NSString *) deviceID deviceType:(ZegoAudioDeviceType) deviceType;
Chooses to use the specified audio device.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
deviceIDNSString *ID of a device obtained by [getAudioDeviceList]
deviceTypeZegoAudioDeviceTypeAudio device type

Details

Chooses to use the specified audio device.

  • When to call: After creating the engine [createEngine].
  • Available since: 1.1.0
  • Restrictions: Only supports Windows / macOS / Linux

getAudioDeviceVolume:deviceType:

getAudioDeviceVolume:deviceType:
- (int)getAudioDeviceVolume:(NSString *) deviceID deviceType:(ZegoAudioDeviceType) deviceType;
Get volume for the specified audio device.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
deviceIDNSString *ID of a device obtained by [getAudioDeviceList]
deviceTypeZegoAudioDeviceTypeAudio device type

Details

Get volume for the specified audio device. Only for Windows / macOS / Linux

Return

Device volume

setAudioDeviceVolume:deviceType:volume:

setAudioDeviceVolume:deviceType:volume:
- (void)setAudioDeviceVolume:(NSString *) deviceID deviceType:(ZegoAudioDeviceType) deviceType volume:(int) volume;
Set volume for the specified audio device.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
deviceIDNSString *ID of a device obtained by [getAudioDeviceList]
deviceTypeZegoAudioDeviceTypeAudio device type
volumeintDevice volume

Details

The direct operating system device may fail due to system restrictions. Please use [setCaptureVolume] and [setPlayVolume] first to adjust the volume of publish and play streams. Only for Windows / macOS / Linux

startAudioDeviceVolumeMonitor:deviceType:

startAudioDeviceVolumeMonitor:deviceType:
- (void)startAudioDeviceVolumeMonitor:(NSString *) deviceID deviceType:(ZegoAudioDeviceType) deviceType;
Turn on audio device volume monitoring.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
deviceIDNSString *ID of a device obtained by [getAudioDeviceList]
deviceTypeZegoAudioDeviceTypeAudio device type

Details

Starts the audio device volume monitor. When the volume of the device changes, the changed volume will be called back via [onAudioDeviceVolumeChanged].

  • Caution: Currently, only one audio output device and one audio input device are supported to be monitored at the same time. When this API is called multiple times and the same device type is set, the device ID set to this API during the last call will be overwritten.
  • When to call: After creating the engine via [createEngine].
  • Platform differences: Only supports Windows and macOS.
  • Related APIs: When you no longer need to monitor the device volume, please call [stopAudioDeviceVolumeMonitor] to stop monitoring.
  • Available since: 1.1.0

stopAudioDeviceVolumeMonitor:deviceType:

stopAudioDeviceVolumeMonitor:deviceType:
- (void)stopAudioDeviceVolumeMonitor:(NSString *) deviceID deviceType:(ZegoAudioDeviceType) deviceType;
Turn off audio device volume monitoring. Only for Windows/macOS.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
deviceIDNSString *ID of a device obtained by [getAudioDeviceList]
deviceTypeZegoAudioDeviceTypeAudio device type

Details

Stops the audio device volume monitor.

  • When to call: After creating the engine via [createEngine], and when you no longer need to monitor the device volume.
  • Platform differences: Only supports Windows and macOS.
  • Available since: 1.1.0

muteAudioDevice:deviceType:mute:

muteAudioDevice:deviceType:mute:
- (void)muteAudioDevice:(NSString *) deviceID deviceType:(ZegoAudioDeviceType) deviceType mute:(BOOL) mute;
Mutes or unmutes the audio device.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
deviceIDNSString *ID of a device obtained by [getAudioDeviceList]
deviceTypeZegoAudioDeviceTypeAudio device type
muteBOOLWhether to mute the audio device; true means to mute the audio device; false means to unmute the audio device.

Details

Only for Windows / macOS / Linux

setAudioDeviceMode:

setAudioDeviceMode:
- (void)setAudioDeviceMode:(ZegoAudioDeviceMode) deviceMode;
Set the audio device mode.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
deviceModeZegoAudioDeviceModeAudio device mode

Details

Select audio equipment mode according to the need of the scene (only supported by Android and iOS).

  • Use cases: In the case of KTV, the General mode must be used, but in the language room, the Communication2 or Communication3 mode is required in order to avoid the sound of third-party music being collected. For details on how to set the audio device mode, see https://doc-zh.zego.im/faq/AudioDeviceMod?product=ExpressVideo&platform=macos
  • When to call: After creating the engine [createEngine].
  • Caution: This interface triggers startup switchover of the device. You are advised not to invoke this interface frequently to avoid unnecessary overhead and hardware problems. This interface may cause the volume mode to switch between call and media. If the media volume is inconsistent with the call volume, the volume may change.
  • Available since: 2.22.0

isAudioDeviceMuted:deviceType:

isAudioDeviceMuted:deviceType:
- (BOOL)isAudioDeviceMuted:(NSString *) deviceID deviceType:(ZegoAudioDeviceType) deviceType;
Check if the audio device is muted.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
deviceIDNSString *ID of a device obtained by [getAudioDeviceList]
deviceTypeZegoAudioDeviceTypeAudio device type

Details

Only for Windows / macOS / Linux

Return

Whether the audio device is muted; true means the audio device is muted; false means the audio device is not muted.

enableAudioCaptureDevice:

enableAudioCaptureDevice:
- (void)enableAudioCaptureDevice:(BOOL) enable;
Enables or disables the audio capture device.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
enableBOOLWhether to enable the audio capture device, true: enable audio capture device, false: disable audio capture device.

Details

This function is used to control whether to use the audio collection device. When the audio collection device is turned off, the SDK will no longer occupy the audio device. Of course, if the stream is being published at this time, by default, mute data will be used as audio data for streaming. not support Linux.

  • Use cases: When the user never needs to use the audio, you can call this function to close the audio collection.
  • Default value: The default is true.
  • When to call: After creating the engine [createEngine].
  • Related APIs: Turning off or turning on the microphone on the hardware is a time-consuming operation, and there is a certain performance overhead when the user performs frequent operations. [muteMicrophone] is generally recommended.
  • Available since: 1.1.0
  • Restrictions: None.

enableAudioCaptureDeviceAsync:callback:

enableAudioCaptureDeviceAsync:callback:
- (void)enableAudioCaptureDeviceAsync:(BOOL) enable callback:(ZegoAudioCaptureDeviceEnableCallback) callback;
Asynchronous enables or disables the audio capture device.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
enableBOOLWhether to enable the audio capture device, true: enable audio capture device, false: disable audio capture device.
callbackZegoAudioCaptureDeviceEnableCallbackThe callback of this enable or disable result.

Details

This function is used to control whether to use the audio collection device. When the audio collection device is turned off, the SDK will no longer occupy the audio device. Of course, if the stream is being published at this time, by default, mute data will be used as audio data for streaming. not support Linux.

  • Use cases: When the user never needs to use the audio, you can call this function to close the audio collection.
  • Default value: The default is true.
  • When to call: After creating the engine [createEngine].
  • Related APIs: Turning off or turning on the microphone on the hardware is a time-consuming operation, and there is a certain performance overhead when the user performs frequent operations. [muteMicrophone] is generally recommended.
  • Available since: 3.23.0
  • Restrictions: None.

getAudioRouteType

getAudioRouteType
- (ZegoAudioRoute) getAudioRouteType;
get current audio route type.
Declared in ZegoExpressEngine.h

Audio routing refers to the audio output device that an app uses to play audio, and common audio routes are: speakers, handsets, headphones, Bluetooth devices, and so on.

  • When to call: After creating the engine [createEngine].
  • Related APIs: Set audio route to speaker [setAudioRouteToSpeaker].
  • Available since: 1.1.0
  • Restrictions: Not supported under win or mac platforms.

setAudioRouteToSpeaker:

setAudioRouteToSpeaker:
- (void)setAudioRouteToSpeaker:(BOOL) defaultToSpeaker;
Whether to use the built-in speaker to play audio.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
defaultToSpeakerBOOLWhether to use the built-in speaker to play sound, true: use the built-in speaker to play sound, false: use the highest priority audio output device scheduled by the current system to play sound

Details

Whether to use the speaker to play audio, when you choose not to use the built-in speaker to play the sound, the SDK will select the audio output device with the highest current priority to play the sound according to the system schedule, and common audio routes are: handsets, headphones, Bluetooth devices, and so on.

  • When to call: After creating the engine [createEngine].
  • Related APIs: Get the current audio route [getAudioRouteType].
  • Available since: 1.1.0
  • Restrictions: Only switching between the earpiece and the speaker is supported. If it is a Bluetooth headset or a wired headset, it does not support routing to the speaker through this interface.

enableCamera:

enableCamera:
- (void)enableCamera:(BOOL) enable;
Turns on/off the camera.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
enableBOOLWhether to turn on the camera, true: turn on camera, false: turn off camera

Details

This function is used to control whether to start the capture of the camera. After the camera is turned off, the video capture will not be performed. At this time, there will be no video data for local preview and push streaming.

  • Default value: The default is true which means the camera is turned on.
  • When to call: After creating the engine [createEngine].
  • Caution: In the case of using the custom video capture function [enableCustomVideoCapture], since the developer has taken over the video data capture, the SDK is no longer responsible for the video data capture, but this function still affects whether to encode or not. Therefore, when developers use custom video capture, please ensure that the value of this function is true.
  • Available since: 1.1.0
  • Restrictions: None.

enableCamera:channel:

enableCamera:channel:
- (void)enableCamera:(BOOL) enable channel:(ZegoPublishChannel) channel;
Turns on/off the camera (for the specified channel).
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
enableBOOLWhether to turn on the camera, true: turn on camera, false: turn off camera
channelZegoPublishChannelPublishing stream channel

Details

This function is used to control whether to start the capture of the camera. After the camera is turned off, the video capture will not be performed. At this time, there will be no video data for local preview and push streaming.

  • Default value: The default is true which means the camera is turned on.
  • When to call: After creating the engine [createEngine].
  • Caution: In the case of using the custom video capture function [enableCustomVideoCapture], since the developer has taken over the video data capture, the SDK is no longer responsible for the video data capture, but this function still affects whether to encode or not. Therefore, when developers use custom video capture, please ensure that the value of this function is true.
  • Available since: 1.1.0
  • Restrictions: None.

enableCamera:notifyMode:channel:

enableCamera:notifyMode:channel:
- (void)enableCamera:(BOOL) enable notifyMode:(ZegoExpNotifyDeviceStateMode) notifyMode channel:(ZegoPublishChannel) channel;
Turns on/off the camera (for the specified channel).
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
enableBOOLWhether to turn on the camera, true: turn on camera, false: turn off camera
notifyModeZegoExpNotifyDeviceStateModeMode for notifying the local device status.
channelZegoPublishChannelPublishing stream channel

Details

This function is used to control whether to start the capture of the camera. After the camera is turned off, the video capture will not be performed. At this time, there will be no video data for local preview and push streaming.

  • Default value: The default is true which means the camera is turned on.
  • When to call: After creating the engine [createEngine].
  • Caution: In the case of using the custom video capture function [enableCustomVideoCapture], since the developer has taken over the video data capture, the SDK is no longer responsible for the video data capture, but this function still affects whether to encode or not. Therefore, when developers use custom video capture, please ensure that the value of this function is true.
  • Available since: 3.20.0
  • Restrictions: None.

useFrontCamera:

useFrontCamera:
- (void)useFrontCamera:(BOOL) enable;
Switches to the front or the rear camera.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
enableBOOL[ZegoVideoSourceTypeCamera] if or not use front camera, true: use the front camera, false: use the the rear camera.

Details

This function controls whether [ZegoVideoSourceTypeCamera] uses the front camera or the rear camera (only supported by Android and iOS).

  • Default value: The default is true which means the front camera is used.
  • When to call: After creating the engine [createEngine].
  • Caution: When the custom video capture function [enableCustomVideoCapture] is turned on, since the developer has taken over the video data capture, the SDK is no longer responsible for the video data capture, and this function is no longer valid.
  • Available since: 1.1.0
  • Restrictions: None.

useFrontCamera:channel:

useFrontCamera:channel:
- (void)useFrontCamera:(BOOL) enable channel:(ZegoPublishChannel) channel;
Switches to the front or the rear camera (for the specified channel).
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
enableBOOL[ZegoVideoSourceTypeCamera] if or not use front camera, true: use the front camera, false: use the the rear camera.
channelZegoPublishChannelPublishing stream channel.

Details

This function controls whether [ZegoVideoSourceTypeCamera] uses the front camera or the rear camera (only supported by Android and iOS).

  • Default value: The default is true which means the front camera is used.
  • When to call: After creating the engine [createEngine].
  • Caution: When the custom video capture function [enableCustomVideoCapture] is turned on, since the developer has taken over the video data capture, the SDK is no longer responsible for the video data capture, and this function is no longer valid.
  • Available since: 1.1.0
  • Restrictions: None.

isCameraFocusSupported:

isCameraFocusSupported:
- (BOOL)isCameraFocusSupported:(ZegoPublishChannel) channel;
Whether the camera supports focusing.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
channelZegoPublishChannelPublishing stream channel

Details

Whether the camera supports focusing.

  • Trigger: Called after turn on preview [startPreview].
  • Caution: Need to start the camera successfully.
  • Available since: 2.14.0

Return

Whether to support focus, support is true, not support is false.

setCameraFocusMode:channel:

setCameraFocusMode:channel:
- (void)setCameraFocusMode:(ZegoCameraFocusMode) mode channel:(ZegoPublishChannel) channel;
Set the camera focus mode.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
modeZegoCameraFocusModefocus mode.
channelZegoPublishChannelPublishing stream channel

Details

Set the camera focus mode.

  • Trigger: Called after turn on preview [startPreview].
  • Available since: 2.14.0
  • Restrictions: Currently only supports iOS and Android platforms.

setCameraFocusPointInPreviewX:y:channel:

setCameraFocusPointInPreviewX:y:channel:
- (void)setCameraFocusPointInPreviewX:(float) x y:(float) y channel:(ZegoPublishChannel) channel;
Set the focus point in the preview view.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
xfloatNormalized X axis coordinate value, effective value [0,1].
yfloatNormalized Y axis coordinate value, effective value [0,1].
channelZegoPublishChannelPublishing stream channel

Details

Set the focus point in the preview view. (x, y) are the normalized coordinates in the preview view, that is, the ratio of the position of the focus point relative to the preview view and the width and height of the preview view. The upper left corner is (0, 0).

  • Trigger: Called after turn on preview [startPreview].
  • Caution: Every time the camera restarts the acquisition, the settings will become invalid and need to be reset.
  • Available since: 2.14.0
  • Restrictions: Currently only supports iOS and Android platforms.

setCameraExposureMode:channel:

setCameraExposureMode:channel:
- (void)setCameraExposureMode:(ZegoCameraExposureMode) mode channel:(ZegoPublishChannel) channel;
Set the camera exposure mode.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
modeZegoCameraExposureModeExposure mode.
channelZegoPublishChannelPublishing stream channel

Details

Set the camera exposure mode.

  • Trigger: Called after turn on preview [startPreview].
  • Available since: 2.14.0
  • Restrictions: Currently only supports iOS and Android platforms.

setCameraExposurePointInPreviewX:y:channel:

setCameraExposurePointInPreviewX:y:channel:
- (void)setCameraExposurePointInPreviewX:(float) x y:(float) y channel:(ZegoPublishChannel) channel;
Set the exposure point in the preview view.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
xfloatNormalized X axis coordinate value, effective value [0,1].
yfloatNormalized Y axis coordinate value, effective value [0,1].
channelZegoPublishChannelPublishing stream channel

Details

Set the exposure point in the preview view. (x, y) are the normalized coordinates in the preview view, that is, the ratio of the position of the exposure point relative to the preview view and the width and height of the preview view. The upper left corner is (0, 0).

  • Trigger: Called after turn on preview [startPreview].
  • Caution: Every time the camera restarts the acquisition, the settings will become invalid and need to be reset.
  • Available since: 2.14.0
  • Restrictions: Currently only supports iOS and Android platforms.

setCameraExposureCompensation:

setCameraExposureCompensation:
- (void)setCameraExposureCompensation:(float) value;
Set the camera exposure compensation value.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
valuefloatCamera exposure, the value range is [-1,1], the default 0, -1 tends to darken, 1 tends to brighten.

Details

Set the camera exposure compensation value.

  • Use cases: User can call this function to set the camera exposure compensation value.
  • When to call /Trigger: Called this function after calling [startPublishingStream] or [startPreview].
  • Caution: The setting will be invalid when the camera is restarted.
  • Platform differences: Only supports iOS and Android.
  • Available since: 2.10.0
  • Restrictions: None.

setCameraExposureCompensation:channel:

setCameraExposureCompensation:channel:
- (void)setCameraExposureCompensation:(float) value channel:(ZegoPublishChannel) channel;
Set the camera exposure compensation value and support spedifying the publish channel.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
valuefloatCamera exposure, the value range is [-1,1], the default 0, -1 tends to darken, 1 tends to brighten.
channelZegoPublishChannelPublishing stream channel

Details

Set the camera exposure compensation value.

  • Use cases: User can call this function to set the camera exposure compensation value.
  • When to call /Trigger: Called this function after calling [startPublishingStream] or [startPreview].
  • Caution: The setting will be invalid when the camera is restarted.
  • Platform differences: Only supports iOS and Android.
  • Available since: 2.10.0
  • Restrictions: None.

setCameraZoomFactor:

setCameraZoomFactor:
- (void)setCameraZoomFactor:(float) factor;
Set the zoom factor of the camera. Every time the camera is restarted, the camera zoom factor will return to the initial value (1.0).
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
factorfloatThe zoom factor of the camera, the minimum value is 1.0, and the maximum value is the return value of [getCameraMaxZoomFactor].

Details

Set the camera zoom factor. Every time the camera is restarted, the camera zoom factor will be restored to its initial value.

  • When to call: After creating the engine [createEngine].
  • Available since: 1.20.0
  • Restrictions: The settings will not take effect until the camera is started.

setCameraZoomFactor:channel:

setCameraZoomFactor:channel:
- (void)setCameraZoomFactor:(float) factor channel:(ZegoPublishChannel) channel;
Set 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).
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
factorfloatThe zoom factor of the camera, the minimum value is 1.0, and the maximum value is the return value of [getCameraMaxZoomFactor].
channelZegoPublishChannelPublishing stream channel

Details

Set the camera zoom factor. Every time the camera is restarted, the camera zoom factor will be restored to its initial value.

  • When to call: After creating the engine [createEngine].
  • Available since: 1.20.0
  • Restrictions: The settings will not take effect until the camera is started.

getCameraMaxZoomFactor

getCameraMaxZoomFactor
- (float)getCameraMaxZoomFactor;
Get the maximum zoom factor of the camera.
Declared in ZegoExpressEngine.h

Set the camera zoom factor. Every time the camera is restarted, the camera zoom factor will be restored to its initial value.

  • When to call: This is only available after the camera has been successfully started, and can generally be called when the captured first frame is received [onPublisherCapturedVideoFirstFrame] callback.
  • Available since: 1.20.0
  • Restrictions: None.

The maximum zoom factor of the camera.

getCameraMaxZoomFactor:

getCameraMaxZoomFactor:
- (float)getCameraMaxZoomFactor:(ZegoPublishChannel) channel;
Get the maximum zoom factor of the camera and support specifying the publish channel.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
channelZegoPublishChannelPublishing stream channel

Details

Set the camera zoom factor. Every time the camera is restarted, the camera zoom factor will be restored to its initial value.

  • When to call: This is only available after the camera has been successfully started, and can generally be called when the captured first frame is received [onPublisherCapturedVideoFirstFrame] callback.
  • Available since: 1.20.0
  • Restrictions: None.

Return

The maximum zoom factor of the camera.

enableCameraAdaptiveFPS:minFPS:maxFPS:channel:

enableCameraAdaptiveFPS:minFPS:maxFPS:channel:
- (void)enableCameraAdaptiveFPS:(BOOL) enable minFPS:(int) minFPS maxFPS:(int) maxFPS channel:(ZegoPublishChannel) channel;
Enable camera adaptive frame rate.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
enableBOOLWhether to enable camera adaptive frame rate. true means on, false means off.Off by default.
minFPSintDesired minimum frame rate, 15 recommended. Unit: fps.
maxFPSintDesired minimum frame rate, 25 recommended. Unit: fps.
channelZegoPublishChannelPublishing stream channel.

Details

After enabling, the SDK matches the capture frame rate range supported by the camera according to the set frame rate range, and dynamically adjusts the capture frame rate of the camera according to the ambient brightness within this range to improve the screen brightness when the set frame rate is too high.

  • Use cases: The frame rate set by the user on the streaming end is too high, and the ambient lighting is low, so the subject cannot be displayed or recognized normally. For example, live broadcast scenes with high exposure requirements.
  • When to call: After creating the engine [createEngine], before the camera starts.
  • Caution: Takes When calling [setVideoConfig] to set the frame rate lower than the expected minimum frame rate, the frame rate value set by [setVideoConfig] will be used. Due to the different hardware and algorithm strategies of different mobile phone manufacturers, the effect of this interface is different on different models or on the front and rear cameras of the same model.
  • Related APIs: Through [setVideoConfig], you can set the camera capture frame rate and the encoder encoding frame rate.
  • Available since: 2.20.0

useVideoDevice:

useVideoDevice:
- (void)useVideoDevice:(NSString *) deviceID;
Chooses to use the specified video device.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
deviceIDNSString *ID of a device obtained by [getVideoDeviceList]

Details

Only for Windows / macOS / Linux

useVideoDevice:channel:

useVideoDevice:channel:
- (void)useVideoDevice:(NSString *) deviceID channel:(ZegoPublishChannel) channel;
Chooses to use the specified video device (for the specified channel).
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
deviceIDNSString *ID of a device obtained by [getVideoDeviceList]
channelZegoPublishChannelPublishing stream channel

Details

Only for Windows / macOS / Linux

getVideoDeviceList

getVideoDeviceList
- (NSArray<ZegoDeviceInfo *> *)getVideoDeviceList;
Gets a list of video devices.
Declared in ZegoExpressEngine.h

Only for Windows / macOS / Linux

Video device List

getDefaultVideoDeviceID

getDefaultVideoDeviceID
- (NSString *)getDefaultVideoDeviceID;
Get the device ID of the default video device.
Declared in ZegoExpressEngine.h

Only for Windows / macOS / Linux

Default video device ID

startSoundLevelMonitor

startSoundLevelMonitor
- (void)startSoundLevelMonitor;
Starts sound level monitoring.
Declared in ZegoExpressEngine.h

After starting monitoring, you can receive local audio sound level via [onCapturedSoundLevelUpdate] callback, and receive remote audio sound level via [onRemoteSoundLevelUpdate] callback. Before entering the room, you can call [startPreview] with this function and combine it with [onCapturedSoundLevelUpdate] callback to determine whether the audio device is working properly.

  • Use cases: During the publishing and playing process, determine who is talking on the wheat and do a UI presentation, in the host K song scene, has been published or played under the premise that the host or audience to see the tone and volume change animation.
  • When to call: After the engine is created [createEngine].
  • Caution: 1. [onCapturedSoundLevelUpdate] and [onRemoteSoundLevelUpdate] callback notification period is 100 ms. 2. After the sound monitoring is started, even if the local audio capture is not started, [onCapturedSoundLevelUpdate] will have a callback, and the sound level is 0.
  • Available since: 1.1.0

startSoundLevelMonitor:

startSoundLevelMonitor:
- (void)startSoundLevelMonitor:(unsigned int) millisecond;
Starts sound level monitoring. Support setting the listening interval.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
millisecondunsigned intMonitoring time period of the sound level, in milliseconds, has a value range of [100, 3000]. Default is 100 ms.

Details

After starting monitoring, you can receive local audio sound level via [onCapturedSoundLevelUpdate] callback, and receive remote audio sound level via [onRemoteSoundLevelUpdate] callback. Before entering the room, you can call [startPreview] with this function and combine it with [onCapturedSoundLevelUpdate] callback to determine whether the audio device is working properly.

  • Use cases: During the publishing and playing process, determine who is talking on the wheat and do a UI presentation.
  • When to call: After the engine is created [createEngine].
  • Caution: 1. [onCapturedSoundLevelUpdate] and [onRemoteSoundLevelUpdate] callback notification period is the value set by the parameter. If you want to use advanced feature of sound level, please use the function of the same name (the parameter type is ZegoSoundLevelConfig) instead. 2. After the sound monitoring is started, even if the local audio capture is not started, [onCapturedSoundLevelUpdate] will have a callback, and the sound level is 0.
  • Available since: 1.15.0

startSoundLevelMonitorWithConfig::

startSoundLevelMonitorWithConfig::
- (void)startSoundLevelMonitorWithConfig:(ZegoSoundLevelConfig *) config;
Starts sound level monitoring. Support enable some advanced feature.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
configZegoSoundLevelConfig *Configuration for starts the sound level monitor.

Details

After starting monitoring, you can receive local audio sound level via [onCapturedSoundLevelUpdate] callback, and receive remote audio sound level via [onRemoteSoundLevelUpdate] callback. Before entering the room, you can call [startPreview] with this function and combine it with [onCapturedSoundLevelUpdate] callback to determine whether the audio device is working properly.

  • Use cases: During the publishing and playing process, determine who is talking on the wheat and do a UI presentation.
  • When to call: After the engine is created [createEngine].
  • Caution: 1. [onCapturedSoundLevelUpdate] and [onRemoteSoundLevelUpdate] callback notification period is the value set by the parameter. 2. After the sound monitoring is started, even if the local audio capture is not started, [onCapturedSoundLevelUpdate] will have a callback, and the sound level is 0.
  • Available since: 2.10.0

stopSoundLevelMonitor

stopSoundLevelMonitor
- (void)stopSoundLevelMonitor;
Stops sound level monitoring.
Declared in ZegoExpressEngine.h

After the monitoring is stopped, the callback of the local/remote audio sound level will be stopped.

  • When to call: After the engine is created [createEngine].
  • Related APIs: Soundwave monitoring can be initiated via [startSoundLevelMonitor].
  • Available since: 1.1.0

startAudioSpectrumMonitor

startAudioSpectrumMonitor
- (void)startAudioSpectrumMonitor;
Starts audio spectrum monitoring.
Declared in ZegoExpressEngine.h

After starting monitoring, you can receive local audio spectrum via [onCapturedAudioSpectrumUpdate] callback, and receive remote audio spectrum via [onRemoteAudioSpectrumUpdate] callback.

  • Use cases: In the host K song scene, has been published or played under the premise that the host or audience to see the tone and volume change animation.
  • When to call: After the engine is created [createEngine].
  • Caution: [onCapturedAudioSpectrumUpdate] and [onRemoteAudioSpectrumUpdate] callback notification period is 100 ms.
  • Available since: 1.1.0

startAudioSpectrumMonitor:

startAudioSpectrumMonitor:
- (void)startAudioSpectrumMonitor:(unsigned int) millisecond;
Starts audio spectrum monitoring. Support setting the listening interval.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
millisecondunsigned intMonitoring time period of the audio spectrum, in milliseconds, the minimum value is 10. Default is 500 ms.

Details

After starting monitoring, you can receive local audio spectrum via [onCapturedAudioSpectrumUpdate] callback, and receive remote audio spectrum via [onRemoteAudioSpectrumUpdate] callback.

  • Use cases: In the host K song scene, has been published or played under the premise that the host or audience to see the tone and volume change animation.
  • When to call: After the engine is created [createEngine].
  • Caution: [onCapturedAudioSpectrumUpdate] and [onRemoteAudioSpectrumUpdate] callback notification period is the value set by the parameter.
  • Available since: 1.15.0

stopAudioSpectrumMonitor

stopAudioSpectrumMonitor
- (void)stopAudioSpectrumMonitor;
Stops audio spectrum monitoring.
Declared in ZegoExpressEngine.h

After the monitoring is stopped, the callback of the local/remote audio spectrum will be stopped.

  • When to call: After the engine is created [createEngine].
  • Related APIs: Audio spectrum monitoring can be initiated via [startAudioSpectrumMonitor].
  • Available since: 1.1.0

enableHeadphoneMonitor:

enableHeadphoneMonitor:
- (void)enableHeadphoneMonitor:(BOOL) enable;
Enables or disables headphone monitoring.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
enableBOOLWhether to use headphone monitor, true: enable, false: disable

Details

Enable/Disable headphone monitor, and users hear their own voices as they use the microphone to capture sounds.

  • When to call: After the engine is created [createEngine].
  • Default value: Disable.
  • Caution: 1. This setting does not actually take effect until both the headset and microphone are connected. 2. The default is to return after acquisition and before pre-processing. If you need to return after pre-processing, please contact ZEGO technical support.
  • Available since: 1.9.0

setHeadphoneMonitorVolume:

setHeadphoneMonitorVolume:
- (void)setHeadphoneMonitorVolume:(int) volume;
Sets the headphone monitor volume.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
volumeintheadphone monitor volume, range from 0 to 200, 60 as default.

Details

set headphone monitor volume.

  • When to call: After the engine is created [createEngine].
  • Caution: This setting does not actually take effect until both the headset and microphone are connected.
  • Related APIs: Enables or disables headphone monitoring via [enableHeadphoneMonitor].
  • Available since: 1.9.0

enableMixSystemPlayout:

enableMixSystemPlayout:
- (void)enableMixSystemPlayout:(BOOL) enable;
Enable or disable system audio capture.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
enableBOOLWhether to mix system playout.

Details

Enable sound card capture to mix sounds played by the system into the publishing stream, such as sounds played by the browser, sounds played by the third-party player, etc.

  • Default value: Default is disable.
  • When to call: Called this function after calling [startPublishingStream] or [startPreview].
  • Caution: The system sound card sound does not include streaming sound, media player sound and sound effect player sound.
  • Related APIs: [setMixSystemPlayoutVolume] function can set system audio capture volume.
  • Platform differences: Only supports Windows and macOS.
  • Available since: 1.9.0
  • Restrictions: None.

setMixSystemPlayoutVolume:

setMixSystemPlayoutVolume:
- (void)setMixSystemPlayoutVolume:(int) volume;
set system audio capture volume.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
volumeintthe volume. Valid range [0, 200], default is 100.

Details

only for macOS

enableMixEnginePlayout:

enableMixEnginePlayout:
- (void)enableMixEnginePlayout:(BOOL) enable;
Enable or disable mix SDK playout to stream publishing.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
enableBOOLWhether to mix engine playout

Details

Enable mix SDK playout sounds into the stream publishing.

  • Use cases: Users need to mix the sound of SDK playout into stream publishing. For example, when the class scene, the teacher and student Co-hosting, and the teacher can mix the play streaming sound into the publish streaming.
  • Default value: Default is disable.
  • When to call /Trigger: Called this function after calling [startPublishingStream] or [startPreview].
  • Available since: 1.1.0
  • Restrictions: None.

startAudioVADStableStateMonitor:

startAudioVADStableStateMonitor:
- (void)startAudioVADStableStateMonitor:(ZegoAudioVADStableStateMonitorType) type;
Start audio VAD stable state monitoring.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
typeZegoAudioVADStableStateMonitorTypeaudio VAD monitor type.

Details

After monitoring is started, you can use the [onAudioVADStateUpdate] callback to receive the specified type of audio VAD callback.

  • Use cases: For example, when you specify the type of collection and use the microphone to collect, you can check whether the host has continuous and stable voice input through this interface.
  • When to call: Before publish stream, you can call [startPreview] with this function and combine it with [onAudioVADStateUpdate] callback to determine whether the audio device is working properly.
  • Related APIs: [stopAudioVADStableStateMonitor].
  • Restrictions: [onAudioVADStateUpdate] callback notification period is 3 seconds.

startAudioVADStableStateMonitor:millisecond:

startAudioVADStableStateMonitor:millisecond:
- (void)startAudioVADStableStateMonitor:(ZegoAudioVADStableStateMonitorType) type millisecond:(int) millisecond;
Start audio VAD stable state monitoring, and the monitoring period can be set.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
typeZegoAudioVADStableStateMonitorTypeaudio VAD monitor type.
millisecondintmonitoring period default 3000. value of [200, 10000]

Details

After monitoring is started, you can use the [onAudioVADStateUpdate] callback to receive the specified type of audio VAD callback.

  • Use cases: For example, when you specify the type of collection and use the microphone to collect, you can check whether the host has continuous and stable voice input through this interface.
  • When to call: Before publish stream, you can call [startPreview] with this function and combine it with [onAudioVADStateUpdate] callback to determine whether the audio device is working properly.
  • Related APIs: [stopAudioVADStableStateMonitor].
  • Restrictions: None.

stopAudioVADStableStateMonitor:

stopAudioVADStableStateMonitor:
- (void)stopAudioVADStableStateMonitor:(ZegoAudioVADStableStateMonitorType) type;
Stop audio VAD stable state monitoring.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
typeZegoAudioVADStableStateMonitorTypeaudio VAD monitor type.

Details

After calling this interface, the specified type of [onAudioVADStateUpdate] callback can no longer be received.

  • When to call: None.
  • Related APIs: [startAudioVADStableStateMonitor].
  • Available since: 2.14.0
  • Restrictions: None.

getCurrentAudioDevice:

getCurrentAudioDevice:
- (ZegoDeviceInfo *)getCurrentAudioDevice:(ZegoAudioDeviceType) deviceType;
Get the audio device information currently in use.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
deviceTypeZegoAudioDeviceTypeAudio device type.Required
.

Details

Get the audio device information currently in use.

  • Use cases: Used for scenes that need to manually switch between multiple audio devices.
  • When to call: Called this function after calling [startPublishingStream] or [startPreview].
  • Related APIs: The default audio device ID can be obtained through [getDefaultAudioDeviceID].
  • Available since: 2.12.0
  • Restrictions: Only supports Windows and macOS.

Return

Audio device information.

enableAEC:

enableAEC:
- (void)enableAEC:(BOOL) enable;
Whether to enable acoustic echo cancellation (AEC).
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
enableBOOLWhether to enable echo cancellation, true: enable, false: disable

Details

Turning on echo cancellation, the SDK filters the collected audio data to reduce the echo component in the audio. Use case: When you need to reduce the echo to improve the call quality and user experience, you can turn on this feature.

  • When to call: It needs to be called after [createEngine].
  • Caution: The AEC function only supports the processing of sounds playbacked through the SDK, such as sounds played by the playing stream, media player, audio effect player, etc. Before this function is called, the SDK automatically determines whether to use AEC. Once this function is called, the SDK does not automatically determine whether to use AEC.
  • Related APIs: Developers can use [enableHeadphoneAEC] to set whether to enable AEC when using headphones, and use [setAECMode] to set the echo cancellation mode.
  • Available since: 1.1.0
  • Restrictions: None.

enableHeadphoneAEC:

enableHeadphoneAEC:
- (void)enableHeadphoneAEC:(BOOL) enable;
Whether to turn on acoustic echo cancellation (AEC) when using the headphone.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
enableBOOLWhether to enable, true: enable, false: disable

Details

When [enableAEC] is used to turn on echo cancellation, it is only turned on when the speaker is used for mobile terminal equipment. Call this function if you need to turn echo cancellation on or off when using the headset. Use case: It is common when the mobile device is connected to a external sound card as the audio output source. In order to eliminate the echo in this case, you need to call this function to turn on the echo cancellation.

  • Default value: Android is off by default and iOS is on by default.
  • When to call: It needs to be called after [createEngine], before [startPublishingStream], [startPlayingStream], [startPreview], [createMediaPlayer], [createAudioEffectPlayer] and [createRealTimeSequentialDataManager].
  • Caution: Turning on echo cancellation will increase the ear return delay. On the iOS platform, the SDK cannot distinguish between the headset and the external sound card. If you use this function to turn off the system echo cancellation when using the headset, the sound played by the external sound card will be collected when the user accesses the external sound card.
  • Related APIs: When the headset is not used, you can set whether the SDK turns on echo cancellation through [enableAEC].
  • Platform differences: Only supports iOS and Android.
  • Available since: 1.1.0
  • Restrictions: None.

setAECMode:

setAECMode:
- (void)setAECMode:(ZegoAECMode) mode;
Sets the acoustic echo cancellation (AEC) mode.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
modeZegoAECModeEcho cancellation mode

Details

When [enableAEC] is used to enable echo cancellation, this function can be used to switch between different echo cancellation modes to control the degree of echo cancellation. Use case: When the default echo cancellation effect does not meet expectations, this function can be used to adjust the echo cancellation mode.

  • Default value: When this function is not called, the default echo cancellation mode is [Aggressive].
  • When to call: It needs to be called after [createEngine].
  • Available since: 1.1.0
  • Restrictions: The value set by this function is valid only after the echo cancellation function is turned on.

enableAGC:

enableAGC:
- (void)enableAGC:(BOOL) enable;
Enables or disables automatic gain control (AGC).
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
enableBOOLWhether to enable automatic gain control, true: enable, false: disable

Details

After turning on this function, the SDK can automatically adjust the microphone volume to adapt to near and far sound pickups and keep the volume stable. Use case: When you need to ensure volume stability to improve call quality and user experience, you can turn on this feature.

  • When to call: It needs to be called after [createEngine].
  • Caution: Before this function is called, the SDK automatically determines whether to use AGC. Once this function is called, the SDK does not automatically determine whether to use AGC.
  • Available since: 1.1.0
  • Restrictions: None.

enableANS:

enableANS:
- (void)enableANS:(BOOL) enable;
Enables or disables active noise suppression (ANS, aka ANC).
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
enableBOOLWhether to enable noise suppression, true: enable, false: disable

Details

Enable the noise suppression can reduce the noise in the audio data and make the human voice clearer. Use case: When you need to suppress noise to improve call quality and user experience, you can turn on this feature.

  • When to call: It needs to be called after [createEngine].
  • Related APIs: This function has a better suppression effect on continuous noise (such as the sound of rain, white noise). If you need to turn on transient noise suppression, please use [enableTransientANS]. And the noise suppression mode can be set by [setANSMode].
  • Caution: Before this function is called, the SDK automatically determines whether to use ANS. Once this function is called, the SDK does not automatically determine whether to use ANS.
  • Available since: 1.1.0
  • Restrictions: None.

enableTransientANS:

enableTransientANS:
- (void)enableTransientANS:(BOOL) enable;
Enables or disables transient noise suppression.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
enableBOOLWhether to enable transient noise suppression, true: enable, false: disable

Details

Enable the transient noise suppression can suppress the noises such as keyboard and desk knocks. Use case: When you need to suppress transient noise to improve call quality and user experience, you can turn on this feature.

  • Default value: When this function is not called, this is disabled by default.
  • When to call: It needs to be called after [createEngine].
  • Related APIs: This function will not suppress normal noise after it is turned on. If you need to turn on normal noise suppression, please use [enableANS].
  • Available since: 1.17.0
  • Restrictions: None.

setANSMode:

setANSMode:
- (void)setANSMode:(ZegoANSMode) mode;
Sets the automatic noise suppression (ANS) mode.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
modeZegoANSModeAudio Noise Suppression mode

Details

When [enableANS] is used to enable noise suppression, this function can be used to switch between different noise suppression modes to control the degree of noise suppression. Use case: When the default noise suppression effect does not meet expectations, this function can be used to adjust the noise suppression mode.

  • Default value: When this function is not called, the default automatic noise suppression (ANS) mode is [Medium].
  • When to call: It needs to be called after [createEngine].
  • Available since: 1.1.0
  • Restrictions: The value set by this function is valid only after the noise suppression function is turned on.

enableSpeechEnhance:level:

enableSpeechEnhance:level:
- (void)enableSpeechEnhance:(BOOL) enable level:(int) level;
Enables or disables speech enhancement.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
enableBOOLWhether to enable speech enhancement, true: enable, false: disable
levelintEnhancement level; The value range is [0, 10]

Details

Enable the speech enhancement function. Use case: In the KTV external playback scene, due to 3A damage and distance, the voice is weak or empty or unclear, so it is necessary to enhance the external playback experience through the voice enhancement technology.

  • Default value: When this function is not called, this is disabled by default.
  • When to call: It needs to be called after [createEngine] and it Supports dynamic change.
  • Caution: 1. If this interface is called repeatedly, the settings of the last call are used;
  1. After call [DestroyEngine], the Settings fail.
  • Available since: 3.3.0.
  • Restrictions: None.

enableAudioMixing:

enableAudioMixing:
- (void)enableAudioMixing:(BOOL) enable;
Enables or disables audio mixing function.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
enableBOOLWhether to enable audio mixting, true: enable, false: disable

Details

After the audio mixing function is turned on, the SDK will mix the audio data prepared by the developer with the audio data collected by the SDK before publishing. Use case: Developers can use this function when they need to mix their own songs, sound effects or other audio data into the publishing stream.

  • Default value: When this function is not called, this is disabled by default.
  • When to call: It needs to be called after [createEngine].
  • Related APIs: After enabling audio mixing, the developer also needs to call [setAudioMixingHandler] to set the audio mixing callback, so as to provide the SDK with the audio data that needs to be mixed in the [onAudioMixingCopyData] callback.
  • Caution: After you start audio mixing, the SDK will play the mixed audio on the local (publisher side) by default. If you do not want to play it locally but only on the remote (player side), please call [muteLocalAudioMixing] to set the local audio mixing mute. Recommend to use audio effect player or media player for audio mixing.
  • Available since: 1.9.0, will be deprecated soon. It is recommended to use the media player [createMediaPlayer] or the audio effect player [createAudioEffectPlayer] to implement the audio mixing function.
  • Restrictions: None.

setAudioMixingHandler:

setAudioMixingHandler:
- (void)setAudioMixingHandler:(nullable id<ZegoAudioMixingHandler>) handler;
Sets up the audio mixing event handler.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
handlernullable id<ZegoAudioMixingHandler>Audio mixing callback handler

Details

After the audio mixing function is turned on, the SDK will mix the audio data prepared by the developer with the audio data collected by the SDK before publishing. Use case: Developers can use this function when they need to mix their own songs, sound effects or other audio data into the publishing stream.

  • When to call: It needs to be called after [createEngine].
  • Caution: When this function is called again to set the callback, the previously set mixing callback will be overwritten.
  • Available since: 1.9.0
  • Restrictions: None.

muteLocalAudioMixing:

muteLocalAudioMixing:
- (void)muteLocalAudioMixing:(BOOL) mute;
Mute or resume local playback of the mixing audio.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
muteBOOLWhether to mute local audio mixting, true: mute, false: unmute

Details

When calling this function to mute the local playback audio mixing, the local (publisher side) will not play the audio provided to the SDK through [onAudioMixingCopyData], but the remote (player side) can still playback it Mix. Use case: When developers need to mix their own songs, sound effects or other audio data into the publishing stream, but the mixed audio only wants to be heard by the remote player, and does not want to be playback locally, you can use this function.

  • Default value: When this function is not called, the default is not mute, which is false.
  • When to call: It needs to be called after [createEngine].
  • Available since: 1.9.0
  • Restrictions: None.

setAudioMixingVolume:

setAudioMixingVolume:
- (void)setAudioMixingVolume:(int) volume;
Sets the audio mixing output volume for both local playback and the stream to be published.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
volumeintThe audio mixing volume, range from 0 to 200, 100 as default.

Details

After enabling the audio mixing function through [enableAudioMixing], the developer can use this function to set the volume of the mixing audio to be mixed to SDK. Use case: When developers need to mix their own songs, sound effects or other audio data into the publishing stream, and want to adjust the volume of the mixing audio, you can use this function.

  • When to call: It needs to be called after [createEngine].
  • Caution: This function will set both the mixing audio volume of the local playback and the remote playback at the same time.
  • Related APIs: If you need to set the mixing audio volume for local playback or remote playback separately, please use the function of the same name with the [type] parameter.
  • Available since: 1.9.0
  • Restrictions: None.

setAudioMixingVolume:type:

setAudioMixingVolume:type:
- (void)setAudioMixingVolume:(int) volume type:(ZegoVolumeType) type;
Sets the audio mixing output volume for either local playback or the stream to published.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
volumeintThe audio mixing volume, range from 0 to 200, 100 as default.
typeZegoVolumeTypeLocal playback volume / Remote playback volume

Details

After enabling the audio mixing function through [enableAudioMixing], the developer can use this function to set the volume of the mixing audio to be mixed to SDK. Use case: When developers need to mix their own songs, sound effects or other audio data into the publishing stream, and want to adjust the volume of the mixing audio, you can use this function.

  • When to call: It needs to be called after [createEngine].
  • Caution: This function can individually set the mixing audio volume of the local playback or the remote playback.
  • Available since: 1.9.0
  • Restrictions: None.

startEffectsEnv

startEffectsEnv
- (void)startEffectsEnv;
Enable the Effects beauty environment.
Declared in ZegoExpressEngine.h

Enable the Effects beauty environment. The SDK uses the specified video frame data type for transmission. The Windows platform only supports video frame raw data, the Apple platform only supports CVPixelBuffer, and the Android platform only supports texture2d.

  • Use cases: It is often used in scenes such as video calls and live broadcasts.
  • Default value: When this function is not called, the beauty environment is not activated by default.
  • When to call: Must be called before calling [startPreview], [startPublishingStream]. If you need to modify the configuration, please call [logoutRoom] to log out of the room first, otherwise it will not take effect.
  • Related APIs: [enableEffectsBeauty] switch beauty, [setEffectsBeautyParam] set beauty parameters.
  • Caution: This beauty function is the basic function. If it does not meet the expectations of the developer, you can use the custom video pre-processing function [enableCustomVideoProcessing] or the custom video capture function [enableCustomVideoCapture] docking and constructing the AI ​​Effects SDK [ZegoEffects] /ai-effects-android-java/overview/overview for best results.
  • Available since: 2.16.0
  • Restrictions: This function only supports Android system 5.0 and above, Android SDK version 21 and above.

stopEffectsEnv

stopEffectsEnv
- (void)stopEffectsEnv;
Disable the Effects beauty environment.
Declared in ZegoExpressEngine.h

Disable the Effects beauty environment.

  • Use cases: It is often used in scenes such as video calls and live broadcasts.
  • When to call: Must be called before calling [startPreview], [startPublishingStream]. If you need to modify the configuration, please call [logoutRoom] to log out of the room first, otherwise it will not take effect.
  • Related APIs: [enableEffectsBeauty] switch beauty, [setEffectsBeautyParam] set beauty parameters.
  • Caution: This beauty function is the basic function. If it does not meet the expectations of the developer, you can use the custom video pre-processing function [enableCustomVideoProcessing] or the custom video capture function [enableCustomVideoCapture] docking and constructing the AI ​​Effects SDK [ZegoEffects] for best results.
  • Available since: 2.16.0
  • Restrictions: This function only supports Android system 5.0 and above, Android SDK version 21 and above.

enableEffectsBeauty:

enableEffectsBeauty:
- (void)enableEffectsBeauty:(BOOL) enable;
Enables or disables the beauty effect.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
enableBOOLWhether to enable the beauty effect, true is enabled; false is disabled, and the default is false.

Details

Support basic beauty functions, including whiten, rosy, smooth, and sharpen.

  • Use cases: It is often used in scenes such as video calls and live broadcasts.
  • When to call: You must call [startEffectsEnv] to enable the beauty environment before calling this function.
  • Default value: When this function is not called, the beauty effect is not enabled by default.
  • Related APIs: You can call the [setBeautifyOption] function to adjust the beauty parameters.
  • Caution: This beauty function is the basic function. If it does not meet the expectations of the developer, you can use the custom video pre-processing function [enableCustomVideoProcessing] or the custom video capture function [enableCustomVideoCapture] docking and constructing the AI ​​Effects SDK [ZegoEffects] for best results.
  • Available since: 2.16.0
  • Restrictions: If this function is used on the Android platform, it only supports 5.0 and above, SDK version 21 and above.

setEffectsBeautyParam:

setEffectsBeautyParam:
- (void)setEffectsBeautyParam:(ZegoEffectsBeautyParam *) param;
Set beautify param.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
paramZegoEffectsBeautyParam *Beauty option param.

Details

Set the beauty parameters, including whiten, rosy, smooth, and sharpen.

  • Use cases: It is often used in scenes such as video calls and live broadcasts.
  • When to call: You must call [startEffectsEnv] to enable the beauty environment before calling this function.
  • Related APIs: You can call [enableEffectsBeauty] to turn on or off the beauty function.
  • Available since: 2.16.0
  • Restrictions: This function only supports Android system 5.0 and above, Android SDK version 21 and above.

setAudioEqualizerGain:bandGain:

setAudioEqualizerGain:bandGain:
- (void)setAudioEqualizerGain:(int) bandIndex bandGain:(float) bandGain;
Set the sound equalizer (EQ).
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
bandIndexintBand frequency index, the value range is [0, 9], corresponding to 10 frequency bands, and the center frequencies are [31, 62, 125, 250, 500, 1K, 2K, 4K, 8K, 16K] Hz.
bandGainfloatBand gain for the index, the value range is [-15, 15]. Default value is 0, if all gain values in all frequency bands are 0, EQ function will be disabled.

Details

Call this function to set the sound equalizer adjust the tone.

  • Use cases: Often used in voice chatroom, KTV.
  • When to call: It should be called after the engine has started.
  • Available since: 1.12.0
  • Restrictions: None.

setVoiceChangerPreset:

setVoiceChangerPreset:
- (void)setVoiceChangerPreset:(ZegoVoiceChangerPreset) preset;
Setting up the voice changer via preset enumeration.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
presetZegoVoiceChangerPresetThe voice changer preset enumeration.

Details

Call this function to use preset voice changer effect.

  • Use cases: Often used in live broadcasting, voice chatroom and KTV.
  • When to call: It needs to be called after [createEngine].
  • Related APIs: If you need advanced voice changer effect, please use [setVoiceChangerParam]. The effect of using this function together with [setReverbPreset] may be different from what is expected. If you need to use it at the same time, it is recommended to enable the voice changer first, and then enable the reverb. Using ANDROID/ETHEREAL preset voice changer effect will modify reverberation or reverberation echo parameters. Calling [setVoiceChangerParam], [setReverbAdvancedParam], [setReverbEchoParam] may affect the voice changer effect after use these preset voice changer effect. If you need advanced reverb/echo/electronic effects/voice changer effect, please use [setReverbAdvancedParam], [setReverbEchoParam], [setElectronicEffects], [setVoiceChangerParam] together.
  • Available since: 1.17.0

setVoiceChangerParam:

setVoiceChangerParam:
- (void)setVoiceChangerParam:(ZegoVoiceChangerParam *) param;
Setting up the specific voice changer parameters.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
paramZegoVoiceChangerParam *Voice changer parameters.

Details

Call this function to set custom voice changer effect.

  • Use cases: Often used in live broadcasting, voice chatroom and KTV.
  • When to call: It needs to be called after [createEngine].
  • Related APIs: [setVoiceChangerPreset] provide a set of preset voice changer effects. If you need advanced reverb/echo/voice changer effect, please use [setReverbAdvancedParam], [setReverbEchoParam], [setVoiceChangerParam] together.
  • Available since: 1.10.0

setReverbPreset:

setReverbPreset:
- (void)setReverbPreset:(ZegoReverbPreset) preset;
Setting up the reverberation via preset enumeration.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
presetZegoReverbPresetThe reverberation preset enumeration.

Details

Call this function to set preset reverb effect.

  • Use cases: Often used in live broadcasting, voice chatroom and KTV.
  • When to call: It needs to be called after [createEngine]. Support call this function to change preset reverb effect during publishing stream.
  • Related APIs: If you need advanced reverb effect, please use [setReverbAdvancedParam]. The effect of using this function together with [setVoiceChangerPreset] may be different from what is expected. If you need to use it at the same time, it is recommended to enable the voice changer first, and then enable the reverb. If you need advanced reverb/echo/voice changer effect, please use [setReverbAdvancedParam], [setReverbEchoParam], [setVoiceChangerParam] together.
  • Available since: 1.17.0

setReverbAdvancedParam:

setReverbAdvancedParam:
- (void)setReverbAdvancedParam:(ZegoReverbAdvancedParam *) param;
Setting up the specific reverberation parameters.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
paramZegoReverbAdvancedParam *Reverb advanced parameter.

Details

Call this function to set preset reverb effect.

  • Use cases: Often used in live broadcasting, voice chatroom and KTV.
  • When to call: It needs to be called after [createEngine].
  • Caution: Different values dynamically set during publishing stream will take effect. When all parameters are set to 0, the reverberation is turned off.
  • Related APIs: [setReverbPreset] provide a set of preset reverb effects. If you need advanced reverb/echo/voice changer effect, please use [setReverbAdvancedParam], [setReverbEchoParam], [setVoiceChangerParam] together.
  • Available since: 1.10.0

setReverbEchoParam:

setReverbEchoParam:
- (void)setReverbEchoParam:(ZegoReverbEchoParam *) param;
Setting up the specific reverberation echo parameters.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
paramZegoReverbEchoParam *The reverberation echo parameter.

Details

Call this function to set reverb echo effect. This function can be used with voice changer and reverb to achieve a variety of custom sound effects.

  • Use cases: Often used in live broadcasting, voice chatroom and KTV.
  • When to call: It needs to be called after [createEngine].
  • Related APIs: If you need advanced reverb/echo/voice changer effect, please use [setReverbAdvancedParam], [setReverbEchoParam], [setVoiceChangerParam] together.
  • Available since: 1.17.0

enableVirtualStereo:angle:

enableVirtualStereo:angle:
- (void)enableVirtualStereo:(BOOL) enable angle:(int) angle;
Enable or disable the virtual stereo effect when publishing stream.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
enableBOOLtrue to turn on the virtual stereo, false to turn off the virtual stereo.
angleintThe angle of the sound source in virtual stereo in the range of -1 ~ 360, with 90 being directly in front, 0 / 180 / 270 corresponding to the rightmost and leftmost respectively. In particular, when set to -1, it is all round virtual stereo effects.

Details

Call this function to enable / disable the virtual stereo effect when publishing stream.

  • Use cases: Often used in live broadcasting, voice chatroom and KTV.
  • When to call: It needs to be called after [createEngine].
  • Caution: You need to set up a dual channel with [setAudioConfig] for the virtual stereo to take effect.
  • Available since: 1.10.0; Starting from 2.15.0, the angle parameter supports setting -1 to present a all round virtual stereo effect.

enablePlayStreamVirtualStereo:angle:streamID:

enablePlayStreamVirtualStereo:angle:streamID:
- (void)enablePlayStreamVirtualStereo:(BOOL) enable angle:(int) angle streamID:(NSString *) streamID;
Enable or disable the virtual stereo effect when playing stream.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
enableBOOLtrue to turn on the virtual stereo, false to turn off the virtual stereo.
angleintThe angle of the sound source in virtual stereo in the range of 0 ~ 360, with 90 being directly in front, 0 / 180 / 270 corresponding to the rightmost and leftmost respectively.
streamIDNSString *Stream ID.

Details

Call this function to enable/disable the virtual stereo effect when playing stream.

  • Use cases: Often used in live broadcasting, voice chatroom and KTV.
  • When to call: It needs to be called after [createEngine].
  • Caution: It can dynamically switch and set angle parameters before and after playing stream. After stopping playing stream, it will automatically reset and disable.
  • Available since: 2.8.0

setElectronicEffects:mode:tonal:

setElectronicEffects:mode:tonal:
- (void)setElectronicEffects:(BOOL) enable mode:(ZegoElectronicEffectsMode) mode tonal:(int) tonal;
Turn on or off the electronic sound effect.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
enableBOOLtrue to turn on the electronic sound effect, false to turn off the electronic sound effect.
modeZegoElectronicEffectsModeMode of Electronic Effects reference.
tonalintThe starting pitch of an electric tone in a given mode, representing 12 semitones in one octave of the sound, in the range [0, 11].

Details

Call this function to turn on or off the electronic sound effect.

  • Use cases: Often used in live broadcasting, voice chatroom and sung unaccompanied scenes.
  • Default value: When this function is not called, the electronic sound effect is not enabled by default.
  • When to call: It needs to be called after [createEngine].
  • Caution: When the mode parameter is Harmonic Minor, the tonal parameter does not take effect.
  • Related APIs: Common electronic sound effect configurations can be set via [setVoiceChangerPreset].
  • Available since: 2.13.0
  • Restrictions: None.

enableColorEnhancement:params:channel:

enableColorEnhancement:params:channel:
- (void)enableColorEnhancement:(BOOL) enable params:(ZegoColorEnhancementParams *) params channel:(ZegoPublishChannel) channel;
Enable color enhancement.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
enableBOOLWhether to enable, true: enable, false: disable
paramsZegoColorEnhancementParams *Color enhancement parameters.
channelZegoPublishChannelPublish stream channel.

Details

Call this function to enable or disable color enhancement.

  • Use cases: Commonly used in video calling, live streaming, and similar scenarios.
  • Default value: When this function is not called, color enhancement is not enabled by default.
  • When to call: It needs to be called after [createEngine].
  • Available since: 3.11.0

createRealTimeSequentialDataManager:

createRealTimeSequentialDataManager:
- (nullable ZegoRealTimeSequentialDataManager *)createRealTimeSequentialDataManager:(NSString *) roomID;
Create the real time sequential data manager instance
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
roomIDNSString *Fill in the room ID that has been logged in, and all related stuff will be do in this room.

Details

Create a manager object for sending/receiving real-time signaling.

  • Use cases: You can use this function when you need to use real-time signaling to implement services such as cloud games and remote desktops.
  • When to call: After logging in to a room.
  • Caution: None.
  • Restrictions: Only one corresponding manager object can be created for each room ID of [loginRoom], that is, only one object can be created in single room mode, and multiple objects can be created in multi-room mode.

Return

The real-time sequential data manager instance, nil will be returned when the maximum number is exceeded.

destroyRealTimeSequentialDataManager:

destroyRealTimeSequentialDataManager:
- (void)destroyRealTimeSequentialDataManager:(ZegoRealTimeSequentialDataManager *) manager;
Destroy the real time sequential data manager instance
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
managerZegoRealTimeSequentialDataManager *The real time sequential data manager instance to be destroyed.

Details

Destroy the [ZegoRealTimeSequentialDataManager] instance object.

  • Use cases: When you no longer need to use the real-time signaling function, you can use this function to destroy the instance object created by the [createRealTimeSequentialDataManager] function
  • When to call: When you need to the real-time signaling manager object needs to be destroyed
  • Caution: None.
  • Restrictions: After destroy the instance, you need to release the [ZegoRealTimeSequentialDataManager] instance object you hold by yourself, and don’t call the function of this instance object after the destruction.

sendBroadcastMessage:roomID:callback:

sendBroadcastMessage:roomID:callback:
- (void)sendBroadcastMessage:(NSString *) message roomID:(NSString *) roomID callback:(nullable ZegoIMSendBroadcastMessageCallback) callback;
Sends a Broadcast Message.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
messageNSString *The content of the message. Required: Yes. Value range: The length does not exceed 1024 bytes.
roomIDNSString *Room ID, a string of less 128 bytes in length.
Caution:
1. room ID is defined by yourself.
2. Only support numbers, English characters and '~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', '=', '-', '`', ';', '’', ',', '.', '<', '>', ''.
3. If you need to communicate with the Web SDK, please do not use '%'.
callbacknullable ZegoIMSendBroadcastMessageCallbackSend a notification of the result of a broadcast message. Required: No. Caution: Passing [nil] means not receiving callback notifications.

Details

Send a broadcast message to the room, users who have entered the same room can receive the message, and the message is reliable.

  • Use cases: Generally used in the live room.
  • When to call: After calling [loginRoom] to log in to the room.
  • Related callbacks: The room broadcast message can be received through [onIMRecvBroadcastMessage].
  • Related APIs: Barrage messages can be sent through the [sendBarrageMessage] function, and custom command can be sent through the [sendCustomCommand] function.
  • Available since: 1.2.1
  • Restrictions: The frequency of sending broadcast messages in the same room cannot be higher than 10 messages/s. The maximum QPS for a single user to call this interface within a single room is 2. For restrictions on the use of this function, please contact ZEGO technical support.

sendBarrageMessage:roomID:callback:

sendBarrageMessage:roomID:callback:
- (void)sendBarrageMessage:(NSString *) message roomID:(NSString *) roomID callback:(nullable ZegoIMSendBarrageMessageCallback) callback;
Sends a Barrage Message (bullet screen) to all users in the same room, without guaranteeing the delivery.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
messageNSString *The content of the message. Required: Yes. Value range: The length does not exceed 1024 bytes.
roomIDNSString *Room ID, a string of less 128 bytes in length.
Caution:
1. room ID is defined by yourself.
2. Only support numbers, English characters and '~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', '=', '-', '`', ';', '’', ',', '.', '<', '>', ''.
3. If you need to communicate with the Web SDK, please do not use '%'.
callbacknullable ZegoIMSendBarrageMessageCallbackSend barrage message result callback.Required: No. Caution: Passing [nil] means not receiving callback notifications.

Details

Send a barrage message to the room, users who have logged in to the same room can receive the message, the message is unreliable.

  • Use cases: Generally used in scenarios where there is a large number of messages sent and received in the room and the reliability of the messages is not required, such as live barrage.
  • When to call: After calling [loginRoom] to log in to the room.
  • Related callbacks: The room barrage message can be received through [onIMRecvBarrageMessage].
  • Related APIs: Broadcast messages can be sent through the [sendBroadcastMessage] function, and custom command can be sent through the [sendCustomCommand] function.
  • Available since: 1.5.0
  • Restrictions: The frequency of sending barrage messages in the same room cannot be higher than 20 messages/s. For restrictions on the use of this function, please contact ZEGO technical support.

sendCustomCommand:toUserList:roomID:callback:

sendCustomCommand:toUserList:roomID:callback:
- (void)sendCustomCommand:(NSString *) command toUserList:(nullable NSArray<ZegoUser *> *) toUserList roomID:(NSString *) roomID callback:(nullable ZegoIMSendCustomCommandCallback) callback;
Sends a Custom Command to the specified users in the same room.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
commandNSString *Custom command content. Required: Yes. Value range: The maximum length is 1024 bytes. Caution: To protect privacy, please do not fill in sensitive user information in this interface, including but not limited to mobile phone number, ID number, passport number, real name, etc.
toUserListnullable NSArray<ZegoUser *> *List of recipients of signaling. Required: Yes. Value range: user list or [nil]. Caution: When it is [nil], the SDK will send custom signaling back to all users in the room
roomIDNSString *Room ID, a string of less 128 bytes in length.
Caution:
1. room ID is defined by yourself.
2. Only support numbers, English characters and '~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', '=', '-', '`', ';', '’', ',', '.', '<', '>', ''.
3. If you need to communicate with the Web SDK, please do not use '%'.
callbacknullable ZegoIMSendCustomCommandCallbackSend a notification of the signaling result. Required: No. Caution: Passing [nil] means not receiving callback notifications.

Details

Send point-to-point signaling to other users who have logged into the same room, and the message is reliable.

  • Use cases: Generally used for remote control signaling or message sending between users.
  • When to call: After calling [loginRoom] to log in to the room.
  • Related callbacks: The room custom command can be received through [onIMRecvCustomCommand].
  • Related APIs: Broadcast messages can be sent through the [sendBroadcastMessage] function, and barrage messages can be sent through the [sendBarrageMessage] function.
  • Privacy reminder: Please do not fill in sensitive user information in this interface, including but not limited to mobile phone number, ID number, passport number, real name, etc.
  • Available since: 1.2.1
  • Restrictions: The frequency of sending barrage messages in the same room cannot be higher than 20 messages/s. For restrictions on the use of this function, please contact ZEGO technical support.

sendTransparentMessage:roomID:callback:

sendTransparentMessage:roomID:callback:
- (void)sendTransparentMessage:(ZegoRoomSendTransparentMessage*) message roomID:(NSString *) roomID callback:(nullable ZegoRoomSendTransparentMessageCallback) callback;
Sends a transparent message in room.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
messageZegoRoomSendTransparentMessage*ZegoRoomSendTransparentMessage
roomIDNSString *Room ID, a string of less 128 bytes in length.
Caution:
1. room ID is defined by yourself.
2. Only support numbers, English characters and '~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', '=', '-', '`', ';', '’', ',', '.', '<', '>', ''.
3. If you need to communicate with the Web SDK, please do not use '%'.
callbacknullable ZegoRoomSendTransparentMessageCallbackSend a notification of the signaling result. Required: No. Caution: Passing [nil] means not receiving callback notifications.

Details

Send point-to-point signaling to other users who have logged into the same room.

  • Use cases: Generally used for remote control signaling or message sending between users.
  • When to call: After calling [loginRoom] to log in to the room.
  • Related callbacks: When sending a message, Mode is specified for ZegoRoomTransparentMessageModeOnlyClient or ZegoRoomTransparentMessageModeClientAndServer can pass [onRecvRoomTransparentMessage] received sends the message content.
  • Privacy reminder: Please do not fill in sensitive user information in this interface, including but not limited to mobile phone number, ID number, passport number, real name, etc.
  • Available since: 1.2.1
  • Restrictions: The frequency of sending barrage messages in the same room cannot be higher than 20 messages/s. For restrictions on the use of this function, please contact ZEGO technical support.

createMediaPlayer

createMediaPlayer
- (nullable ZegoMediaPlayer *)createMediaPlayer;
Creates a media player instance.
Declared in ZegoExpressEngine.h

Creates a media player instance. Use case: It is often used to play media resource scenes, For example, play video files, push the video of media resources in combination with custom video acquisition, and the remote end can pull the stream for viewing.

  • When to call: It can be called after the SDK by [createEngine] has been initialized.
  • Caution: The more instances of a media player, the greater the performance overhead on the device.
  • Related APIs: User can call [destroyMediaPlayer] function to destroy a media player instance.
  • Available since: 2.1.0
  • Restrictions: Currently, a maximum of 10 instances can be created, after which it will return nil.

Media player instance, nil will be returned when the maximum number is exceeded.

destroyMediaPlayer:

destroyMediaPlayer:
- (void)destroyMediaPlayer:(ZegoMediaPlayer *) mediaPlayer;
Destroys a media player instance.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
mediaPlayerZegoMediaPlayer *The media player instance object to be destroyed.

Details

Destroys a media player instance.

  • Related APIs: User can call [createMediaPlayer] function to create a media player instance.
  • Available since: 2.1.0

createAudioEffectPlayer

createAudioEffectPlayer
- (nullable ZegoAudioEffectPlayer *)createAudioEffectPlayer;
Creates a audio effect player instance.
Declared in ZegoExpressEngine.h

Creates a audio effect player instance.

  • Use cases: When you need to play short sound effects, such as applause, cheers, etc., you can use audioEffectPlayer to achieve.
  • When to call: It can be called after [createEngine].
  • Related APIs: [destroyAudioEffectPlayer].
  • Available since: 1.16.0
  • Restrictions: Currently, a maximum of 1 instances can be created, after which it will return nil.

audio effect player instance, nil will be returned when the maximum number is exceeded.

destroyAudioEffectPlayer:

destroyAudioEffectPlayer:
- (void)destroyAudioEffectPlayer:(ZegoAudioEffectPlayer *) audioEffectPlayer;
Destroys a audio effect player instance.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
audioEffectPlayerZegoAudioEffectPlayer *The audio effect player instance object to be destroyed.

Details

Destroys the specified audio effect player instance.

  • When to call: It can be called after [createAudioEffectPlayer].
  • Related APIs: [createAudioEffectPlayer].
  • Available since: 1.16.0
  • Restrictions: None.

createMediaDataPublisher:

createMediaDataPublisher:
- (nullable ZegoMediaDataPublisher *)createMediaDataPublisher:(ZegoMediaDataPublisherConfig *) config;
Creates a media data publisher instance.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
configZegoMediaDataPublisherConfig *Config the media data publisher.

Details

Developers can use this interface to create ZegoMediaDataPublisher objects to push local media resource files to implement server-side streaming scenarios, such as AI classrooms.

  • Use cases: Often used in server-side publishing stream scenarios, such as AI classrooms.
  • When to call: After calling the [createEngine] function to create an engine.
  • Caution: It returns the instance object of the specified publish channel. It will return the instance object if it already exists.
  • Available since: 3.4.0

Return

Media data publisher instance.

destroyMediaDataPublisher:

destroyMediaDataPublisher:
- (void)destroyMediaDataPublisher:(ZegoMediaDataPublisher *) mediaDataPublisher;
Destroys a media data publisher instance.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
mediaDataPublisherZegoMediaDataPublisher *The media data publisher instance object to be destroyed

Details

Destroys a media data publisher instance.

  • Use cases: Often used in server-side publishing stream scenarios, such as AI classrooms.
  • When to call: After calling the [createEngine] function to create an engine.
  • Available since: 2.17.0

startRecordingCapturedData:channel:

startRecordingCapturedData:channel:
- (void)startRecordingCapturedData:(ZegoDataRecordConfig *) config channel:(ZegoPublishChannel) channel;
Starts to record and directly save the data to a file.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
configZegoDataRecordConfig *Record config.
channelZegoPublishChannelPublishing stream channel.

Details

Starts to record locally captured audio or video and directly save the data to a file, The recorded data will be the same as the data publishing through the specified channel.

  • Caution: Developers should not [stopPreview] or [stopPublishingStream] during recording, otherwise the SDK will end the current recording task. The data of the media player needs to be mixed into the publishing stream to be recorded.
  • Related callbacks: Developers will receive the [onCapturedDataRecordStateUpdate] and the [onCapturedDataRecordProgressUpdate] callback after start recording.
  • Available since: 1.10.0
  • Restrictions: None.

stopRecordingCapturedData:

stopRecordingCapturedData:
- (void)stopRecordingCapturedData:(ZegoPublishChannel) channel;
Stops recording locally captured audio or video.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
channelZegoPublishChannelPublishing stream channel.

Details

Stops recording locally captured audio or video.

  • When to call: After [startRecordingCapturedData].
  • Available since: 1.10.0
  • Restrictions: None.

setDataRecordEventHandler:

setDataRecordEventHandler:
- (void)setDataRecordEventHandler:(nullable id<ZegoDataRecordEventHandler>) eventHandler;
Sets up the event callback handler for data recording.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
eventHandlernullable id<ZegoDataRecordEventHandler>Data record event handler.

Details

Implemente the functions of ZegoDataRecordEventHandler to get notified when recode state and process changed.

  • When to call: After [createEngine].
  • Available since: 1.10.0
  • Restrictions: None.

startPerformanceMonitor:

startPerformanceMonitor:
- (void)startPerformanceMonitor:(unsigned int) millisecond;
Start system performance monitoring.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
millisecondunsigned intMonitoring time period(in milliseconds), the value range is [1000, 10000]. Default value is 2000 ms.

Details

Start system performance monitoring, monitor system or App's CPU usage and memory usage. Support set the monitoring interval.

  • Use cases: Monitor system performance can help user quickly locate and solve performance problems and improve user experience.
  • When to call: It needs to be called after [createEngine].
  • Related callbacks: After starting monitoring, you can receive system performance status via [onPerformanceStatusUpdate] callback. [onPerformanceStatusUpdate] callback notification period is the value set by millisecond parameter.
  • Related APIs: Call [stopPerformanceMonitor] to stop system performance monitoring.
  • Available since: 1.19.0
  • Restrictions: None.

stopPerformanceMonitor

stopPerformanceMonitor
- (void)stopPerformanceMonitor;
Stop system performance monitoring.
Declared in ZegoExpressEngine.h

Stop system performance monitoring. After the monitoring is stopped, the [onPerformanceStatusUpdate] callback will not triggered.

  • Use cases: Monitor system performance can help user quickly locate and solve performance problems and improve user experience.
  • When to call: It needs to be called after [createEngine].
  • Related APIs: Call [startPerformanceMonitor] to start system performance monitoring.
  • Available since: 1.19.0
  • Restrictions: None.

startNetworkProbe:callback:

startNetworkProbe:callback:
- (void)startNetworkProbe:(ZegoNetworkProbeConfig *) config callback:(nullable ZegoNetworkProbeResultCallback) callback;
Start network probe.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
configZegoNetworkProbeConfig *network probe config.
callbacknullable ZegoNetworkProbeResultCallbackNetwork probe result callback.

Details

Some local network problems may cause audio and video calls to fail. Using this function to probe the network protocols, assist in locating and solving related network problems.

  • Use cases: Before pushing and pulling the stream, detect and locate some possible network problems.
  • When to call: It needs to be called after [createEngine].
  • Caution: The SDK detects http, tcp, and udp in sequence internally. If the probe fails in the middle, the subsequent detection will not continue. Therefore, when reading the values ​​in the probe result, please pay attention to check if the value is nil. Network probe may take a long time. Developers can call [stopNetworkProbe] to stop network probe if needed. It is not recommended to start network probe during publishing/playing stream.
  • Related APIs: Call [stopNetworkProbe] to stop network probe.
  • Available since: 2.3.0
  • Restrictions: The SDK will not perform multiple network probe at the same time, that is, if the network probe is in progress, the SDK will ignore subsequent calls of this function.

stopNetworkProbe

stopNetworkProbe
- (void)stopNetworkProbe;
Stop network probe.
Declared in ZegoExpressEngine.h

Stop network probe.

  • Use cases: Before pushing and pulling the stream, detect and locate some possible network problems.
  • When to call: It needs to be called after [createEngine].
  • Related APIs: Call [startNetworkProbe] to start network probe.
  • Available since: 2.3.0
  • Restrictions: None.

testNetworkConnectivity:

testNetworkConnectivity:
- (void)testNetworkConnectivity:(ZegoTestNetworkConnectivityCallback) callback;
Test network connectivity.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
callbackZegoTestNetworkConnectivityCallbackNetwork connectivity test result callback notification.

Details

Test network connectivity.

startNetworkSpeedTest:

startNetworkSpeedTest:
- (void)startNetworkSpeedTest:(ZegoNetworkSpeedTestConfig *) config;
Start network speed test.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
configZegoNetworkSpeedTestConfig *Network speed test configuration.

Details

This function supports uplink/downlink network speed test when the network can be connected.

  • Use cases: This function can be used to detect whether the network environment is suitable for pushing/pulling streams with specified bitrates.
  • When to call: It needs to be called after [loginRoom]. If you call [startPublishingStream]/[startPlayingStream] while speed testing, the speed test will automatically stop.
  • Caution: Developers can register [onNetworkSpeedTestQualityUpdate] callback to get the speed test result, which will be triggered every 3 seconds. If an error occurs during the speed test process, [onNetworkSpeedTestError] callback will be triggered. If this function is repeatedly called multiple times, the last functioh call's configuration will be used.
  • Related APIs: Call [stopNetworkSpeedTest] to stop network speed test.
  • Available since: 1.20.0
  • Restrictions: The default maximum allowable test time for a single network speed test is 30 seconds.

startNetworkSpeedTest:interval:

startNetworkSpeedTest:interval:
- (void)startNetworkSpeedTest:(ZegoNetworkSpeedTestConfig *) config interval:(unsigned int) interval;
Start network speed test. Support set speed test interval。
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
configZegoNetworkSpeedTestConfig *Network speed test configuration.
intervalunsigned intInterval of network speed test. In milliseconds, default is 3000 ms.

Details

This function supports uplink/downlink network speed test when the network can be connected.

  • Use cases: This function can be used to detect whether the network environment is suitable for pushing/pulling streams with specified bitrates.
  • When to call: It needs to be called after [loginRoom]. If you call [startPublishingStream]/[startPlayingStream] while speed testing, the speed test will automatically stop.
  • Caution: Developers can register [onNetworkSpeedTestQualityUpdate] callback to get the speed test result, which will be triggered every 3 seconds. If an error occurs during the speed test process, [onNetworkSpeedTestError] callback will be triggered. If this function is repeatedly called multiple times, the last functioh call's configuration will be used.
  • Related APIs: Call [stopNetworkSpeedTest] to stop network speed test.
  • Available since: 1.20.0
  • Restrictions: The default maximum allowable test time for a single network speed test is 30 seconds.

stopNetworkSpeedTest

stopNetworkSpeedTest
- (void)stopNetworkSpeedTest;
Stop network speed test.
Declared in ZegoExpressEngine.h

Stop network speed test.

  • Use cases: This function can be used to detect whether the network environment is suitable for pushing/pulling streams with specified bitrates.
  • When to call: It needs to be called after [createEngine].
  • Caution: After the network speed test stopped, [onNetworkSpeedTestQualityUpdate] callback will not be triggered.
  • Related APIs: Call [startNetworkSpeedTest] to start network speed test.
  • Available since: 1.20.0
  • Restrictions: None.

getNetworkTimeInfo

getNetworkTimeInfo
- (ZegoNetworkTimeInfo *)getNetworkTimeInfo;
Obtain synchronization network time information.
Declared in ZegoExpressEngine.h

Obtain synchronization network time(NTP), including timestamp and maximum deviation.

  • Use cases: When performing multi-terminal synchronization behaviors, network time synchronization is required.
  • When to call: It needs to be called after [createEngine].
  • Available since: 2.9.0
  • Restrictions: None.

startDumpData:

startDumpData:
- (void)startDumpData:(ZegoDumpDataConfig *) config;
Dump audio, video data.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
configZegoDumpDataConfig *Dump data config.

Details

Dump audio, video data.

  • Use cases: This is a debugging tool. When there is a problem with audio/video capturing, 3A processing, or other environment processing during publish, you can dump the audio data and upload it to the ZEGO server for further analysis.
  • When to call: It needs to be called after [createEngine].
  • Caution: It will trigger the [onStartDumpData] callback when data dumping starts. The video dump auto-stops after 30 seconds to prevent excessive storage usage, triggering the [onStopDumpData] callback.
  • Related APIs: Call [stopDumpData] to stop dumping data.
  • Available since: 3.10.0
  • Restrictions: Only support Android and iOS to dump video.

stopDumpData

stopDumpData
- (void)stopDumpData;
Stop dumping data.
Declared in ZegoExpressEngine.h

Stop dumping data.

  • Use cases: This is a debugging tool. When there is a problem with audio capturing, 3A processing, or other environment processing during publish, you can dump the audio data and upload it to the ZEGO server for further analysis.
  • When to call: It needs to be called after [startDumpData].
  • Caution: It will trigger the [onUploadDumpData] callback.
  • Available since: 3.10.0
  • Restrictions: None.

uploadDumpData

uploadDumpData
- (void)uploadDumpData;
Upload dumped data to the ZEGO server.
Declared in ZegoExpressEngine.h

Upload dumped data to the ZEGO server.

  • Use cases: This is a debugging tool. When there is a problem with audio capturing, 3A processing, or other environment processing during publish, you can dump the audio data and upload it to the ZEGO server for further analysis.
  • When to call: It needs to be called after [stopDumpData].
  • Caution: It will trigger the [onUploadDumpData] callback when dump data uploaded.
  • Available since: 3.10.0
  • Restrictions: None.

removeDumpData

removeDumpData
- (void)removeDumpData;
Remove dumped data.
Declared in ZegoExpressEngine.h

Remove dumped data.

  • Use cases: This is a debugging tool. When there is a problem with audio capturing, 3A processing, or other environment processing during publish, you can dump the audio data and upload it to the ZEGO server for further analysis.
  • When to call: It needs to be called after [stopDumpData]. If the dump data is to be uploaded to the ZEGO server, it should be deleted after the upload is successful.
  • Available since: 3.10.0
  • Restrictions: None.

enableCustomVideoRender:config:

enableCustomVideoRender:config:
- (void)enableCustomVideoRender:(BOOL) enable config:(nullable ZegoCustomVideoRenderConfig *) config;
Enables or disables custom video rendering.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
enableBOOLenable or disable
confignullable ZegoCustomVideoRenderConfig *custom video render config

Details

When enable is true,video custom rendering is enabled; if the value of false, video custom rendering is disabled. Use case: Use beauty features or apps that use a cross-platform UI framework (for example, Qt requires a complex hierarchical UI to achieve high-experience interaction) or game engine (e.g. Unity, Unreal Engine, Cocos)

  • Default value: Custom video rendering is turned off by default when this function is not called.
  • When to call: After [createEngine], and before calling [startPreview], [startPublishingStream], [startPlayingStream], [createRealTimeSequentialDataManager]. The configuration can only be modified after the engine is stopped, that is, after [logoutRoom] is called.
  • Caution: Custom video rendering can be used in conjunction with custom video capture, but when both are enabled, the local capture frame callback for custom video rendering will no longer be called back, you should directly use the captured video frame from the custom video capture source.
  • Related callbacks: Call [setCustomVideoRenderHandler] to set the callback to get video frame data. [onCapturedVideoFrameRawData] local preview video frame data callback, [onRemoteVideoFrameRawData] remote playing stream video frame data callback.
  • Available since: 1.9.0

setCustomVideoRenderHandler:

setCustomVideoRenderHandler:
- (void)setCustomVideoRenderHandler:(nullable id<ZegoCustomVideoRenderHandler>) handler;
Sets up the event callback handler for custom video rendering.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
handlernullable id<ZegoCustomVideoRenderHandler>Custom video render handler

Details

Custom video rendering, where the developer is responsible for rendering the video data onto the UI components. With the change callback set, a callback that throws video data to the developer will be triggered when the developer calls startPreview, startPublishingStream, and startPlayingStream. Use case: Use beauty features or apps that use a cross-platform UI framework (for example, Qt requires a complex hierarchical UI to achieve high-experience interaction) or game engine (e.g. Unity, Unreal Engine, Cocos)

  • When to call: After [createEngine].
  • Related callbacks: [onCapturedVideoFrameRawData] local preview video frame data callback, [onRemoteVideoFrameRawData] remote playing stream video frame data callback.
  • Available since: 1.9.0

enableCapturedVideoCustomVideoRender:channel:

enableCapturedVideoCustomVideoRender:channel:
- (void)enableCapturedVideoCustomVideoRender:(BOOL) enable channel:(ZegoPublishChannel) channel;
Enables or disables captured video to custom video rendering.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
enableBOOLenable or disable
channelZegoPublishChannelpublish channel

Details

enable or disable custom video rendering of captured video during publish. Use case: Use beauty features or apps that use a cross-platform UI framework (for example, Qt requires a complex hierarchical UI to achieve high-experience interaction) or game engine (e.g. Unity, Unreal Engine, Cocos)

  • Default value: After [enableCustomVideoRender] enables custom video rendering, all captured videos will be used as custom video data.
  • When to call: After [enableCustomVideoRender] enables custom video rendering, call [enableCapturedVideoCustomVideoRender] to config whether the specified channel used custom video render or not.
  • Caution: You can call this API only after [enableCustomVideoRender] enables custom video rendering.Custom video rendering can be used in conjunction with custom video capture, but when both are enabled, the local capture frame callback for custom video rendering will no longer be called back, you should directly use the captured video frame from the custom video capture source.
  • Related callbacks: Call [setCustomVideoRenderHandler] to set the callback to get video frame data. [onCapturedVideoFrameRawData] local preview video frame data callback, [onRemoteVideoFrameRawData] remote playing stream video frame data callback.
  • Available since: 3.13.0

enableRemoteVideoCustomVideoRender:streamID:

enableRemoteVideoCustomVideoRender:streamID:
- (void)enableRemoteVideoCustomVideoRender:(BOOL) enable streamID:(NSString *) streamID;
Enables or disables remote playback video to custom video rendering.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
enableBOOLenable or disable
streamIDNSString *Stream ID.

Details

enable or disable custom video rendering during playback. Use case: Use beauty features or apps that use a cross-platform UI framework (for example, Qt requires a complex hierarchical UI to achieve high-experience interaction) or game engine (e.g. Unity, Unreal Engine, Cocos)

  • Default value: After [enableCustomVideoRender] enables custom video rendering, all remote playback videos will be used as custom video data.
  • When to call: After [enableCustomVideoRender] enables custom video rendering, call [enableRemoteVideoCustomVideoRender] to config whether the specified stream used custom video render or not.
  • Caution: You can call this API only after [enableCustomVideoRender] enables custom video rendering.
  • Related callbacks: Call [setCustomVideoRenderHandler] to set the callback to get video frame data. [onCapturedVideoFrameRawData] local preview video frame data callback, [onRemoteVideoFrameRawData] remote playing stream video frame data callback.
  • Available since: 3.13.0

enableCustomVideoCapture:config:

enableCustomVideoCapture:config:
- (void)enableCustomVideoCapture:(BOOL) enable config:(nullable ZegoCustomVideoCaptureConfig *) config;
Enables or disables custom video capture.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
enableBOOLenable or disable
confignullable ZegoCustomVideoCaptureConfig *custom video capture config

Details

If the value of enable is true, the video collection function is enabled. If the value of enable is false, the video collection function is disabled. Use case: The App developed by the developer uses the beauty SDK of a third-party beauty manufacturer to broadcast non-camera collected data.

  • Default value: When this function is not called, custom video collection is disabled by default.
  • When to call: After [createEngine], call [startPreview], [startPublishingStream], [createRealTimeSequentialDataManager], and call [logoutRoom] to modify the configuration.
  • Caution: Custom video rendering can be used in conjunction with custom video capture, but when both are enabled, the local capture frame callback for custom video rendering will no longer be triggered, and the developer should directly capture the captured video frame from the custom video capture source.
  • Related callbacks: When developers to open a custom collection, by calling [setCustomVideoCaptureHandler] can be set up to receive a custom collection start-stop event notification.
  • Available since: 1.9.0

enableCustomVideoCapture:config:channel:

enableCustomVideoCapture:config:channel:
- (void)enableCustomVideoCapture:(BOOL) enable config:(nullable ZegoCustomVideoCaptureConfig *) config channel:(ZegoPublishChannel) channel;
Enables or disables custom video capture (for the specified channel).
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
enableBOOLenable or disable
confignullable ZegoCustomVideoCaptureConfig *custom video capture config
channelZegoPublishChannelpublish channel

Details

If the value of enable is true, the video collection function is enabled. If the value of enable is false, the video collection function is disabled. Use case: The App developed by the developer uses the beauty SDK of a third-party beauty manufacturer to broadcast non-camera collected data.

  • Default value: When this function is not called, custom video collection is disabled by default.
  • When to call: After [createEngine], call [startPreview], [startPublishingStream], [createRealTimeSequentialDataManager], and call [logoutRoom] to modify the configuration.
  • Caution: Custom video rendering can be used in conjunction with custom video capture, but when both are enabled, the local capture frame callback for custom video rendering will no longer be triggered, and the developer should directly capture the captured video frame from the custom video capture source.
  • Related callbacks: When developers to open a custom collection, by calling [setCustomVideoCaptureHandler] can be set up to receive a custom collection start-stop event notification.
  • Available since: 1.9.0

setCustomVideoCaptureHandler:

setCustomVideoCaptureHandler:
- (void)setCustomVideoCaptureHandler:(nullable id<ZegoCustomVideoCaptureHandler>) handler;
Sets the event callback handler for custom video capture.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
handlernullable id<ZegoCustomVideoCaptureHandler>Custom video capture handler

Details

Example Set the callback for custom video capture. That is, the developer is responsible for collecting video data, and sends the collected video data to the SDK for coding and pushing the video data to the ZEGO RTC server. Use case: This feature is typically used by developers using third-party beauty features or livestreaming of games.

  • When to call: After [createEngine] .
  • Caution: In the case of customized video collection, the SDK will not start the camera to collect video data, and developers need to collect video data from the video collection source. A callback notifying the developer that it can start sending video data is triggered when the developer calls [startPreview] to start pushing the stream to [startPublishingStream]. A callback notifying the developer that it can stop sending video data is triggered when [stopPreview] and [stopPublishingStream].
  • Related callbacks: [onStart] Starts collection, and [onStop] stops collection.
  • Available since: 1.9.0

sendCustomVideoCaptureTextureData:size:timestamp:

sendCustomVideoCaptureTextureData:size:timestamp:
- (void)sendCustomVideoCaptureTextureData:(GLuint) textureID size:(CGSize) size timestamp:(CMTime) timestamp;
Sends the video frames (Texture Data) produced by custom video capture to the SDK.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
textureIDGLuinttexture ID
sizeCGSizeVideo frame width and height
timestampCMTimeTimestamp of this video frame

Details

Send custom captured video frame type GL_TEXTURE_2D data to the SDK.

  • When to call: After receiving the [onStart] notification, the developer starts the call after the collection logic starts and ends the call after the [onStop] notification.
  • Caution: Calling this interface must be [enableCustomVideoCapture] with an argument of type GL_TEXTURE_2D or GL_TEXTURE_EXTERNAL_OES.
  • Related APIs: [enableCustomVideoCapture], [setCustomVideoCaptureHandler].
  • Available since: 1.9.0

sendCustomVideoCaptureTextureData:size:timestamp:channel:

sendCustomVideoCaptureTextureData:size:timestamp:channel:
- (void)sendCustomVideoCaptureTextureData:(GLuint) textureID size:(CGSize) size timestamp:(CMTime) timestamp channel:(ZegoPublishChannel) channel;
Sends the video frames (Texture Data) produced by custom video capture to the SDK (for the specified channel).
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
textureIDGLuinttexture ID
sizeCGSizeVideo frame width and height
timestampCMTimeTimestamp of this video frame
channelZegoPublishChannelPublishing stream channel

Details

Send custom captured video frame type GL_TEXTURE_2D data to the SDK.

  • When to call: After receiving the [onStart] notification, the developer starts the call after the collection logic starts and ends the call after the [onStop] notification.
  • Caution: Calling this interface must be [enableCustomVideoCapture] with an argument of type GL_TEXTURE_2D or GL_TEXTURE_EXTERNAL_OES.
  • Related APIs: [enableCustomVideoCapture], [setCustomVideoCaptureHandler].
  • Available since: 1.9.0

sendCustomVideoCapturePixelBuffer:timestamp:

sendCustomVideoCapturePixelBuffer:timestamp:
- (void)sendCustomVideoCapturePixelBuffer:(CVPixelBufferRef) buffer timestamp:(CMTime) timestamp;
Sends the video frames (CVPixelBuffer) produced by custom video capture to the SDK.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
bufferCVPixelBufferRefVideo frame data to send to the SDK
timestampCMTimeTimestamp of this video frame

Details

Send custom captured video frame type CVPixelBuffer data to the SDK.

  • When to call: After receiving the [onStart] notification, the developer starts the call after the collection logic starts and ends the call after the [onStop] notification.
  • Caution: Calling this interface must be [enableCustomVideoCapture] with an argument of type ZegoVideoBufferTypeCVPixelBuffer.
  • Related APIs: [enableCustomVideoCapture], [setCustomVideoCaptureHandler].
  • Available since: 1.9.0

sendCustomVideoCapturePixelBuffer:timestamp:channel:

sendCustomVideoCapturePixelBuffer:timestamp:channel:
- (void)sendCustomVideoCapturePixelBuffer:(CVPixelBufferRef) buffer timestamp:(CMTime) timestamp channel:(ZegoPublishChannel) channel;
Sends the video frames (CVPixelBuffer) produced by custom video capture to the SDK (for the specified channel).
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
bufferCVPixelBufferRefVideo frame data to send to the SDK
timestampCMTimeTimestamp of this video frame
channelZegoPublishChannelPublishing stream channel

Details

Send custom captured video frame type CVPixelBuffer data to the SDK.

  • When to call: After receiving the [onStart] notification, the developer starts the call after the collection logic starts and ends the call after the [onStop] notification.
  • Caution: Calling this interface must be [enableCustomVideoCapture] with an argument of type ZegoVideoBufferTypeCVPixelBuffer.
  • Related APIs: [enableCustomVideoCapture], [setCustomVideoCaptureHandler].
  • Available since: 1.9.0

sendCustomVideoCaptureEncodedData:params:timestamp:

sendCustomVideoCaptureEncodedData:params:timestamp:
- (void)sendCustomVideoCaptureEncodedData:(NSData *) data params:(ZegoVideoEncodedFrameParam *) params timestamp:(CMTime) timestamp;
Sends the video frames (Encoded Data) produced by custom video capture to the SDK.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
dataNSData *video encoded frame data
paramsZegoVideoEncodedFrameParam *video encoded frame param
timestampCMTimevideo frame reference time, UNIX timestamp.

Details

Send custom captured video frame type CVPixelBuffer data to the SDK.

  • When to call: After receiving the [onStart] notification, the developer starts the call after the collection logic starts and ends the call after the [onStop] notification.
  • Caution: It is recommended to make a GOP every 2s; each I frame must carry SPS and PPS which should be placed at the front of the data; the SPS, PPS and I frame need to be combined into one frame for transmission. Before calling this API, you need to ensure that the parameter type specified when calling [enableCustomVideoCapture] is [EncodedData]
  • Related APIs: [enableCustomVideoCapture], [setCustomVideoCaptureHandler].
  • Available since: 1.9.0

sendCustomVideoCaptureEncodedData:params:timestamp:channel:

sendCustomVideoCaptureEncodedData:params:timestamp:channel:
- (void)sendCustomVideoCaptureEncodedData:(NSData *) data params:(ZegoVideoEncodedFrameParam *) params timestamp:(CMTime) timestamp channel:(ZegoPublishChannel) channel;
Sends the video frames (Encoded Data) produced by custom video capture to the SDK (for the specified channel).
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
dataNSData *video frame encoded data
paramsZegoVideoEncodedFrameParam *video frame param
timestampCMTimevideo frame reference time, UNIX timestamp.
channelZegoPublishChannelPublishing stream channel

Details

Send custom captured video frame type CVPixelBuffer data to the SDK.

  • When to call: After receiving the [onStart] notification, the developer starts the call after the collection logic starts and ends the call after the [onStop] notification.
  • Caution: It is recommended to make a GOP every 2s; each I frame must carry SPS and PPS which should be placed at the front of the data; the SPS, PPS and I frame need to be combined into one frame for transmission. Before calling this API, you need to ensure that the parameter type specified when calling [enableCustomVideoCapture] is [EncodedData]
  • Related APIs: [enableCustomVideoCapture], [setCustomVideoCaptureHandler].
  • Available since: 1.9.0

setCustomVideoCaptureFillMode:

setCustomVideoCaptureFillMode:
- (void)setCustomVideoCaptureFillMode:(ZegoViewMode) mode;
Sets the video fill mode of custom video capture.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
modeZegoViewModeView mode

Details

When the custom video collection function is enabled, you can use this interface to set the video zooming and filling mode.

  • Use cases: If the customized collection resolution and SDK coding resolution are inconsistent, THE SDK will process the video frame according to the fill mode and adjust it to the coding resolution.
  • When to call: Before [sendCustomVideoCaptureRawData], [sendCustomVideoCaptureTextureData], [sendCustomVideoCapturePixelBuffer], [sendCustomVideoCaptureEncodedData].
  • Available since: 1.10.0

setCustomVideoCaptureFillMode:channel:

setCustomVideoCaptureFillMode:channel:
- (void)setCustomVideoCaptureFillMode:(ZegoViewMode) mode channel:(ZegoPublishChannel) channel;
Sets the video fill mode of custom video capture (for the specified channel).
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
modeZegoViewModeView mode
channelZegoPublishChannelPublishing stream channel

Details

When the custom video collection function is enabled, you can use this interface to set the video zooming and filling mode.

  • Use cases: If the customized collection resolution and SDK coding resolution are inconsistent, THE SDK will process the video frame according to the fill mode and adjust it to the coding resolution.
  • When to call: Before [sendCustomVideoCaptureRawData], [sendCustomVideoCaptureTextureData], [sendCustomVideoCapturePixelBuffer], [sendCustomVideoCaptureEncodedData].
  • Available since: 1.10.0

setCustomVideoCaptureFlipMode:

setCustomVideoCaptureFlipMode:
- (void)setCustomVideoCaptureFlipMode:(ZegoVideoFlipMode) mode;
Sets the video flip mode of custom video capture (for the specified channel). This function takes effect only if the custom video buffer type is Texture2D.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
modeZegoVideoFlipModeFlip mode

Details

When the custom video collection function is enabled, you can use this interface to set the video flipping mode.

  • When to call: Before [sendCustomVideoCaptureRawData], [sendCustomVideoCaptureTextureData], [sendCustomVideoCapturePixelBuffer], [sendCustomVideoCaptureEncodedData].
  • Caution: This function takes effect only if the custom collection type is Texture2D.
  • Available since: 1.10.0

setCustomVideoCaptureFlipMode:channel:

setCustomVideoCaptureFlipMode:channel:
- (void)setCustomVideoCaptureFlipMode:(ZegoVideoFlipMode) mode channel:(ZegoPublishChannel) channel;
Sets the video flip mode of custom video capture (for the specified channel). This function takes effect only if the custom video buffer type is Texture2D.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
modeZegoVideoFlipModeFlip mode
channelZegoPublishChannelPublishing stream channel

Details

When the custom video collection function is enabled, you can use this interface to set the video flipping mode.

  • When to call: Before [sendCustomVideoCaptureRawData], [sendCustomVideoCaptureTextureData], [sendCustomVideoCapturePixelBuffer], [sendCustomVideoCaptureEncodedData].
  • Caution: This function takes effect only if the custom collection type is Texture2D.
  • Available since: 1.10.0

setCustomVideoCaptureRotation:channel:

setCustomVideoCaptureRotation:channel:
- (void)setCustomVideoCaptureRotation:(int) rotation channel:(ZegoPublishChannel) channel;
Sets the video rotation of custom video capture (for the specified channel).
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
rotationintClockwise angle.
channelZegoPublishChannelPublishing stream channel

Details

You can set the video rotation of custom video capture (for the specified channel) through this function.

  • When to call: After the callback [onStart] is received.
  • Available since: 2.14.0.
  • Restrictions: This function takes effect when the custom acquisition type is CVPixelBuffer or Texture2D.

setCustomVideoCaptureDeviceState:state:channel:

setCustomVideoCaptureDeviceState:state:channel:
- (void)setCustomVideoCaptureDeviceState:(BOOL) isEnable state:(ZegoRemoteDeviceState) state channel:(ZegoPublishChannel) channel;
Sets device state of custom video capture (for the specified channel).
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
isEnableBOOLWhether the device is enable.
stateZegoRemoteDeviceStateThe device state.
channelZegoPublishChannelPublishing stream channel

Details

User can set the video device state of custom video capture (for the specified channel) through this function.

  • When to call: After the callback [onStart] is received.
  • Available since: 2.15.0.
  • Restrictions: None. Related Callbacks: The remote user that play stream of local user publishing stream can receive state update notification by monitoring [onRemoteCameraStateUpdate] callbacks.

setCustomVideoCaptureRegionOfInterest:channel:

setCustomVideoCaptureRegionOfInterest:channel:
- (void)setCustomVideoCaptureRegionOfInterest:(NSArray<ZegoRoiRect *> *) rectList channel:(ZegoPublishChannel) channel;
Set the region of interest (ROI) for encoder of custom video capture (for the specified channel).
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
rectListNSArray<ZegoRoiRect *> *ROI rectangle area list, currently supports up to 6 areas.
channelZegoPublishChannelPublish channel

Details

You can set the video encoder's region of interest rectangle areas of custom video capture (for the specified channel) through this function.

  • When to call: After the callback [onStart] is received.
  • Caution: This function is currently an experimental feature, please contact ZEGO technical support before using it.
  • Available since: 2.16.0.
  • Restrictions: Currently, only certain video encoders support this function, please contact ZEGO technical support before using it.

prepareForReplayKit

prepareForReplayKit
- (void)prepareForReplayKit;
Initialize the Express ReplayKit module.
Declared in ZegoExpressEngine.h

Only use in the ReplayKit sub-process, don't use it in the main App process

setReplayKitMicrophoneVolume:

setReplayKitMicrophoneVolume:
- (void)setReplayKitMicrophoneVolume:(int) volume;
Set ReplayKit Microphone volume
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
volumeintThe range is 0 ~ 200. The default is 100.

Details

Set Microphone audio volume for ReplayKit.

  • Use cases: Set Microphone audio volume in the game live scenarios.
  • When to call /Trigger: This function needs to be called after the success of [startPreview] or [startPublishingStream] to be effective.
  • Caution: This function affects the audio volume of type RPSampleBufferTypeAudioMic.
  • Related APIs: [setReplayKitApplicationVolume] function can set the Application audio volume for ReplayKit.
  • Available since: 2.13.0
  • Restrictions: None.

setReplayKitApplicationVolume:

setReplayKitApplicationVolume:
- (void)setReplayKitApplicationVolume:(int) volume;
Set ReplayKit Application volume
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
volumeintThe range is 0 ~ 200. The default is 100.

Details

Set Application audio volume for ReplayKit.

  • Use cases: Set Application audio volume in the game live scenarios.
  • When to call /Trigger: This function needs to be called after the success of [startPreview] or [startPublishingStream] to be effective.
  • Caution: This function affects the audio volume of type RPSampleBufferTypeAudioApp.
  • Related APIs: [setReplayKitMicrophoneVolume] function can set the Microphone audio volume for ReplayKit.
  • Available since: 2.13.0
  • Restrictions: None.

handleReplayKitSampleBuffer:bufferType

handleReplayKitSampleBuffer:bufferType
- (void)handleReplayKitSampleBuffer:(CMSampleBufferRef)sampleBuffer bufferType:(RPSampleBufferType)bufferType API_AVAILABLE(ios(10.0));
Handles ReplayKit's SampleBuffer, supports receiving video and audio buffer.
Declared in ZegoExpressEngine.h
NameTypeDescription
sampleBufferCMSampleBufferRefVideo or audio buffer returned by ReplayKit
bufferTypeRPSampleBufferTypeBuffer type returned by ReplayKit

enableCustomVideoProcessing:config:

enableCustomVideoProcessing:config:
- (void)enableCustomVideoProcessing:(BOOL) enable config:(nullable ZegoCustomVideoProcessConfig *) config;
Enables or disables custom video processing.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
enableBOOLenable or disable. Required: Yes.
confignullable ZegoCustomVideoProcessConfig *custom video processing configuration. Required: Yes.Caution: If nil is passed, the platform default value is used.

Details

When the developer opens custom pre-processing, by calling [setCustomVideoProcessHandler] you can set the custom video pre-processing callback.

  • Use cases: After the developer collects the video data by himself or obtains the video data collected by the SDK, if the basic beauty and watermark functions of the SDK cannot meet the needs of the developer (for example, the beauty effect cannot meet the expectations), the ZegoEffects SDK can be used to perform the video Some special processing, such as beautifying, adding pendants, etc., this process is the pre-processing of custom video.
  • Default value: Off by default
  • When to call: Must be set before calling [startPreview], [startPublishingStream], [createRealTimeSequentialDataManager]. If you need to modify the configuration, please call [logoutRoom] to log out of the room first, otherwise it will not take effect.
  • Related APIs: Call the [setCustomVideoProcessHandler] function to set the callback before custom video processing.
  • Available since: 2.2.0 (Android/iOS/macOS native), 2.4.0 (Windows/macOS C++).
  • Restrictions: None.

enableCustomVideoProcessing:config:channel:

enableCustomVideoProcessing:config:channel:
- (void)enableCustomVideoProcessing:(BOOL) enable config:(nullable ZegoCustomVideoProcessConfig *) config channel:(ZegoPublishChannel) channel;
Enables or disables custom video processing, and support specifying the publish channel.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
enableBOOLenable or disable. Required: Yes.
confignullable ZegoCustomVideoProcessConfig *custom video processing configuration. Required: Yes.Caution: If nil is passed, the platform default value is used.
channelZegoPublishChannelPublishing stream channel.Required: No.Default value: Main publish channel.

Details

When the developer opens custom pre-processing, by calling [setCustomVideoProcessHandler] you can set the custom video pre-processing callback.

  • Use cases: After the developer collects the video data by himself or obtains the video data collected by the SDK, if the basic beauty and watermark functions of the SDK cannot meet the needs of the developer (for example, the beauty effect cannot meet the expectations), the ZegoEffects SDK can be used to perform the video Some special processing, such as beautifying, adding pendants, etc., this process is the pre-processing of custom video.
  • Default value: Off by default
  • When to call: Must be set before calling [startPreview], [startPublishingStream], [createRealTimeSequentialDataManager]. If you need to modify the configuration, please call [logoutRoom] to log out of the room first, otherwise it will not take effect.
  • Related APIs: Call the [setCustomVideoProcessHandler] function to set the callback before custom video processing.
  • Available since: 2.2.0 (Android/iOS/macOS native), 2.4.0 (Windows/macOS C++).
  • Restrictions: None.

setCustomVideoProcessHandler:

setCustomVideoProcessHandler:
- (void)setCustomVideoProcessHandler:(nullable id<ZegoCustomVideoProcessHandler>) handler;
Sets up the event callback handler for custom video processing.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
handlernullable id<ZegoCustomVideoProcessHandler>Custom video process handler.Required: Yes.

Details

When the developer opens the custom pre-processing, by calling [setCustomVideoProcessHandler], you can set the custom video pre-processing callback to obtain the original video data.

  • Use cases: After the developer collects the video data by himself or obtains the video data collected by the SDK, if the basic beauty and watermark functions of the SDK cannot meet the needs of the developer (for example, the beauty effect cannot meet the expectations), the ZegoEffects SDK can be used to perform the video Some special processing, such as beautifying, adding pendants, etc., this process is the pre-processing of custom video.
  • When to call: Called before [startPreview], [startPublishingStream] and [createRealTimeSequentialDataManager], otherwise it may cause the timing of obtaining video data to be too slow.
  • Related APIs: Call [enableCustomVideoProcessing] function to enable custom video pre-processing callback.
  • Available since: 2.2.0 (Android/iOS/macOS native), 2.4.0 (Windows/macOS C++).
  • Restrictions: None.

sendCustomVideoProcessedCVPixelBuffer:timestamp:

sendCustomVideoProcessedCVPixelBuffer:timestamp:
- (void)sendCustomVideoProcessedCVPixelBuffer:(CVPixelBufferRef) buffer timestamp:(CMTime) timestamp;
Send the [CVPixelBuffer] type video data after the custom video processing to the SDK (for the specified channel).
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
bufferCVPixelBufferRefCVPixelBuffer type video frame data to be sent to the SDK.Required: Yes.
timestampCMTimeTimestamp of this video frame.Required: Yes.

Details

When the custom video pre-processing is turned on, the [CVPixelBuffer] format video data after the custom video pre-processing is sent to the SDK, and other channels are supported.

  • Use cases: After the developer collects the video data by himself or obtains the video data collected by the SDK, if the basic beauty and watermark functions of the SDK cannot meet the needs of the developer (for example, the beauty effect cannot meet the expectations), the ZegoEffects SDK can be used to perform the video Some special processing, such as beautifying, adding pendants, etc., this process is the pre-processing of custom video.
  • When to call: Must be called in the [onCapturedUnprocessedCVPixelbuffer] callback.
  • Platform differences: Only valid on Windows platform.
  • Available since: 2.2.0 (iOS native), 2.4.0 (macOS C++).
  • Restrictions: This interface takes effect when [enableCustomVideoProcessing] is called to enable custom video pre-processing and the bufferType of config is passed in [ZegoVideoBufferTypeCVPixelBuffer] or [ZegoVideoBufferTypeNV12CVPixelBuffer].

sendCustomVideoProcessedCVPixelBuffer:timestamp:channel:

sendCustomVideoProcessedCVPixelBuffer:timestamp:channel:
- (void)sendCustomVideoProcessedCVPixelBuffer:(CVPixelBufferRef) buffer timestamp:(CMTime) timestamp channel:(ZegoPublishChannel) channel;
Send the [CVPixelBuffer] type video data after the custom video processing to the SDK (for the specified channel).
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
bufferCVPixelBufferRefCVPixelBuffer type video frame data to be sent to the SDK.
timestampCMTimeTimestamp of this video frame.
channelZegoPublishChannelPublishing stream channel.

Details

When the custom video pre-processing is turned on, the [CVPixelBuffer] format video data after the custom video pre-processing is sent to the SDK, and other channels are supported.

  • Use cases: After the developer collects the video data by himself or obtains the video data collected by the SDK, if the basic beauty and watermark functions of the SDK cannot meet the needs of the developer (for example, the beauty effect cannot meet the expectations), the ZegoEffects SDK can be used to perform the video Some special processing, such as beautifying, adding pendants, etc., this process is the pre-processing of custom video.
  • When to call: Must be called in the [onCapturedUnprocessedCVPixelbuffer] callback.
  • Platform differences: Only valid on Windows platform.
  • Available since: 2.2.0 (iOS native), 2.4.0 (macOS C++).
  • Restrictions: This interface takes effect when [enableCustomVideoProcessing] is called to enable custom video pre-processing and the bufferType of config is passed in [ZegoVideoBufferTypeCVPixelBuffer] or [ZegoVideoBufferTypeNV12CVPixelBuffer].

sendCustomVideoProcessedCVPixelBuffer:timestamp:usage:channel:

sendCustomVideoProcessedCVPixelBuffer:timestamp:usage:channel:
- (void)sendCustomVideoProcessedCVPixelBuffer:(CVPixelBufferRef) buffer timestamp:(CMTime) timestamp usage:(ZegoProcessedDataUsageType) usage channel:(ZegoPublishChannel) channel;
Send the [CVPixelBuffer] type video data after the custom video processing to the SDK (for the specified channel), and support specified data usage.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
bufferCVPixelBufferRefCVPixelBuffer type video frame data to be sent to the SDK.
timestampCMTimeTimestamp of this video frame.
usageZegoProcessedDataUsageTypeData usage
channelZegoPublishChannelPublishing stream channel.

Details

When the custom video pre-processing is turned on, the [CVPixelBuffer] format video data after the custom video pre-processing is sent to the SDK, and other channels are supported.

  • Use cases: After the developer collects the video data by himself or obtains the video data collected by the SDK, if the basic beauty and watermark functions of the SDK cannot meet the needs of the developer (for example, the beauty effect cannot meet the expectations), the ZegoEffects SDK can be used to perform the video Some special processing, such as beautifying, adding pendants, etc., this process is the pre-processing of custom video.
  • When to call: Must be called in the [onCapturedUnprocessedCVPixelbuffer] callback.
  • Platform differences: Only valid on Windows platform.
  • Available since: 3.14.0 (iOS native, macOS C++).
  • Restrictions: This interface takes effect when [enableCustomVideoProcessing] is called to enable custom video pre-processing and the bufferType of config is passed in [ZegoVideoBufferTypeCVPixelBuffer] or [ZegoVideoBufferTypeNV12CVPixelBuffer].

enableCustomAudioCaptureProcessing:config:

enableCustomAudioCaptureProcessing:config:
- (void)enableCustomAudioCaptureProcessing:(BOOL) enable config:(ZegoCustomAudioProcessConfig *) config;
Enable local collection and custom audio processing(before ear return).
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
enableBOOLWhether to enable local capture custom audio processing.
configZegoCustomAudioProcessConfig *Custom audio processing configuration.

Details

Enable custom audio processing(before ear return), developers can receive locally collected audio frames through [onProcessCapturedAudioData], and can modify the audio data.

  • Use cases: If the developer wants to implement special functions (such as voice change, bel canto, etc.) through custom processing after the audio data is collected or before the remote audio data is drawn for rendering.
  • When to call: It needs to be called before [startPublishingStream], [startPlayingStream], [startPreview], [createMediaPlayer], [createAudioEffectPlayer] and [createRealTimeSequentialDataManager] to be effective.
  • Available since: 1.13.0
  • Restrictions: None.

enableCustomAudioCaptureProcessingAfterHeadphoneMonitor:config:

enableCustomAudioCaptureProcessingAfterHeadphoneMonitor:config:
- (void)enableCustomAudioCaptureProcessingAfterHeadphoneMonitor:(BOOL) enable config:(ZegoCustomAudioProcessConfig *) config;
Turn on local collection and custom audio processing (after ear return).
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
enableBOOLWhether to enable local capture custom audio processing.
configZegoCustomAudioProcessConfig *Custom audio processing configuration.

Details

Enable custom audio processing(after ear return), developers can receive locally collected audio frames through [onProcessCapturedAudioData], and can modify the audio data.

  • Use cases: If the developer wants to implement special functions (such as voice change, bel canto, etc.) through custom processing after the audio data is collected or before the remote audio data is drawn for rendering.
  • When to call: It needs to be called before [startPublishingStream], [startPlayingStream], [startPreview], [createMediaPlayer], [createAudioEffectPlayer] and [createRealTimeSequentialDataManager] to be effective.
  • Available since: 1.13.0
  • Restrictions: None.

enableAlignedAudioAuxData:param:

enableAlignedAudioAuxData:param:
- (void)enableAlignedAudioAuxData:(BOOL) enable param:(ZegoAudioFrameParam *) param;
Enable feature of throwing audio aux frames which aligned with accompany.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
enableBOOLWhether to enable the feature of throwing alignmented audio aux frames.
paramZegoAudioFrameParam *param of audio frame. Currently supports 8k, 16k, 32k, 44.1k, 48k sampling rate, mono or stereo.

Details

Enable feature of throwing audio aux frames which aligned with accompany, and developers can receive the aligned audio aux frame through [onAlignedAudioAuxData].

  • Use cases: In KTV scene, this function can be used if the user wants to record voice and accompaniment for free processing.
  • When to call: It needs to be called after [createEngine] to be effective.
  • Caution: When throwing onAlignedAudioAuxData audio aux frames is enabled, the streaming data of [startPublishingStream] does not contain audio aux frames.
  • Available since: 2.22.0
  • Restrictions: None.

enableBeforeAudioPrepAudioData:param:

enableBeforeAudioPrepAudioData:param:
- (void)enableBeforeAudioPrepAudioData:(BOOL) enable param:(ZegoAudioFrameParam *) param;
Enable the feature of throwing audio data before SDK internal audio preprocessing.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
enableBOOLWhether to enable feature of throwing audio data before SDK internal audio preprocessing.
paramZegoAudioFrameParam *param of audio frame. Currently, it supports sampling rates of 0, 16k, 32k, 44.1k, and 48k. The 0 means using SDK internal value. It supports channels Unknown, Mono, and Stereo. The Unknown means using SDK internal value.

Details

Enables the feature of throwing audio data before SDK internal audio preprocessing, and developers can receive audio data before SDK internal audio preprocessing through [onBeforeAudioPrepAudioData].

  • When to call: It needs to be called after [createEngine] to be effective.
  • Available since: 3.11.0
  • Restrictions: None.

enableCustomAudioRemoteProcessing:config:

enableCustomAudioRemoteProcessing:config:
- (void)enableCustomAudioRemoteProcessing:(BOOL) enable config:(ZegoCustomAudioProcessConfig *) config;
Enable custom audio processing for remote playing stream.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
enableBOOLWhether to enable custom audio processing for remote playing stream.
configZegoCustomAudioProcessConfig *Custom audio processing configuration.

Details

Enable remote streaming custom audio processing, developers can receive remote streaming audio frames through [onProcessRemoteAudioData], and can modify the audio data.

  • Use cases: If the developer wants to implement special functions (such as voice change, bel canto, etc.) through custom processing before pulling the remote audio data for rendering.
  • When to call: It needs to be called before [startPublishingStream], [startPlayingStream], [startPreview], [createMediaPlayer], [createAudioEffectPlayer] and [createRealTimeSequentialDataManager] to be effective.
  • Available since: 1.13.0
  • Restrictions: None.

enableCustomAudioPlaybackProcessing:config:

enableCustomAudioPlaybackProcessing:config:
- (void)enableCustomAudioPlaybackProcessing:(BOOL) enable config:(ZegoCustomAudioProcessConfig *) config;
Enable custom audio processing for SDK playback audio data.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
enableBOOLWhether to enable custom audio processing for SDK playback audio data.
configZegoCustomAudioProcessConfig *Custom audio processing configuration.

Details

Enable remote streaming custom audio processing, developers can receive remote streaming audio frames through [onProcessPlaybackAudioData], and can modify the audio data.

  • Use cases: If the developer wants to implement special functions (such as voice change, bel canto, etc.) through custom processing after collecting audio data.
  • When to call: It needs to be called before [startPublishingStream], [startPlayingStream], [startPreview], [createMediaPlayer], [createAudioEffectPlayer] and [createRealTimeSequentialDataManager] to be effective.
  • Available since: 1.13.0
  • Restrictions: None.

setCustomAudioProcessHandler:

setCustomAudioProcessHandler:
- (void)setCustomAudioProcessHandler:(nullable id<ZegoCustomAudioProcessHandler>) handler;
Set up callback handler for custom audio processing.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
handlernullable id<ZegoCustomAudioProcessHandler>Callback handler for custom audio processing.

Details

When the custom audio processing is enabled, the custom audio processing callback is set through this function, and the developer can modify the processed audio frame data in the callback.

  • Use cases: If the developer wants to implement special functions (such as voice change, bel canto, etc.) through custom processing after the audio data is collected or before the remote audio data is drawn for rendering.
  • When to call: After creating the engine.
  • Available since: 1.13.0
  • Restrictions: None.

startAudioDataObserver:param:

startAudioDataObserver:param:
- (void)startAudioDataObserver:(ZegoAudioDataCallbackBitMask) observerBitMask param:(ZegoAudioFrameParam *) param;
Enable audio data observering.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
observerBitMaskZegoAudioDataCallbackBitMaskThe callback function bitmask marker for receive audio data, refer to enum [ZegoAudioDataCallbackBitMask], when this param converted to binary, 0b01 that means 1 << 0 for triggering [onCapturedAudioData], 0x10 that means 1 << 1 for triggering [onPlaybackAudioData], 0x100 that means 1 << 2 for triggering [onMixedAudioData], 0x1000 that means 1 << 3 for triggering [onPlayerAudioData]. The masks can be combined to allow different callbacks to be triggered simultaneously.
paramZegoAudioFrameParam *param of audio frame.

Details

When custom audio processing is turned on, use this function to turn on audio data callback monitoring.

  • Use cases: When develop need to monitor the original audio.
  • When to call: After creating the engine.
  • Caution: This api will start the media engine and occupy the microphone device.
  • Available since: 1.1.0
  • Restrictions: Audio monitoring is triggered only after this function has been called and the callback has been set by calling [setAudioDataHandler]. If you want to enable the [onPlayerAudioData] callback, you must also be in the pull stream, and the incoming sampling rate of the [startAudioDataObserver] function is not supported at 8000Hz, 22050Hz, and 24000Hz.

stopAudioDataObserver

stopAudioDataObserver
- (void)stopAudioDataObserver;
Disable audio data observering.
Declared in ZegoExpressEngine.h

Disable audio data observering.

  • Use cases: When develop need to monitor the original audio.
  • When to call: After calling [startAudioDataObserver] to start audio data monitoring.
  • Available since: 1.1.0

setAudioDataHandler:

setAudioDataHandler:
- (void)setAudioDataHandler:(nullable id<ZegoAudioDataHandler>) handler;
Sets up the event callback handler for receiving audio data.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
handlernullable id<ZegoAudioDataHandler>Audio data handler for receive audio data.

Details

This function can be called to receive audio data thrown by SDK bypass.

  • Use cases: When the developer needs to obtain the audio data of the remote user or the data collected by the local microphone for other purposes (such as pure audio recording, pure audio third-party monitoring, pure audio real-time analysis).
  • When to call: After creating the engine.
  • Related APIs: Turn on the audio data monitoring call [startAudioDataObserver], turn off the audio data monitoring call [stopAudioDataObserver].
  • Caution: The format of the thrown audio data is pcm. The SDK still controls the collection and playback of the sound device. This function is to copy a copy of the data collected or played inside the SDK for use by the developer.
  • Available since: 1.1.0
  • Restrictions: The set callback needs to be effective after calling [startAudioDataObserver] and is in the push or pull state.

enableCustomAudioIO:config:

enableCustomAudioIO:config:
- (void)enableCustomAudioIO:(BOOL) enable config:(ZegoCustomAudioConfig *) config;
Enables the custom audio I/O function.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
enableBOOLWhether to enable custom audio IO, default is false.
configZegoCustomAudioConfig *Custom audio IO config.

Details

Enable custom audio IO function, support PCM, AAC format data.

  • Use cases: If the developer wants to implement special functions (such as voice change, bel canto, etc.) through custom processing after the audio data is collected or before the remote audio data is drawn for rendering.
  • When to call: It needs to be called before [startPublishingStream], [startPlayingStream], [startPreview], [createMediaPlayer], [createAudioEffectPlayer] and [createRealTimeSequentialDataManager] to be effective.
  • Available since: 1.10.0
  • Restrictions: None.

enableCustomAudioIO:config:channel:

enableCustomAudioIO:config:channel:
- (void)enableCustomAudioIO:(BOOL) enable config:(ZegoCustomAudioConfig *) config channel:(ZegoPublishChannel) channel;
Enables the custom audio I/O function (for the specified channel), support PCM, AAC format data.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
enableBOOLWhether to enable custom audio IO, default is false.
configZegoCustomAudioConfig *Custom audio IO config.
channelZegoPublishChannelSpecify the publish channel to enable custom audio IO.

Details

Enable custom audio IO function, support PCM, AAC format data.

  • Use cases: If the developer wants to implement special functions (such as voice change, bel canto, etc.) through custom processing after the audio data is collected or before the remote audio data is drawn for rendering.
  • When to call: It needs to be called before [startPublishingStream], [startPlayingStream], [startPreview], [createMediaPlayer], [createAudioEffectPlayer] and [createRealTimeSequentialDataManager] to be effective.
  • Available since: 1.10.0
  • Restrictions: None.

sendCustomAudioCaptureAACData:dataLength:configLength:timestamp:samples:param:channel:

sendCustomAudioCaptureAACData:dataLength:configLength:timestamp:samples:param:channel:
- (void)sendCustomAudioCaptureAACData:(unsigned char *) data dataLength:(unsigned int) dataLength configLength:(unsigned int) configLength timestamp:(CMTime) timestamp samples:(unsigned int) samples param:(ZegoAudioFrameParam *) param channel:(ZegoPublishChannel) channel;
Sends AAC audio data produced by custom audio capture to the SDK (for the specified channel).
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
dataunsigned char *AAC buffer data.
dataLengthunsigned intThe total length of the buffer data.
configLengthunsigned intThe length of AAC specific config (Note: The AAC encoded data length is 'encodedLength = dataLength - configLength').Value range: [0,64]
timestampCMTimeThe UNIX timestamp of this AAC audio frame.
samplesunsigned intThe number of samples for this AAC audio frame.Value range: [480,512,1024,1960,2048].
paramZegoAudioFrameParam *The param of this AAC audio frame.
channelZegoPublishChannelPublish channel for capturing audio frames.

Details

Sends the captured audio AAC data to the SDK.

  • Use cases: The customer needs to obtain input after acquisition from the existing audio stream, audio file, or customized acquisition system, and hand it over to the SDK for transmission.
  • When to call: After [enableCustomAudioIO] and publishing stream successfully.
  • Related APIs: Enable the custom audio IO function [enableCustomAudioIO], and start the push stream [startPublishingStream].
  • Available since: 2.20.0
  • Restrictions: None.

sendCustomAudioCapturePCMData:dataLength:param:

sendCustomAudioCapturePCMData:dataLength:param:
- (void)sendCustomAudioCapturePCMData:(unsigned char *) data dataLength:(unsigned int) dataLength param:(ZegoAudioFrameParam *) param;
Sends PCM audio data produced by custom audio capture to the SDK.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
dataunsigned char *PCM buffer data.
dataLengthunsigned intThe total length of the buffer data.
paramZegoAudioFrameParam *The param of this PCM audio frame.

Details

Sends the captured audio PCM data to the SDK.

  • Use cases: 1.The customer needs to obtain input after acquisition from the existing audio stream, audio file, or customized acquisition system, and hand it over to the SDK for transmission. 2.Customers have their own requirements for special sound processing for PCM input sources. After the sound processing, the input will be sent to the SDK for transmission.
  • When to call: After [enableCustomAudioIO] and publishing stream successfully.
  • Related APIs: Enable the custom audio IO function [enableCustomAudioIO], and start the push stream [startPublishingStream].
  • Available since: 1.10.0
  • Restrictions: None.

sendCustomAudioCapturePCMData:dataLength:param:channel:

sendCustomAudioCapturePCMData:dataLength:param:channel:
- (void)sendCustomAudioCapturePCMData:(unsigned char *) data dataLength:(unsigned int) dataLength param:(ZegoAudioFrameParam *) param channel:(ZegoPublishChannel) channel;
Sends PCM audio data produced by custom audio capture to the SDK (for the specified channel).
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
dataunsigned char *PCM buffer data.
dataLengthunsigned intThe total length of the buffer data.
paramZegoAudioFrameParam *The param of this PCM audio frame.
channelZegoPublishChannelPublish channel for capturing audio frames.

Details

Sends the captured audio PCM data to the SDK.

  • Use cases: 1.The customer needs to obtain input after acquisition from the existing audio stream, audio file, or customized acquisition system, and hand it over to the SDK for transmission. 2.Customers have their own requirements for special sound processing for PCM input sources. After the sound processing, the input will be sent to the SDK for transmission.
  • When to call: After [enableCustomAudioIO] and publishing stream successfully.
  • Related APIs: Enable the custom audio IO function [enableCustomAudioIO], and start the push stream [startPublishingStream].
  • Available since: 1.10.0
  • Restrictions: None.

fetchCustomAudioRenderPCMData:dataLength:param:

fetchCustomAudioRenderPCMData:dataLength:param:
- (void)fetchCustomAudioRenderPCMData:(unsigned char *) data dataLength:(unsigned int) dataLength param:(ZegoAudioFrameParam *) param;
Fetches PCM audio data of the remote stream from the SDK for custom audio rendering.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
dataunsigned char *A block of memory for storing audio PCM data that requires user to manage the memory block's lifecycle, the SDK will copy the audio frame rendering data to this memory block.
dataLengthunsigned intThe length of the audio data to be fetch this time (dataLength = duration * sampleRate * channels * 2(16 bit depth i.e. 2 Btye)).
paramZegoAudioFrameParam *Specify the parameters of the fetched audio frame. sampleRate in ZegoAudioFrameParam must assignment

Details

Fetches PCM audio data of the remote stream from the SDK for custom audio rendering, it is recommended to use the system framework to periodically invoke this function to drive audio data rendering.

  • Use cases: When developers have their own rendering requirements, such as special applications or processing and rendering of the original PCM data that are pulled, it is recommended to use the custom audio rendering function of the SDK.
  • When to call: After [enableCustomAudioIO] and playing stream successfully.
  • Related APIs: Enable the custom audio IO function [enableCustomAudioIO], and start the play stream [startPlayingStream].
  • Available since: 1.10.0
  • Restrictions: None.

sendReferenceAudioPCMData:dataLength:param:

sendReferenceAudioPCMData:dataLength:param:
- (void)sendReferenceAudioPCMData:(unsigned char *) data dataLength:(unsigned int) dataLength param:(ZegoAudioFrameParam *) param;
Send the PCM audio data customized by the developer to the SDK, which is used as a reference for custom rendering audio to eliminate echo.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
dataunsigned char *PCM buffer data
dataLengthunsigned intThe total length of the buffer data
paramZegoAudioFrameParam *The param of this PCM audio frame

Details

Developers use the audio device clock as the driver to capture PCM audio data, and use it for custom audio rendering after processing. When submitting for rendering, call this function to send the processed audio data back to the SDK so that the SDK can use it as an echo cancellation reference.

  • Use cases: In entertainment scenarios, it may be necessary to customize the processing of PCM audio data from the remote end, such as synthesizing a background sound and KTV accompaniment before rendering and playing. At the same time, developers are required to send the audio data processed by themselves to the SDK for reference, so that the processed sound effects can be echo canceled after collection.
  • When to call: After calling [fetchCustomAudioRenderPCMData] to fetch and process the PCM audio data, this function is called while submitting to the system for rendering and playback.
  • Available since: 2.13.0.
  • Restrictions: You must call [setEngineConfig] to enable the external audio data as a reference for this function to take effect. If you need to get the use of the function or the details, please consult ZEGO technical support.

setCustomAudioIOAudioRoute:

setCustomAudioIOAudioRoute:
- (void)setCustomAudioIOAudioRoute:(ZegoAudioRoute) audioRoute;
Set the audio route after enabling the custom audio IO function.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
audioRouteZegoAudioRouteAudio route.

Details

Set the audio route after enabling the custom audio IO function.

  • Use cases: The current audio route is specified by the APP to optimize the AEC effect.
  • When to call: After [enableCustomAudioIO] and [startPublishingStream].
  • Available since: 3.21.0
  • Restrictions: Only support iOS and Android.

createRangeAudio

createRangeAudio
- (nullable ZegoRangeAudio *)createRangeAudio;
Creates a range audio instance.
Declared in ZegoExpressEngine.h

Creates a range audio instance. Use case: Often used in game voice scenarios, users can use related functions by creating range audio instance objects.

  • When to call: It can be called after the engine by [createEngine] has been initialized.
  • Impacts on other APIs: If you use the range audio module, you cannot use the basic push-pull stream [startPublishingStream], [startPlayingStream] interfaces and related callbacks.
  • Available since: 2.11.0
  • Restrictions: Currently, a maximum of 1 instances can be created, after which it will return nil.

range audio instance, nil will be returned when the maximum number is exceeded.

destroyRangeAudio:

destroyRangeAudio:
- (void)destroyRangeAudio:(ZegoRangeAudio *) rangeAudio;
Destroys a range audio instance.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
rangeAudioZegoRangeAudio *The range audio instance object to be destroyed.

Details

Destroys a range audio instance.

  • Available since: 2.11.0

createCopyrightedMusic

createCopyrightedMusic
- (nullable ZegoCopyrightedMusic *)createCopyrightedMusic;
Creates a copyrighted music instance.
Declared in ZegoExpressEngine.h

Creates a copyrighted music instance. Use case: Often used in online KTV chorus scenarios, users can use related functions by creating copyrighted music instance objects.

  • When to call: It can be called after the engine by [createEngine] has been initialized.
  • Available since: 2.13.0
  • Restrictions: The SDK only supports the creation of one instance of CopyrightedMusic. Multiple calls to this function return the same object.

copyrighted music instance, multiple calls to this function return the same object.

destroyCopyrightedMusic:

destroyCopyrightedMusic:
- (void)destroyCopyrightedMusic:(ZegoCopyrightedMusic *) copyrightedMusic;
Destroys a copyrighted music instance.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
copyrightedMusicZegoCopyrightedMusic *The copyrighted music instance object to be destroyed.

Details

Destroys a copyrighted music instance.

  • When to call: It can be called before the engine by [destroyEngine]
  • Available since: 2.13.0

createAudioVADClient

createAudioVADClient
- (nullable ZegoAudioVADClient *)createAudioVADClient;
Create a audio vad client instance.
Declared in ZegoExpressEngine.h

Create a audio vad client instance. Use case: Can be used to detect if an audio packet contains speech.

  • When to call: It can be called after [createEngine].
  • Available since: 2.21.0
  • Restrictions: Each stream should correspond to a detected audio packet class object, or reset the existing object and apply it to a different stream.

audio vad client instance.

destroyAudioVADClient:

destroyAudioVADClient:
- (void)destroyAudioVADClient:(ZegoAudioVADClient *) client;
Destroys a audio vad client instance.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
clientZegoAudioVADClient *The audio vad client instance object to be destroyed.

Details

Destroys a audio vad client instance.

  • When to call: It can be called after [createEngine].
  • Available since: 2.21.0

createRangeScene

createRangeScene
- (nullable ZegoRangeScene *)createRangeScene;
Create a range scene instance object.
Declared in ZegoExpressEngine.h

Create a range scene instance object. Use case: Often used in meta world scenarios, users can use related functions by range scene instance objects.

  • When to call: After initializing the engine by [createEngine].
  • Available since: 3.0.0
  • Restrictions: None.

range scene instance object.

destroyRangeScene:

destroyRangeScene:
- (void)destroyRangeScene:(ZegoRangeScene *) rangeScene;
Destroy a range scene instance object.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
rangeSceneZegoRangeScene *The range scene instance object to be destroyed.

Details

Destroy a range scene instance.

  • When to call: After create the range scene by [createRangeScene].
  • Available since: 3.0.0
  • Restrictions: None.

getScreenCaptureSourcesWithThumbnailSize:iconSize:

getScreenCaptureSourcesWithThumbnailSize:iconSize:
- (NSArray<ZegoScreenCaptureSourceInfo *> *)getScreenCaptureSourcesWithThumbnailSize:(CGSize) thumbnailSize iconSize:(CGSize) iconSize;
Get a list of screens or windows in a screen.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
thumbnailSizeCGSizeGet the thumbnail size corresponding to the window, the thumbnail can be used to draw on the window selection interface. (unit is pixel)
iconSizeCGSizeGet the size of the icon corresponding to the program. (unit is pixel)

Details

Get a list of screens or windows in a screen.

  • Available since: 3.1.0
  • Restrictions: Only support in Windows/macOS.

Return

List of capture source info objects.

createScreenCaptureSource:sourceType:

createScreenCaptureSource:sourceType:
- (nullable ZegoScreenCaptureSource*)createScreenCaptureSource:(unsigned int) sourceId sourceType:(ZegoScreenCaptureSourceType) sourceType;
Create the screen capture source
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
sourceIdunsigned intThe specified screen ID or window ID.
sourceTypeZegoScreenCaptureSourceTypeThe specified screen source type.

Details

Creates a screen capture source object based on the provided source ID and source type.

  • Use cases: It is used when you need to record and share the screen or window.
  • When to call: It needs to be called after [createEngine].
  • Platform differences: Only supports Windows and macOS.

Return

The screen capture instance, nil will be returned when the maximum number is exceeded.

destroyScreenCaptureSource:

destroyScreenCaptureSource:
- (void)destroyScreenCaptureSource:(ZegoScreenCaptureSource *) source;
Destroy the screen capture source instance
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
sourceZegoScreenCaptureSource *The screen capture source instance to be destroyed.

Details

Destroy the [ZegoScreenCaptureSource] instance object.

  • Use cases: When you no longer need to use the screen capture function, you can use this function to destroy the instance object created by the [createScreenCaptureSource] function
  • When to call: When you need to the screen capture source object needs to be destroyed
  • Platform differences: Only supports Windows and macOS.
  • Restrictions: After destroy the instance, you need to release the [ZegoScreenCaptureSource] instance object you hold by yourself, and don’t call the function of this instance object after the destruction.

setAppGroupID:

setAppGroupID:
- (void)setAppGroupID:(NSString *)groupID API_AVAILABLE(ios (12.0));
Set the App Group configuration item.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
groupIDNSString *The host app and the extension app should belong to the same App Group, and the AppGroupID needs to be passed in here.
  • Use cases: You need to use the iOS cross-process screen sharing function, and you need to start the App Group, which can provide better performance and stability. Must be used with [setupWithAppGroupID:] in the ZegoReplayKit extension class.
  • When to call: Called after [createEngine], before calling [startScreenCapture].
  • Available since: 3.3.0
  • Restrictions: Only available on iOS platform.

startScreenCaptureInApp:

startScreenCaptureInApp:
- (void)startScreenCaptureInApp:(ZegoScreenCaptureConfig *)config API_AVAILABLE(ios (12.0));
Start screen capture, in-app capture only.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
configZegoScreenCaptureConfig *Screen capture parameter configuration.

Details

Start screen capture.

  • When to call: After calling the [setVideoSource]、[setAudioSource] function to set the capture source to ScreenCapture.
  • Available since: 3.1.0
  • Restrictions: Only valid for iOS system

startScreenCapture:

startScreenCapture:
- (void)startScreenCapture:(ZegoScreenCaptureConfig *)config API_AVAILABLE(ios (12.0));
Start screen capture.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
configZegoScreenCaptureConfig *Screen capture parameter configuration.

Details

Start screen capture.

  • When to call: After calling the [setVideoSource]、[setAudioSource] function to set the capture source to ScreenCapture.
  • Available since: 3.1.0

stopScreenCapture

stopScreenCapture
- (void)stopScreenCapture API_AVAILABLE(ios (12.0));
Stop screen capture.
Declared in ZegoExpressEngine.h

Stop screen capture.

  • Available since: 3.1.0

updateScreenCaptureConfig:

updateScreenCaptureConfig:
- (void)updateScreenCaptureConfig:(ZegoScreenCaptureConfig *)config API_AVAILABLE(ios (12.0));
Update screen capture parameter configuration.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
configZegoScreenCaptureConfig *Screen capture parameter configuration.

Details

Update screen capture parameter configuration.

  • When to call: After calling [startScreenCapture] to start capturing.
  • Available since: 3.1.0
  • Restrictions: Only valid for iOS system. Only available on iOS 12.0 or newer

createAIVoiceChanger

createAIVoiceChanger
- (nullable ZegoAIVoiceChanger *)createAIVoiceChanger;
Creates an AI voice changer instance.
Declared in ZegoExpressEngine.h

Creates an AI voice changer instance. Use case: Often used in live broadcasting, voice chatroom and KTV.

  • When to call: It can be called after the SDK by [createEngine] has been initialized.
  • Related APIs: User can call [destroyAIVoiceChanger] function to destroy an AI voice changer instance.
  • Available since: 3.10.0
  • Restrictions: Currently, a maximum of 1 instance can be created, after which it will return nil.

AI voice changer instance.

destroyAIVoiceChanger:

destroyAIVoiceChanger:
- (void)destroyAIVoiceChanger:(ZegoAIVoiceChanger *) aiVoiceChanger;
Destroys an AI voice changer instance.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
aiVoiceChangerZegoAIVoiceChanger *The AI voice changer instance object to be destroyed.

Details

Destroys the AI voice changer instance.

  • Related APIs: User can call [createAIVoiceChanger] function to create an AI voice changer instance.
  • Available since: 3.10.0

isAIVoiceChangerSupported

isAIVoiceChangerSupported
- (BOOL)isAIVoiceChangerSupported;
Check the device can run AI voice changer or not.
Declared in ZegoExpressEngine.h

Check the device can run AI voice changer or not. Use case: Often used in live broadcasting, voice chatroom and KTV.

  • When to call: It can be called after the SDK by [createEngine] has been initialized.
  • Available since: 3.14.0

Return true if the device can run AI voice changer, otherwise return false.

createPictureCapturer

createPictureCapturer
- (nullable ZegoPictureCapturer *)createPictureCapturer;
Create picture capturer instance.
Declared in ZegoExpressEngine.h

Creates a picture capturer instance. Use case: Often used in pushing static images.

  • When to call: It can be called after the SDK by [createEngine] has been initialized.
  • Related APIs: User can call [destroyPictureCapturer] function to destroy a picture capturer instance. Use [setVideoSource] to set the picture capturer as the push stream video source.
  • Available since: 3.22.0
  • Restrictions: None.

Picture capturer instance.

destroyPictureCapturer:

destroyPictureCapturer:
- (void)destroyPictureCapturer:(ZegoPictureCapturer *) pictureCapturer;
Destroys a picture capturer instance.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
pictureCapturerZegoPictureCapturer *The picture capturer instance to be destroyed.

Details

Destroys the picture capturer instance.

  • Related APIs: User can call [createPictureCapturer] function to create a picture capturer instance.
  • Available since: 3.22.0

setPlayStreamBufferIntervalRange:streamID:

setPlayStreamBufferIntervalRange:streamID:
deprecated
- (void)setPlayStreamBufferIntervalRange:(NSRange) range streamID:(NSString *) streamID;
[Deprecated] Set the adaptive adjustment interval range of the buffer for playing stream.
Declared in ZegoExpressEngine.h
NameTypeDescription
rangeNSRangeThe buffer adaptive interval range.
streamIDNSString *Stream ID.
Deprecated
Deprecated since 3.4.0, please use [setPlayStreamBufferIntervalRange:min:max:] instead.

enableBeautify:

enableBeautify:
deprecated
- (void)enableBeautify:(ZegoBeautifyFeature) featureBitmask;
[Deprecated] Enables or disables the beauty features for the main publish channel. Deprecated since 2.16.0, please use the [enableEffectsBeauty] function instead.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
featureBitmaskZegoBeautifyFeatureBeauty features, bitmask format, you can choose to enable several features in [ZegoBeautifyFeature] at the same time

Details

When developers do not have much need for beauty features, they can use this function to set some very simple beauty effects.

  • When to call: It needs to be called after [createEngine].
  • Default value: When this function is not called, the beauty feature is not enabled by default.
  • Related APIs: After turning on the beauty features, you can call the [setBeautifyOption] function to adjust the beauty parameters.
  • Caution: This beauty feature is very simple and may not meet the developer’s expectations. It is recommended to use the custom video processing function [enableCustomVideoProcessing] or the custom video capture function [enableCustomVideoCapture] to connect the AI Effects SDK [ZegoEffects] https://docs.zegocloud.com/article/9896 for best results.
  • Available since: 1.1.0
  • Restrictions: In the case of using the custom video capture function, since the developer has handle the video data capturing, the SDK is no longer responsible for the video data capturing, so this function is no longer valid. It is also invalid when using the custom video processing function.
Deprecated
Deprecated since 2.16.0, please use the [enableEffectsBeauty] function instead.

enableBeautify:channel:

enableBeautify:channel:
deprecated
- (void)enableBeautify:(ZegoBeautifyFeature) featureBitmask channel:(ZegoPublishChannel) channel;
[Deprecated] Enables or disables the beauty features for the specified publish channel. Deprecated since 2.16.0, please use the [enableEffectsBeauty] function instead.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
featureBitmaskZegoBeautifyFeatureBeauty features, bitmask format, you can choose to enable several features in [ZegoBeautifyFeature] at the same time
channelZegoPublishChannelPublishing stream channel

Details

When developers do not have much need for beauty features, they can use this function to set some very simple beauty effects.

  • When to call: It needs to be called after [createEngine].
  • Default value: When this function is not called, the beauty feature is not enabled by default.
  • Related APIs: After turning on the beauty features, you can call the [setBeautifyOption] function to adjust the beauty parameters.
  • Caution: This beauty feature is very simple and may not meet the developer’s expectations. It is recommended to use the custom video processing function [enableCustomVideoProcessing] or the custom video capture function [enableCustomVideoCapture] to connect the AI Effects SDK [ZegoEffects] https://docs.zegocloud.com/article/9896 for best results.
  • Available since: 1.1.0
  • Restrictions: In the case of using the custom video capture function, since the developer has handle the video data capturing, the SDK is no longer responsible for the video data capturing, so this function is no longer valid. It is also invalid when using the custom video processing function.
Deprecated
Deprecated since 2.16.0, please use the [enableEffectsBeauty] function instead.

setBeautifyOption:

setBeautifyOption:
deprecated
- (void)setBeautifyOption:(ZegoBeautifyOption *) option;
[Deprecated] Set beautify option. Deprecated since 2.16.0, please use the [setEffectsBeautyParam] function instead.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
optionZegoBeautifyOption *Beautify option.

Details

set beautify option for main publish channel.

  • Use cases: Often used in video call, live broadcasting.
  • When to call: It needs to be called after [createEngine].
  • Caution: In the case of using a custom video capture function, because the developer has taken over the video data capturing, the SDK is no longer responsible for the video data capturing, call this function will not take effect. When using custom video processing, the video data collected by the SDK will be handed over to the business for further processing, call this function will not take effect either.
  • Available since: 1.1.0
  • Restrictions: None.
Deprecated
Deprecated since 2.16.0, please use the [setEffectsBeautyParam] function instead.

setBeautifyOption:channel:

setBeautifyOption:channel:
deprecated
- (void)setBeautifyOption:(ZegoBeautifyOption *) option channel:(ZegoPublishChannel) channel;
[Deprecated] Set beautify option. Deprecated since 2.16.0, please use the [setEffectsBeautyParam] function instead.
Declared in ZegoExpressEngine.h

Parameters

NameTypeDescription
optionZegoBeautifyOption *Beautify option.
channelZegoPublishChannelstream publish channel.

Details

set beautify option for main publish channel.

  • Use cases: Often used in video call, live broadcasting.
  • When to call: It needs to be called after [createEngine].
  • Caution: In the case of using a custom video capture function, because the developer has taken over the video data capturing, the SDK is no longer responsible for the video data capturing, call this function will not take effect. When using custom video processing, the video data collected by the SDK will be handed over to the business for further processing, call this function will not take effect either.
  • Available since: 1.1.0
  • Restrictions: None.
Deprecated
Deprecated since 2.16.0, please use the [setEffectsBeautyParam] function instead.

ZegoFaceDetectionInfo

Face detection info.

Details

Face detection info.

Declared in ZegoExpressDefines.h

Properties

imageWidth

imageWidth
nonatomic, assign int imageWidth

The image width captured by the camera

imageHeight

imageHeight
nonatomic, assign int imageHeight

The image height captured by the camera

facePositionList

facePositionList
nonatomic, strong NSArray<ZegoFacePositionInfo *> * facePositionList

Face position information list

ZegoFacePositionInfo

Position information used by the face detection.

Declared in ZegoExpressDefines.h

Properties

position

position
nonatomic, assign CGRect position

Coordinates used by the face detection.

ZegoFontStyle

Font style.

Details

Font style configuration, can be used to configure font type, font size, font color, font transparency.

  • Use cases: Set text watermark in manual stream mixing scene, such as Co-hosting.

Declared in ZegoExpressDefines.h

Properties

type

type
nonatomic, assign ZegoFontType type
  • Required: False.
  • Default value: Source han sans [ZegoFontTypeSourceHanSans]

size

size
nonatomic, assign int size
  • Required: False.
  • Default value: 24.
  • Value range: [12,100].

color

color
nonatomic, assign int color
  • Required: False.
  • Default value: 16777215(white).
  • Value range: [0,16777215].

transparency

transparency
nonatomic, assign int transparency
  • Required: False.
  • Default value: 0.
  • Value range: [0,100], 100 is completely opaque, 0 is completely transparent.

border

border
nonatomic, assign BOOL border
  • Required: False.
  • Default value: False.
  • Value range: True/False.

borderColor

borderColor
nonatomic, assign int borderColor
  • Required: False.
  • Default value: 0.
  • Value range: [0,16777215].

ZegoItemParam

Item param.

Declared in ZegoExpressDefines.h

Properties

itemID

itemID
long long itemID

Item ID.

capacity

capacity
unsigned int capacity

The number of users allowed to bind the item.

position

position
nonatomic, strong, nonnull ZegoPosition * position

The initial position of the item in the range scene.

createMode

createMode
ZegoCreateItemMode createMode

The mode of create item.

ZegoLabelInfo

Label info.

Details

Font style configuration, can be used to configure font type, font si-e, font color, font transparency.

  • Use cases: Set text watermark in manual stream mixing scene, such as Co-hosting.

Declared in ZegoExpressDefines.h

Properties

text

text
nonatomic, copy NSString * text
  • Required: True.
  • Value range: Maximum support for displaying 100 Chinese characters and 300 English characters.

left

left
nonatomic, assign int left
  • Required: False.
  • Default value: 0.

top

top
nonatomic, assign int top
  • Required: False.
  • Default value: 0.

font

font
nonatomic, strong ZegoFontStyle * font
  • Required: False.

Methods

new

new
+ (instancetype)new NS_UNAVAILABLE;
This function is unavaialble.
Declared in ZegoExpressDefines.h

Please use [initWithText:] instead

init

init
- (instancetype)init NS_UNAVAILABLE;
This function is unavaialble.
Declared in ZegoExpressDefines.h

Please use [initWithText:] instead

initWithText

initWithText
- (instancetype)initWithText:(NSString *)text;
build a label info object with text.
Declared in ZegoExpressDefines.h

ZegoLabelInfo instance.

ZegoLayerBorderConfig

Layer border configuration.

Details

Customize the size, color, etc. of the layer border.

Declared in ZegoExpressDefines.h

Properties

width

width
nonatomic, assign unsigned int width

Border size, default value 4, the maximum value is 100.

color

color
nonatomic, assign int color

Background color, the format is 0xRRGGBB, default is green, which is 0x00FF00

ZegoLogConfig

Log config.

Details

This parameter is required when calling [setlogconfig] to customize log configuration.

  • Use cases: This configuration is required when you need to customize the log storage path or the maximum log file size.
  • Caution: None.

Declared in ZegoExpressDefines.h

Properties

logPath

logPath
nonatomic, copy NSString * logPath

Used to customize the storage path of the log file.

  • Use cases: This configuration is required when you need to customize the log storage path.
  • Required: False.
  • Default value: The default path of each platform is different, please refer to the official website document https://docs.zegocloud.com/faq/express_sdkLog.
  • Caution: Developers need to ensure read and write permissions for files under this path.

logSize

logSize
nonatomic, assign unsigned long long logSize

Used to customize the maximum log file size.

  • Use cases: This configuration is required when you need to customize the upper limit of the log file size.
  • Required: False.
  • Default value: 5MB (5 * 1024 * 1024 Bytes).
  • Value range: Minimum 1MB (1 * 1024 * 1024 Bytes), maximum 100M (100 * 1024 * 1024 Bytes), 0 means no need to write logs.
  • Caution: The larger the upper limit of the log file size, the more log information it carries, but the log upload time will be longer.

logCount

logCount
nonatomic, assign unsigned int logCount

Log files count. Default is 3. Value range is [3, 20].

ZegoMediaDataPublisher

Declared in ZegoExpressDefines.h

Methods

setEventHandler:

setEventHandler:
- (void)setEventHandler:(nullable id<ZegoMediaDataPublisherEventHandler>) handler;
Set event callback handler for the media data publisher.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
handlernullable id<ZegoMediaDataPublisherEventHandler>The event handler

Details

Set event callback handler for media data publisher.

  • Use cases: Often used in server-side publishing stream scenarios, such as AI classrooms.
  • When to call: After calling the [createMediaDataPublisher] function to create a media data publisher.
  • Caution: This API used to be named [setMediaDataPublisherEventHandler] before version 3.8.0. Please refer to Upgrade guide v3.8.0+.
  • Available since: 2.17.0

addMediaFilePath:isClear:

addMediaFilePath:isClear:
- (void)addMediaFilePath:(NSString *) path isClear:(BOOL) isClear;
Add media file to the publish queue. Currently, only mp4 / m4a / aac files are supported, and special conversion is required.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
pathNSString *Local absolute path to the media file.
isClearBOOLWhether to clear the publish queue.

Details

Add media file to the publish queue. Currently, only mp4 / m4a / aac file are supported, and special conversion is required.

  • Use cases: Often used in server-side publishing stream scenarios, such as AI classrooms.
  • When to call: After calling the [createMediaDataPublisher] function to create a media data publisher.
  • Caution: The mp4 file format must meet the following points:The video must be encoded as H.264 and cannot contain B frames, only I and P frames. The I frame interval is 2s, that is, a single GOP value is 2s; The frame rate, bit rate, and resolution of the video are consistent with the frame rate, bit rate, and resolution set by [setVideoConfig] before publishing stream; Audio encoding must be MPEG-4 AAC.
  • Available since: 2.17.0

reset

reset
- (void)reset;
Clear all the status in this media data publisher, so that it can be restarted next time.
Declared in ZegoExpressDefines.h

When you need to re-publish stream and do not need to continue publishing from the previous publish queue, you can call this function to reset this media data publisher's state.

  • Use cases: Often used in server-side publishing stream scenarios, such as AI classrooms.
  • Caution: When the developer calls [logoutRoom], the state is automatically reset.
  • Available since: 2.17.0

setVideoSendDelayTime:

setVideoSendDelayTime:
- (void)setVideoSendDelayTime:(int) delayTime;
Set the delay time of video playback.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
delayTimeintVideo playback time.Required: Yes.Value range: [0, 100] ms.

Details

When this value is set, when publishing video file stream, the SDK will permanently delay the video to the set time value before sending.

  • Use cases: Mainly used to correct the fixed audio and picture asynchronous phenomenon that occurs during streaming.
  • When to call: After calling the [createMediaDataPublisher] function to create a media data publisher.
  • Available since: 2.17.0

seekTo:

seekTo:
- (void)seekTo:(unsigned long long) millisecond;
Specify the starting point of the current video file publishing.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
millisecondunsigned long longThe timestamp of the start of streaming (relative to the timestamp of the file currently being published, the starting value is 0). the unit is milliseconds

Details

Specify the starting point of the current video file publishing.

  • When to call: Called at any point between [OnMediaDataPublisherFileOpen] and [OnMediaDataPublisherFileClose]. For example: this function can be called directly in the [OnMediaDataPublisherFileOpen] callback.
  • Available since: 2.17.0

getTotalDuration

getTotalDuration
- (unsigned long long)getTotalDuration;
Get the total duration of the current file.
Declared in ZegoExpressDefines.h

Get the total duration of the current file, in milliseconds.

  • When to call: After [onMediaDataPublisherFileDataBegin] callback.
  • Available since: 2.17.0

The total duration of the current file.

getCurrentDuration

getCurrentDuration
- (unsigned long long)getCurrentDuration;
Get the playing progress of the current file.
Declared in ZegoExpressDefines.h

Get the playing progress of the current file, in milliseconds.

  • When to call: After received the [onMediaDataPublisherFileDataBegin] callback.
  • Available since: 2.17.0

The playing progress of the current file.

getIndex

getIndex
- (NSNumber *)getIndex;
Get the channel index of the media data publisher.
Declared in ZegoExpressDefines.h

Get the channel index of the media data publisher.

  • Available since: 3.4.0

ZegoMediaDataPublisherConfig

Used to config the media data publisher.

Details

Used to config the media data publisher when creating it.

Declared in ZegoExpressDefines.h

Properties

channel

channel
nonatomic, assign int channel

Used to specify the publish channel index of publisher.

mode

mode
nonatomic, assign ZegoMediaDataPublisherMode mode

Used to specify the mode of publisher.

ZegoMediaDataPublisherEventHandler

Declared in ZegoExpressEventHandler.h

Methods

mediaDataPublisher:fileOpen

mediaDataPublisher:fileOpen
- (void)mediaDataPublisher:(ZegoMediaDataPublisher *)publisher fileOpen:(NSString *)path;
The event callback of the media data publisher opening a media file.
Declared in ZegoExpressEventHandler.h

Parameters

NameTypeDescription
publisherZegoMediaDataPublisher *Callback publisher object
pathNSString *Path of currently open file

Details

The event callback of the media data publisher opening a media file.

  • Trigger: The callback triggered when the media data publisher start loading a media file.
  • Available since: 2.17.0
  • Restrictions: None.

mediaDataPublisher:fileClose:errorCode

mediaDataPublisher:fileClose:errorCode
- (void)mediaDataPublisher:(ZegoMediaDataPublisher *)publisher fileClose:(NSString *)path errorCode:(int)errorCode;
The event callback of the media data publisher closing a media file.
Declared in ZegoExpressEventHandler.h

Parameters

NameTypeDescription
publisherZegoMediaDataPublisher *Callback publisher object
errorCodeinterror code. 0 means closing the file normally. -1 is a file error. -2 is a path exception. -3 is a decoding exception. -4 is an incorrect timestamp. -5 Unable to fix audio/video synchronization. -6 Unsupported audio sample rate. Contact technical support for details.
pathNSString *Path of currently open file

Details

The event callback of the media data publisher closing a media file.

  • Trigger: The callback triggered when the media data publisher start unloading a media file.
  • Available since: 2.17.0
  • Restrictions: None.

mediaDataPublisher:fileDataBegin

mediaDataPublisher:fileDataBegin
- (void)mediaDataPublisher:(ZegoMediaDataPublisher *)publisher fileDataBegin:(NSString *)path;
The event callback that the media data publisher has read data from the media file.
Declared in ZegoExpressEventHandler.h

Parameters

NameTypeDescription
publisherZegoMediaDataPublisher *Callback publisher object
pathNSString *Path of currently open file

Details

The event callback that the media data publisher has read data from the media file.

  • Trigger: The callback triggered when the media data publisher begin to read media data from a media file.
  • Available since: 2.17.0
  • Restrictions: None.

mediaDataPublisher:fileDataEnd

mediaDataPublisher:fileDataEnd
- (void)mediaDataPublisher:(ZegoMediaDataPublisher *)publisher fileDataEnd:(NSString *)path;
The event callback that the media data publisher has completed a file stream publishing.
Declared in ZegoExpressEventHandler.h

Parameters

NameTypeDescription
publisherZegoMediaDataPublisher *Callback publisher object.
pathNSString *The path of the file that has completed stream publishing.

Details

The media data publisher has finished a file stream publishing.

  • Trigger: The callback triggered when the media data publisher has completed a file stream publishing.
  • Available since: 3.14.0
  • Restrictions: None.

ZegoMediaPlayer

Declared in ZegoExpressDefines.h

Methods

setEventHandler:

setEventHandler:
- (void)setEventHandler:(nullable id<ZegoMediaPlayerEventHandler>) handler;
Set event notification callback handler of the media player.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
handlernullable id<ZegoMediaPlayerEventHandler>Event callback handler for media player

Details

Listen to the event notification callback of the media player. Use Cases: You can change the media player UI widget according to the related event callback.

  • When to call: After the [ZegoMediaPlayer] instance created.
  • Caution: Calling this function will overwrite the callback set by the last call to this function.
  • Available since: 2.1.0
  • Restrictions: None.

setVideoHandler:format:type:

setVideoHandler:format:type:
- (void)setVideoHandler:(nullable id<ZegoMediaPlayerVideoHandler>) handler format:(ZegoVideoFrameFormat) format type:(ZegoVideoBufferType) type;
Set video data callback handler of the media player.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
handlernullable id<ZegoMediaPlayerVideoHandler>Video data callback handler for media player
formatZegoVideoFrameFormatVideo frame format for video data
typeZegoVideoBufferTypeBuffer type for video data

Details

By setting this callback, the video data of the media resource file played by the media player can be called back.

  • When to call: After the [ZegoMediaPlayer] instance created.
  • Caution: When you no longer need to get the video frame data, please call this function again to clear the handler to stop the video frame data callback.
  • Available since: 2.1.0
  • Restrictions: None.

setAudioHandler:

setAudioHandler:
- (void)setAudioHandler:(nullable id<ZegoMediaPlayerAudioHandler>) handler;
Set audio data callback handler of the media player.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
handlernullable id<ZegoMediaPlayerAudioHandler>Audio data callback handler for media player

Details

By setting this callback, the audio data of the media resource file played by the media player can be called back.

  • When to call: After the [ZegoMediaPlayer] instance created.
  • Caution: When you no longer need to get the audio data, please call this function again to clear the handler to stop the audio data callback.
  • Available since: 2.1.0
  • Restrictions: None.

setBlockDataHandler:blockSize:

setBlockDataHandler:blockSize:
- (void)setBlockDataHandler:(nullable id<ZegoMediaPlayerBlockDataHandler>) handler blockSize:(unsigned int) blockSize;
Set the media resource block data callback handler of the media player.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
handlernullable id<ZegoMediaPlayerBlockDataHandler>The media resource block data callback handler of the media player.
blockSizeunsigned intThe size of the encrypted data block. The bufferSize in the OnBlockData callback is an integer multiple of blockSize.

Details

This callback can be set to listen to and decrypt the media resource block data for playing the user's own ciphertext media resources.

  • When to call: After the [ZegoMediaPlayer] instance created, before playing media resources.
  • Caution: When it is no longer necessary to listen to the callback for data decryption, please call this function again to clear the handler.
  • Available since: 3.4.0
  • Restrictions: None.

loadResource:callback:

loadResource:callback:
- (void)loadResource:(NSString *) path callback:(nullable ZegoMediaPlayerLoadResourceCallback) callback;
Load local or network media resource.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
pathNSString *The absolute resource path or the URL of the network resource and cannot be null or "". Android can set this path string with Uri.
callbacknullable ZegoMediaPlayerLoadResourceCallbackNotification of resource loading results

Details

Load media resources. Use case: Developers can load the absolute path to the local resource or the URL of the network resource incoming.

  • When to call: It can be called after the engine by [createEngine] has been initialized and the media player has been created by [createMediaPlayer].
  • Related APIs: Resources can be loaded through the [loadResourceWithPosition] or [loadResourceFromMediaData] function.
  • Caution: If the mediaplayer has already loaded resources or is in the process of playing, please first call the [stop] interface to halt the playback, and then proceed to call the interface to load the media resources; failure to do so will result in an unsuccessful load.

Return

Callback result of loading media resource.

loadResourceWithPosition:startPosition:callback:

loadResourceWithPosition:startPosition:callback:
- (void)loadResourceWithPosition:(NSString *) path startPosition:(long) startPosition callback:(nullable ZegoMediaPlayerLoadResourceCallback) callback;
Load local or network media resource and specify the start position.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
pathNSString *The absolute resource path or the URL of the network resource and cannot be null or "". Android can set this path string with Uri.
startPositionlongThe progress at which the playback started.
callbacknullable ZegoMediaPlayerLoadResourceCallbackNotification of resource loading results

Details

Load media resources, and specify the progress, in milliseconds, at which playback begins. Use case: Developers can load the absolute path to the local resource or the URL of the network resource incoming.

  • When to call: It can be called after the engine by [createEngine] has been initialized and the media player has been created by [createMediaPlayer].
  • Related APIs: Resources can be loaded through the [loadResource] or [loadResourceFromMediaData] function.
  • Caution: 1.When [startPosition] exceeds the total playing time, it will start playing from the beginning. 2.If the mediaplayer has already loaded resources or is in the process of playing, please first call the [stop] interface to halt the playback, and then proceed to call the interface to load the media resources; failure to do so will result in an unsuccessful load.

Return

Callback result of loading media resource.

loadResourceFromMediaData:startPosition:callback:

loadResourceFromMediaData:startPosition:callback:
- (void)loadResourceFromMediaData:(NSData *) mediaData startPosition:(long) startPosition callback:(nullable ZegoMediaPlayerLoadResourceCallback) callback;
Load binary audio resource.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
mediaDataNSData *Binary audio data.
startPositionlongPosition of starting playback, in milliseconds.
callbacknullable ZegoMediaPlayerLoadResourceCallbackNotification of resource loading results.

Details

Load binary audio data. Use case: Developers do not want to cache the audio data locally, and directly transfer the audio binary data to the media player, directly load and play the audio.

  • When to call: It can be called after the engine by [createEngine] has been initialized and the media player has been created by [createMediaPlayer].
  • Related APIs: Resources can be loaded through the [loadResource] or [loadResourceWithPosition] function.
  • Caution: 1.When [startPosition] exceeds the total playing time, it will start playing from the beginning. 2.If the mediaplayer has already loaded resources or is in the process of playing, please first call the [stop] interface to halt the playback, and then proceed to call the interface to load the media resources; failure to do so will result in an unsuccessful load.

Return

Callback result of loading media resource.

loadCopyrightedMusicResourceWithPosition:startPosition:callback:

loadCopyrightedMusicResourceWithPosition:startPosition:callback:
- (void)loadCopyrightedMusicResourceWithPosition:(NSString *) resourceID startPosition:(long) startPosition callback:(nullable ZegoMediaPlayerLoadResourceCallback) callback;
Load copyrighted music resource.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
resourceIDNSString *The resource ID obtained from the copyrighted music module.
startPositionlongThe progress at which the playback started.
callbacknullable ZegoMediaPlayerLoadResourceCallbackNotification of resource loading results

Details

Load media resources, and specify the progress, in milliseconds, at which playback begins. Use case: Developers can load the resource ID of copyrighted music.

  • When to call: It can be called after the engine by [createEngine] has been initialized and the media player has been created by [createMediaPlayer].
  • Caution: 1.When [startPosition] exceeds the total playing time, it will start playing from the beginning. 2.If the mediaplayer has already loaded resources or is in the process of playing, please first call the [stop] interface to halt the playback, and then proceed to call the interface to load the media resources; failure to do so will result in an unsuccessful load.

Return

Callback result of loading media resource.

loadResourceWithConfig:callback:

loadResourceWithConfig:callback:
- (void)loadResourceWithConfig:(ZegoMediaPlayerResource *) resource callback:(nullable ZegoMediaPlayerLoadResourceCallback) callback;
Load local or network media resource with config.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
resourceZegoMediaPlayerResource *Multimedia resources that need to be loaded.
callbacknullable ZegoMediaPlayerLoadResourceCallbackNotification of resource loading results

Details

Load media resources. Use case: Developers can load the absolute path to the local resource or the URL of the network resource incoming.

  • When to call: Called after the engine [createEngine] has been initialized and the media player [createMediaPlayer] has been created.
  • Related APIs: Support for loading resources through the [loadResourceWithPosition] or [loadResourceFromMediaData] interface.
  • Caution: If the mediaplayer has already loaded resources or is in the process of playing, please first call the [stop] interface to halt the playback, and then proceed to call the interface to load the media resources; failure to do so will result in an unsuccessful load.

Return

Callback result of loading media resource.

start

start
- (void)start;
Start playing.
Declared in ZegoExpressDefines.h

You need to load resources before playing

stop

stop
- (void)stop;
Stop playing.
Declared in ZegoExpressDefines.h

pause

pause
- (void)pause;
Pause playing.
Declared in ZegoExpressDefines.h

resume

resume
- (void)resume;
Resume playing.
Declared in ZegoExpressDefines.h

seekTo:callback:

seekTo:callback:
- (void)seekTo:(unsigned long long) millisecond callback:(nullable ZegoMediaPlayerSeekToCallback) callback;
Set the specified playback progress.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
millisecondunsigned long longPoint in time of specified playback progress
callbacknullable ZegoMediaPlayerSeekToCallbackThe result notification of set the specified playback progress

Details

Unit is millisecond

Return

The result notification of set the specified playback progress

enableRepeat:

enableRepeat:
- (void)enableRepeat:(BOOL) enable;
Whether to repeat playback.
Declared in ZegoExpressDefines.h
NameTypeDescription
enableBOOLrepeat playback flag. The default is false.

setPlaySpeed:

setPlaySpeed:
- (void)setPlaySpeed:(float) speed;
Set the speed of play.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
speedfloatThe speed of play. The default is 1.0.
Versions 2.12.0 to 3.15.1: The range is 0.5 ~ 4.0.
Versions 3.16.0 and above: The range is 0.3 ~ 4.0.

Details

Set the playback speed of the player.

  • When to call: You should load resource before invoking this function.
  • Related APIs: Resources can be loaded through the [loadResource] function.
  • Available since: 2.12.0
  • Restrictions: None.

enableAux:

enableAux:
- (void)enableAux:(BOOL) enable;
Whether to mix the player's sound into the stream being published.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
enableBOOLAux audio flag. The default is false.

Details

This interface will only mix the media player sound into the main channel

muteLocal:

muteLocal:
- (void)muteLocal:(BOOL) mute;
Whether to play locally silently.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
muteBOOLMute local audio flag, The default is false.

Details

If [enableAux] switch is turned on, there is still sound in the publishing stream. The default is false.

setPlayerCanvas:

setPlayerCanvas:
- (void)setPlayerCanvas:(nullable ZegoCanvas *) canvas;
Set the view of the player playing video.
Declared in ZegoExpressDefines.h
NameTypeDescription
canvasnullable ZegoCanvas *Video rendered canvas object

setVolume:

setVolume:
- (void)setVolume:(int) volume;
Set mediaplayer volume. Both the local play volume and the publish volume are set.
Declared in ZegoExpressDefines.h
NameTypeDescription
volumeintThe range is 0 ~ 200. The default is 60.

setPlayVolume:

setPlayVolume:
- (void)setPlayVolume:(int) volume;
Set mediaplayer local playback volume.
Declared in ZegoExpressDefines.h
NameTypeDescription
volumeintThe range is 0 ~ 200. The default is 60.

setPublishVolume:

setPublishVolume:
- (void)setPublishVolume:(int) volume;
Set mediaplayer publish volume.
Declared in ZegoExpressDefines.h
NameTypeDescription
volumeintThe range is 0 ~ 200. The default is 60.

setProgressInterval:

setProgressInterval:
- (void)setProgressInterval:(unsigned long long) millisecond;
Set playback progress callback interval.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
millisecondunsigned long longInterval of playback progress callback in milliseconds

Details

This function can control the callback frequency of [onMediaPlayerPlayingProgress]. When the callback interval is set to 0, the callback is stopped. The default callback interval is 1s This callback are not returned exactly at the set callback interval, but rather at the frequency at which the audio or video frames are processed to determine whether the callback is needed to call

playVolume

playVolume
- (int)playVolume;
Gets the current local playback volume of the mediaplayer, the range is 0 ~ 200, with the default value of 60.
Declared in ZegoExpressDefines.h

current volume

publishVolume

publishVolume
- (int)publishVolume;
Gets the current publish volume of the mediaplayer, the range is 0 ~ 200, with the default value of 60.
Declared in ZegoExpressDefines.h

current volume

totalDuration

totalDuration
- (unsigned long long)totalDuration;
Get the total progress of your media resources.
Declared in ZegoExpressDefines.h

You should load resource before invoking this function, otherwise the return value is 0

Unit is millisecond

currentProgress

currentProgress
- (unsigned long long)currentProgress;
Get current playing progress.
Declared in ZegoExpressDefines.h

You should load resource before invoking this function, otherwise the return value is 0

current progress

currentRenderingProgress

currentRenderingProgress
- (unsigned long long)currentRenderingProgress;
Get current rendering progress.
Declared in ZegoExpressDefines.h

You should load resource before invoking this function, otherwise the return value is 0

current rendering progress

audioTrackCount

audioTrackCount
- (unsigned int)audioTrackCount;
Get the number of audio tracks of the playback file.
Declared in ZegoExpressDefines.h

Number of audio tracks

setAudioTrackIndex:

setAudioTrackIndex:
- (void)setAudioTrackIndex:(unsigned int) index;
Set the audio track of the playback file.
Declared in ZegoExpressDefines.h
NameTypeDescription
indexunsigned intAudio track index, the number of audio tracks can be obtained through the [getAudioTrackCount] function.

setAudioTrackMode:

setAudioTrackMode:
- (void)setAudioTrackMode:(ZegoMediaPlayerAudioTrackMode) mode;
Set the audio track mode of the player.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
modeZegoMediaPlayerAudioTrackModeAudio track mode.

Details

Set the audio track mode of the player. Use case: Under the real-time chorus (KTV), call the interface enable multi-track mode, call the interface [setAudioTrackIndex] to specify the original track to play, call interface [setAudioTrackPublishIndex] specified need publish of accompaniment tracks.

  • When to call: The call takes effect before [start] starts playing
  • Related APIs: Call [setAudioTrackIndex] to specified the play track of media file and call [setAudioTrackPublishIndex] to specified the publish track of media file.
  • Caution: When multi-track mode is enabled, the resource consumption of the hardware device is increased.
  • Available since: 3.1.0

setAudioTrackPublishIndex:

setAudioTrackPublishIndex:
- (void)setAudioTrackPublishIndex:(unsigned int) index;
Set the audio track for the media file to be publish.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
indexunsigned intAudio track index, the number of audio tracks can be obtained through the [getAudioTrackCount] function.

Details

Set the audio track for the media file to be publish.

  • When to call: It can be called after the engine by [createEngine] has been initialized and the media player has been created by [createMediaPlayer].
  • Related APIs: The number of audio tracks can be obtained through the [getAudioTrackCount] function.
  • Caution: This call takes effect only after multitrack mode is enabled by calling the interface [setAudioTrackMode].
  • Available since: 3.1.0

enableVoiceChanger:param:audioChannel:

enableVoiceChanger:param:audioChannel:
- (void)enableVoiceChanger:(BOOL) enable param:(ZegoVoiceChangerParam *) param audioChannel:(ZegoMediaPlayerAudioChannel) audioChannel;
Enable voice changer, set up the specific voice changer parameters.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
enableBOOLWhether enable voice changer or not. True - enabled, false - disabled, default value is false.
paramZegoVoiceChangerParam *Voice changer parameters
audioChannelZegoMediaPlayerAudioChannelThe audio channel to be voice changed

Details

Enable voice changer, set up the specific voice changer parameters.

  • When to call: It can be called after the engine by [createEngine] has been initialized and the media player has been created by [createMediaPlayer].
  • Available since: 3.15.0

currentState

currentState
- (ZegoMediaPlayerState) currentState;
Get the current playback status.
Declared in ZegoExpressDefines.h

current state

index

index
- (NSNumber *)index;
Get media player index.
Declared in ZegoExpressDefines.h

Get media player index.

  • When to call: It can be called after [createMediaPlayer].
  • Restrictions: None.

Media player index.

takeSnapshot:

takeSnapshot:
- (void)takeSnapshot:(ZegoMediaPlayerTakeSnapshotCallback) callback;
Take a screenshot of the current playing screen of the media player.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
callbackZegoMediaPlayerTakeSnapshotCallbackThe callback of the screenshot of the media player playing screen

Details

Only in the case of calling [setPlayerCanvas] to set the display controls and the playback state, can the screenshot be taken normally

enableAccurateSeek:config:

enableAccurateSeek:config:
- (void)enableAccurateSeek:(BOOL) enable config:(ZegoAccurateSeekConfig *) config;
Enable accurate seek and set relevant attributes.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
enableBOOLWhether to enable accurate seek
configZegoAccurateSeekConfig *The property setting of accurate seek, only valid when enable is true.

Details

The timestamp specified by normal seek may not an I frame, and then returns the I frame near the specified timestamp, which is not so accurate. But the accurate seek, when the specified timestamp is not an I frame, it will use the I frame near the specified timestamp to decode the frame of the specified timestamp.

  • Use cases: When user needs to seek to the specified timestamp accurately.
  • When to call: The setting must be called before [loadResource], and it will take effect during the entire life cycle of the media player.
  • Available since: 2.4.0

setNetWorkResourceMaxCache:size:

setNetWorkResourceMaxCache:size:
- (void)setNetWorkResourceMaxCache:(unsigned int) time size:(unsigned int) size;
Set the maximum cache duration and cache data size of web materials.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
timeunsigned intThe maximum length of the cache time, in ms, the SDK internal default is 5000; the effective value is greater than or equal to 2000; if you fill in 0, it means no limit.
sizeunsigned intThe maximum size of the cache, the unit is byte, the internal default size of the SDK is 1510241024 byte; the effective value is greater than or equal to 5000000, if you fill in 0, it means no limit.

Details

The setting must be called before loading the resource, and it will take effect during the entire life cycle of the media player. Time and size are not allowed to be 0 at the same time. The SDK internal default time is 5000, and the size is 1510241024 byte.When one of time and size reaches the set value first, the cache will stop. When loading resources with a non-empty onlineResourceCachePath, the cache is controlled by maxCachePendingLength. This configuration is invalid.

getNetWorkResourceCache

getNetWorkResourceCache
- (ZegoNetWorkResourceCache *)getNetWorkResourceCache;
Get the playable duration and size of the cached data of the current network material cache queue
Declared in ZegoExpressDefines.h

Returns the current cached information, including the length of time the data can be played and the size of the cached data.

setNetWorkBufferThreshold:

setNetWorkBufferThreshold:
- (void)setNetWorkBufferThreshold:(unsigned int) threshold;
Use this interface to set the cache threshold that the media player needs to resume playback. The SDK default value is 5000ms,The valid value is greater than or equal to 1000ms
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
thresholdunsigned intThreshold that needs to be reached to resume playback, unit ms.

Details

The setting must be called before loading the resource, and it will take effect during the entire life cycle of the media player. When the network status is poor and the media player has finished playing the cached network resources, it will stop playing, and notify the user through the ZegoMediaPlayerNetworkEvent.BUFFER_BEGIN state of the callback interface onMediaPlayerNetworkEvent that the network resources are being recached. Only when the cached network resources are greater than the set threshold, the media player will automatically resume playback at the original paused position, and notify the user through the ZegoMediaPlayerNetworkEvent.BUFFER_ENDED of the callback interface onMediaPlayerNetworkEvent that the user has cached the network resources The threshold was reached and playback resumed.

enableSoundLevelMonitor:millisecond:

enableSoundLevelMonitor:millisecond:
- (void)enableSoundLevelMonitor:(BOOL) enable millisecond:(unsigned int) millisecond;
Whether to enable sound level monitoring.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
enableBOOLWhether to enable monitoring, true is enabled, false is disabled.
millisecondunsigned intMonitoring time period of the sound level, in milliseconds, has a value range of [100, 3000].

Details

Whether to enable sound level monitoring.

  • When to call: It can be called after the engine by [createEngine] has been initialized and the media player has been created by [createMediaPlayer].
  • Related callbacks: After it is turned on, user can use the [onMediaPlayerSoundLevelUpdate] callback to monitor sound level updates.
  • Available since: 2.15.0
  • Restrictions: None.

enableFrequencySpectrumMonitor:millisecond:

enableFrequencySpectrumMonitor:millisecond:
- (void)enableFrequencySpectrumMonitor:(BOOL) enable millisecond:(unsigned int) millisecond;
Whether to enable frequency spectrum monitoring.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
enableBOOLWhether to enable monitoring, true is enabled, false is disabled.
millisecondunsigned intMonitoring time period of the frequency spectrum, in milliseconds, has a value range of [10, 3000]. Note that on v3.19.0 and older version, the value range is [100, 3000].

Details

Whether to enable frequency spectrum monitoring.

  • When to call: It can be called after the engine by [createEngine] has been initialized and the media player has been created by [createMediaPlayer].
  • Related APIs: After it is turned on, user can use the [onMediaPlayerFrequencySpectrumUpdate] callback to monitor frequency spectrum updates.
  • Available since: 2.15.0
  • Restrictions: None.

setActiveAudioChannel:

setActiveAudioChannel:
- (void)setActiveAudioChannel:(ZegoMediaPlayerAudioChannel) audioChannel;
Set the playback channel.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
audioChannelZegoMediaPlayerAudioChannelPlayback channel, the default is ZegoMediaPlayerAudioChannelAll.

Details

Set the playback channel.

  • When to call: It can be called after the engine by [createEngine] has been initialized and the media player has been created by [createMediaPlayer].
  • Available since: 2.20.0
  • Restrictions: None.

clearView

clearView
- (void)clearView;
Clears the last frame of the playback control that remains on the control after playback ends.
Declared in ZegoExpressDefines.h

Clears the last frame of the playback control that remains on the control after playback ends.

  • When to call: It can be called after the engine by [createEngine] has been initialized and the media player has been created by [createMediaPlayer].
  • Available since: 2.20.0
  • Restrictions: The interface call takes effect only when the media player ends playing.

getMediaInfo

getMediaInfo
- (ZegoMediaPlayerMediaInfo *)getMediaInfo;
Get meida information such as video resolution from media file.
Declared in ZegoExpressDefines.h

Get meida information such as video resolution from media file.

  • When to call: It can be called after the engine by [createEngine] has been initialized and the media player has been created by [createMediaPlayer].
  • Available since: 3.6.0
  • Restrictions: None.

updatePosition:

updatePosition:
- (void)updatePosition:(const float[_Nonnull 3]) position;
Update the position of the media player (audio source).
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
positionconst float[_Nonnull 3]The unit vector of the front axis of its own coordinate system. The parameter is a float array with a length of 3.

Details

Update the position of the media player (audio source).

  • Use cases: The media player also needs to have 3D spatial sound.
  • When to call: It can be called after the engine by [createEngine] has been initialized and the media player has been created by [createMediaPlayer].
  • Available since: 3.6.0
  • Restrictions: This interface needs to be used in conjunction with the RangeAudio/RangeScene module. This interface can only be called successfully after the RangeAudio/RangeScene module enables 3D sound effects.

setHttpHeader:

setHttpHeader:
- (void)setHttpHeader:(NSDictionary<NSString *, NSString *> *) headers;
Set http headers.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
headersNSDictionary<NSString *, NSString *> *Headers info.

Details

Call this function to set the http headers of the http network resource.

  • Use cases: When the network resource needs to set special header information.
  • When to call: It can be called after the engine by [createEngine] has been initialized and the media player has been created by [createMediaPlayer].
  • Available since: 3.8.0
  • Restrictions: Called before the corresponding network resource is loaded.

setPlayMediaStreamType:

setPlayMediaStreamType:
- (void)setPlayMediaStreamType:(ZegoMediaStreamType) streamType;
Set play media stream type.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
streamTypeZegoMediaStreamTypeStream type.

Details

Configure the media stream type to be played. You can only play video streams or audio streams. This will take effect during the life cycle of the media player.

  • Use cases: When only the video stream or audio stream needs to be played.
  • When to call: It can be called after the engine by [createEngine] has been initialized and the media player has been created by [createMediaPlayer].
  • Caution: Changing the media stream type during playing will take effect in the next playing.
  • Available since: 3.10.0

enableLiveAudioEffect:mode:

enableLiveAudioEffect:mode:
- (void)enableLiveAudioEffect:(BOOL) enable mode:(ZegoLiveAudioEffectMode) mode;
Enable live audio effect.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
enableBOOLWhether to enable live audio effect.
modeZegoLiveAudioEffectModeLive audio effect mode.

Details

When the live audio effect is turned on, the spatial sense is enhanced and the instrument sounds become more prominent, without any increase in delay.

  • Use cases: It is commonly used in voice chat rooms and karaoke scenarios to enhance the live audio effects of the accompaniment.
  • When to call: It can be called after the engine by [createEngine] has been initialized and the media player has been created by [createMediaPlayer].
  • Caution: To enhance the live audio effect experience, it is recommended to configure dual-channel stereo encoding. Developers can achieve this configuration by using the [setAudioCaptureStereoMode] method. Failure to configure dual-channel stereo encoding may significantly diminish the effects of certain songs, as the left and right channel effects may cancel each other out when synthesizing mono audio, resulting in less noticeable effects.
  • Available since: 3.10.0

enableLocalCache:cacheDir:

enableLocalCache:cacheDir:
- (void)enableLocalCache:(BOOL) enable cacheDir:(NSString *) cacheDir;
Enable local caching of http/https network resources.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
enableBOOLWhether to enable local caching.
cacheDirNSString *Cache dir. If left blank, the directory specified internally by SDK will be used.

Details

When playing http/https network resources, when the local cache is enabled, the network resources will be saved locally and the cache information will be called back through [onMediaPlayerLocalCache].

  • When to call: It can be called after the engine by [createEngine] has been initialized and the media player has been created by [createMediaPlayer]. Called after [loadResource] or during playback, it will take effect next playback.
  • Caution: Only http/https single file type network resources are supported. If there is a [seek] operation during playback, the cache will fail.
  • Available since: 3.12.0

enableViewMirror:

enableViewMirror:
- (void)enableViewMirror:(BOOL) enable;
Enable the view mirror.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
enableBOOLWhether to enable view mirror.

Details

Enable view mirror.

  • When to call: It can be called after the engine by [createEngine] has been initialized and the media player has been created by [createMediaPlayer].
  • Available since: 3.14.0

getPlaybackStatistics

getPlaybackStatistics
- (ZegoMediaPlayerStatisticsInfo *)getPlaybackStatistics;
Get playback statistics.
Declared in ZegoExpressDefines.h

Get current playback statistics to monitor whether decoding and rendering anomalies occur in the player.

  • Use cases: Typically used in cloud-based media player scenarios.
  • When to call: Invoke after the [loadResource] callback succeeds.
  • Available since: 3.12.0

setVoiceChangerParam:audioChannel:

setVoiceChangerParam:audioChannel:
deprecated
- (void)setVoiceChangerParam:(ZegoVoiceChangerParam *) param audioChannel:(ZegoMediaPlayerAudioChannel) audioChannel;
[Deprecated] Setting up the specific voice changer parameters.
Declared in ZegoExpressDefines.h
NameTypeDescription
paramZegoVoiceChangerParam *Voice changer parameters
audioChannelZegoMediaPlayerAudioChannelThe audio channel to be voice changed
Deprecated
Deprecated since 3.15.0, please use [enableVoiceChanger] instead.

ZegoMediaPlayerBlockDataHandler

Declared in ZegoExpressEventHandler.h

Methods

mediaPlayer:blockBegin

mediaPlayer:blockBegin
- (void)mediaPlayer:(ZegoMediaPlayer *)mediaPlayer blockBegin:(NSString *)path;
The callback triggered when the media player is about to throw the block data of the media resource.
Declared in ZegoExpressEventHandler.h

Parameters

NameTypeDescription
mediaPlayerZegoMediaPlayer *Callback player object.
pathNSString *The path of the media resource.

Details

The callback triggered when the media player is about to throw the block data of the media resource.

  • Trigger: The callback is generated when the media player starts playing.
  • Caution: The callback does not actually take effect until call [setBlockDataHandler] to set.
  • Available since: 3.4.0
  • Restrictions: When playing copyrighted music, this callback will be disabled by default. If necessary, please contact ZEGO technical support.

mediaPlayer:blockData:bufferSize

mediaPlayer:blockData:bufferSize
- (int)mediaPlayer:(ZegoMediaPlayer *)mediaPlayer blockData:(unsigned char *const)buffer bufferSize:(unsigned int)bufferSize;
The callback triggered when the media player throws the block data of the media resource.
Declared in ZegoExpressEventHandler.h

Parameters

NameTypeDescription
mediaPlayerZegoMediaPlayer *Callback player object.
bufferunsigned char *constThe block data of the media resource.
bufferSizeunsigned intLength of media resource block data.

Details

The callback triggered when the media player throws the block data of the media resource.

  • Trigger: This callback will be generated after receiving the [onBlockBegin] callback.
  • Caution: The callback does not actually take effect until call [setBlockDataHandler] to set. The buffer size before and after decryption should be consistent.
  • Available since: 3.4.0
  • Restrictions: When playing copyrighted music, this callback will be disabled by default. If necessary, please contact ZEGO technical support.

Return

The size of the buffer, -1 is returned for failure.

ZegoMediaPlayerMediaInfo

Media Infomration of media file.

Details

Meida information such as video resolution of media file.

Declared in ZegoExpressDefines.h

Properties

width

width
nonatomic, assign int width

Video resolution width.

height

height
nonatomic, assign int height

Video resolution height.

frameRate

frameRate
nonatomic, assign int frameRate

Video frame rate.

ZegoMediaPlayerResource

Multimedia resource for ZEGO media player.

Details

Used to configure loading parameters when loading multimedia resources.

Declared in ZegoExpressDefines.h

Properties

loadType

loadType
nonatomic, assign ZegoMultimediaLoadType loadType

Used to specify the loading type of multimedia resources.

startPosition

startPosition
nonatomic, assign long startPosition

The progress at which the plaback started.

alphaLayout

alphaLayout
nonatomic, assign ZegoAlphaLayoutType alphaLayout

If the specified resource has a transparent effect, you need to specify the layout position of the alpha data.

filePath

filePath
nonatomic, copy NSString * filePath

Common resource path.The absolute resource path or the URL of the network resource and cannot be nil or "". Android can set this path string with Uri.

memory

memory
nonatomic, strong, nullable NSData * memory

binary data memory.

memoryLength

memoryLength
nonatomic, assign int memoryLength

Binary data memory length.

resourceID

resourceID
nonatomic, copy NSString * resourceID

The resource ID obtained from the copyrighted music module.

onlineResourceCachePath

onlineResourceCachePath
nonatomic, copy NSString * onlineResourceCachePath

Online resource cache path, in utf8 encoding format.

maxCachePendingLength

maxCachePendingLength
nonatomic, assign long long maxCachePendingLength

The maximum length of online resource cache to be used, in bytes, with a minimum setting of 500K (500 * 1024). The default value is 0 - no limit, and try to cache the entire file.

ZegoMediaPlayerStatisticsInfo

Media player play statistics.

Details

Media player play statistics.

Declared in ZegoExpressDefines.h

Properties

videoSourceFps

videoSourceFps
nonatomic, assign double videoSourceFps

Video source fps.

videoDecodeFps

videoDecodeFps
nonatomic, assign double videoDecodeFps

Video decode fps.

videoRenderFps

videoRenderFps
nonatomic, assign double videoRenderFps

Video render fps.

audioSourceFps

audioSourceFps
nonatomic, assign double audioSourceFps

Audio source fps.

audioDecodeFps

audioDecodeFps
nonatomic, assign double audioDecodeFps

Audio decode fps.

audioRenderFps

audioRenderFps
nonatomic, assign double audioRenderFps

Audio render fps.

ZegoMediaSideInfo

SEI Callback info.

Declared in ZegoExpressDefines.h

Properties

streamID

streamID
nonatomic, copy NSString * streamID

Stream ID.

SEIData

SEIData
nonatomic, strong NSData * SEIData

SEI data

timestampNs

timestampNs
nonatomic, assign long long timestampNs

timestamp

moduleType

moduleType
int moduleType

SEI source module. Please contact ZEGO technical support.

ZegoMixerAudioConfig

Mix stream audio configuration.

Details

Configure video frame rate, bitrate, and resolution for mixer task

Declared in ZegoExpressDefines.h

Properties

bitrate

bitrate
nonatomic, assign int bitrate

Audio bitrate in kbps, default is 48 kbps, cannot be modified after starting a mixer task

channel

channel
nonatomic, assign ZegoAudioChannel channel

Audio channel, default is Mono

codecID

codecID
nonatomic, assign ZegoAudioCodecID codecID

codec ID, default is ZegoAudioCodecIDDefault

mixMode

mixMode
nonatomic, assign ZegoAudioMixMode mixMode

Multi-channel audio stream mixing mode. If [ZegoAudioMixMode] is selected as [Focused], the SDK will select 4 input streams with [isAudioFocus] set as the focus voice highlight. If it is not selected or less than 4 channels are selected, it will automatically fill in 4 channels. On web platforms, this property does not take effect.

Methods

defaultConfig

defaultConfig
- (void)+ (instancetype)defaultConfig;
Create a default mix stream audio configuration
Declared in ZegoExpressDefines.h

ZegoMixerAudioConfig instance

ZegoMixerImageInfo

Set the image information of a single input stream in the mux.

Details

Sets a picture for the content of a single input stream, which is used in place of the video, i.e. the video is not displayed when the picture is used. The layout layout in [ZegoMixerInput] for image multiplexing. Use case: The developer needs to temporarily turn off the camera to display the image during the video connection to the microphone, or display the picture when the audio is connected to the microphone.

  • Available since: 2.19.0
  • Restrictions: Image size is limited to 1M.

Declared in ZegoExpressDefines.h

Properties

url

url
nonatomic, copy NSString * url

The image path, if not empty, the image will be displayed, otherwise, the video will be displayed. JPG and PNG formats are supported. There are 2 ways to use it: 1. URI: Provide the picture to ZEGO technical support for configuration. After the configuration is complete, the picture URI will be provided, for example: preset-id://xxx.jpg. 2. URL: Only HTTP protocol is supported.

displayMode

displayMode
nonatomic, assign int displayMode

Image display mode. 0: Default. Use image to replace video content when url is not nil. 1: Display image based on camera status. Display image when camera is turned off. Display video content when camera is turned on (no need to clear the url parameter). 2: Display image based on the input stream has video data or not. Display image when there is no video data in the input stream for 3 consecutive seconds. The default duration for judging that there is no video data is 3 seconds. If you need change this setting, please contact ZEGO technical support. Display video content when the input stream has video data.

Methods

new

new
+ (instancetype)new NS_UNAVAILABLE;
This function is unavaialble.
Declared in ZegoExpressDefines.h

Please use [initWithURL:] instead

init

init
- (instancetype)init NS_UNAVAILABLE;
This function is unavaialble.
Declared in ZegoExpressDefines.h

Please use [initWithURL:] instead

initWithURL

initWithURL
- (instancetype)initWithURL:(NSString *)url;
build a image info object with url.
Declared in ZegoExpressDefines.h

ZegoMixerImageInfo instance.

initWithURLAndDisplayMode:displayMode

initWithURLAndDisplayMode:displayMode
- (instancetype)initWithURLAndDisplayMode:(NSString *)url displayMode:(int)displayMode;
build a image info object with url and displayMode.
Declared in ZegoExpressDefines.h

ZegoMixerImageInfo instance.

ZegoMixerInput

Mixer input.

Details

Configure the mix stream input stream ID, type, and the layout

Declared in ZegoExpressDefines.h

Properties

streamID

streamID
nonatomic, copy NSString * streamID
  • Caution: You cannot include URL keywords, otherwise publishing stream and playing stream will fails. Only support numbers, English characters and '-', '_'.

contentType

contentType
nonatomic, assign ZegoMixerInputContentType contentType

Mix stream content type

layout

layout
nonatomic, assign CGRect layout

Stream layout. When the mixed stream is an audio stream (that is, the ContentType parameter is set to the audio mixed stream type). Developers do not need to assign a value to this field, just use the SDK default.

soundLevelID

soundLevelID
nonatomic, assign unsigned int soundLevelID

If enable soundLevel in mix stream task, an unique soundLevelID is need for every stream

volume

volume
nonatomic, assign unsigned int volume

Input stream volume, valid range [0, 200], default is 100.

isAudioFocus

isAudioFocus
nonatomic, assign BOOL isAudioFocus

Whether the focus voice is enabled in the current input stream, the sound of this stream will be highlighted if enabled.

audioDirection

audioDirection
nonatomic, assign int audioDirection

The direction of the audio. Valid direction is between 0 to 360. Set -1 means disable. Default value is -1. On web platforms, this property does not take effect.

label

label
nonatomic, strong ZegoLabelInfo * label

Text watermark.

renderMode

renderMode
nonatomic, assign ZegoMixRenderMode renderMode

Video view render mode.

imageInfo

imageInfo
nonatomic, strong ZegoMixerImageInfo * imageInfo

User image information.

cornerRadius

cornerRadius
nonatomic, assign unsigned int cornerRadius

Video frame corner radius, in px.

  • Required: False.
  • Value range: Does not exceed the width and height of the video screen set by the [layout] parameter.
  • Default value: 0.

advancedConfig

advancedConfig
nonatomic, strong, nullable NSDictionary<NSString *, NSString *> * advancedConfig

Set advanced configuration. Please contact ZEGO technical support. On web platforms, this property does not take effect.

blurInfo

blurInfo
nonatomic, strong ZegoBlurInfo * blurInfo

Set blur info.

Methods

initWithStreamID:contentType:layout

initWithStreamID:contentType:layout
- (instancetype)initWithStreamID:(NSString *)streamID contentType:(ZegoMixerInputContentType)contentType layout:(CGRect)layout;
Create a mixed input object
Declared in ZegoExpressDefines.h

ZegoMixerInput instance

initWithStreamID:contentType:layout:soundLevelID

initWithStreamID:contentType:layout:soundLevelID
- (instancetype)initWithStreamID:(NSString *)streamID contentType:(ZegoMixerInputContentType)contentType layout:(CGRect)layout soundLevelID:(unsigned int)soundLevelID;
Create a mixed input object
Declared in ZegoExpressDefines.h

ZegoMixerInput instance

ZegoMixerOutput

Mixer output object, currently, a mixed-stream task only supports a maximum of four video streams with different resolutions.

Details

Configure mix stream output target URL or stream ID

Declared in ZegoExpressDefines.h

Properties

target

target
nonatomic, copy NSString * target

Mix stream output target, URL or stream ID, if set to be URL format, only RTMP URL surpported, for example rtmp://xxxxxxxx, addresses with two identical mixed-stream outputs cannot be passed in.

videoConfig

videoConfig
nonatomic, strong ZegoMixerOutputVideoConfig * videoConfig

Mix stream output video config. On web platforms, this property does not take effect.

targetRoom

targetRoom
nonatomic, strong ZegoMixerOutputRoomInfo * targetRoom

Specifies the room information for the output stream.

Methods

initWithTarget

initWithTarget
- (instancetype)initWithTarget:(NSString *)target;
Create a mix stream output object
Declared in ZegoExpressDefines.h

ZegoMixerOutput instance

setVideoConfig

setVideoConfig
- (void)setVideoConfig:(ZegoMixerOutputVideoConfig *)videoConfig;
Set the video configuration of the mix stream output
Declared in ZegoExpressDefines.h

setTargetRoom

setTargetRoom
- (void)setTargetRoom:(ZegoMixerOutputRoomInfo *)targetRoom;
Set the room information of the mix stream output
Declared in ZegoExpressDefines.h

ZegoMixerOutputRoomInfo

Room information for the output stream in a mixed stream.

Details

Setting room information for a single output stream; the mixed output stream can be added to the specified room, allowing users in the room to receive notifications of increased stream in the room.

  • Use cases: Manual mixed stream scenario, such as Co-hosting.
  • Available since: 3.18.0
  • Restrictions: Dynamic updates during mixed stream are not supported.

Declared in ZegoExpressDefines.h

Properties

roomID

roomID
nonatomic, copy NSString * roomID

Specifies the room ID of the output stream. You need to ensure that the room is already present when mixing starts.

userID

userID
nonatomic, copy NSString * userID

Specifies the user ID of the output stream. It is not recommended to use the same userID as the actual user in the room to avoid conflicts with the SDK's stream addition behavior.

Methods

new

new
+ (instancetype)new NS_UNAVAILABLE;
This function is unavaialble.
Declared in ZegoExpressDefines.h

Please use [initWithRoomID:userID:] instead

init

init
- (instancetype)init NS_UNAVAILABLE;
This function is unavaialble.
Declared in ZegoExpressDefines.h

Please use [initWithRoomID:userID:] instead

initWithRoomID:userID

initWithRoomID:userID
- (instancetype)initWithRoomID:(NSString *)roomID userID:(NSString *)userID;
Construct the room information of an output stream in a mixed stream by using roomID and userID.
Declared in ZegoExpressDefines.h

ZegoMixerOutputRoomInfo instance.

ZegoMixerOutputVideoConfig

Mix stream output video config object.

Details

Configure the video parameters, coding format and bitrate of mix stream output.

  • Use cases: Manual mixed stream scenario, such as Co-hosting.

Declared in ZegoExpressDefines.h

Properties

videoCodecID

videoCodecID
nonatomic, assign ZegoVideoCodecID videoCodecID

Mix stream output video coding format, supporting H.264 and h.265 coding.

bitrate

bitrate
nonatomic, assign int bitrate

Mix stream output video bitrate in kbps. The default value is the bitrate configured in [ZegoMixerVideoConfig].

encodeProfile

encodeProfile
nonatomic, assign ZegoEncodeProfile encodeProfile

Mix stream video encode profile. Default value is [ZegoEncodeProfileDefault].

encodeLatency

encodeLatency
nonatomic, assign int encodeLatency

The video encoding delay of mixed stream output, Valid value range [0, 2000], in milliseconds. The default value is 0.

enableLowBitrateHD

enableLowBitrateHD
BOOL enableLowBitrateHD

Enable high definition low bitrate. Default is false.

Methods

configWithCodecID:bitrate

configWithCodecID:bitrate
- (void)configWithCodecID:(ZegoVideoCodecID)codecID bitrate:(int)bitrate;
Set mix steram output video configuration.
Declared in ZegoExpressDefines.h

configWithCodecID:bitrate:encodeProfile:encodeLatency

configWithCodecID:bitrate:encodeProfile:encodeLatency
- (void)configWithCodecID:(ZegoVideoCodecID)codecID bitrate:(int)bitrate encodeProfile:(ZegoEncodeProfile)profile encodeLatency:(int)latency;
Set mix steram output video configuration.
Declared in ZegoExpressDefines.h

configWithCodecID:bitrate:encodeProfile:encodeLatency:enableLowBitrateHD

configWithCodecID:bitrate:encodeProfile:encodeLatency:enableLowBitrateHD
- (void)configWithCodecID:(ZegoVideoCodecID)codecID bitrate:(int)bitrate encodeProfile:(ZegoEncodeProfile)profile encodeLatency:(int)latency enableLowBitrateHD:(BOOL)enableLowBitrateHD;
Set mix steram output video configuration.
Declared in ZegoExpressDefines.h

ZegoMixerTask

Mix stream task object.

Details

This class is the configuration class of the stream mixing task. When a stream mixing task is requested to the ZEGO RTC server, the configuration of the stream mixing task is required. This class describes the detailed configuration information of this stream mixing task.

Declared in ZegoExpressDefines.h

Properties

taskID

taskID
nonatomic, copy, readonly NSString * taskID

Mix stream task 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 '~', '!', '@', '$', '%', '^', '&', '*', '(', ')', '_', '+', '=', '-', '`', ';', '’', ',', '.', '<', '>', ''.

Methods

new

new
+ (instancetype)new NS_UNAVAILABLE;
This function is unavaialble
Declared in ZegoExpressDefines.h

Please use [initWithTaskID:] instead

init

init
- (instancetype)init NS_UNAVAILABLE;
This function is unavaialble
Declared in ZegoExpressDefines.h

Please use [initWithTaskID:] instead

initWithTaskID

initWithTaskID
- (instancetype)initWithTaskID:(NSString *)taskID;
Create a mix stream task object with TaskID
Declared in ZegoExpressDefines.h

ZegoMixerTask instance

setAudioConfig

setAudioConfig
- (void)setAudioConfig:(ZegoMixerAudioConfig *)audioConfig;
Set the audio configuration of the mix stream task object
Declared in ZegoExpressDefines.h

setVideoConfig

setVideoConfig
- (void)setVideoConfig:(ZegoMixerVideoConfig *)videoConfig;
Set the video configuration of the mix stream task object
Declared in ZegoExpressDefines.h

setInputList

setInputList
- (void)setInputList:(NSArray<ZegoMixerInput *> *)inputList;
Set the input stream list for the mix stream task object
Declared in ZegoExpressDefines.h

setOutputList

setOutputList
- (void)setOutputList:(NSArray<ZegoMixerOutput *> *)outputList;
Set the output list of the mix stream task object
Declared in ZegoExpressDefines.h

setWatermark

setWatermark
- (void)setWatermark:(ZegoWatermark *)watermark;
Set the watermark of the mix stream task object
Declared in ZegoExpressDefines.h

setWhiteboard

setWhiteboard
- (void)setWhiteboard:(ZegoMixerWhiteboard *)whiteboard;
Set the whiteboard of the mix stream task object
Declared in ZegoExpressDefines.h

setBackgroundColor

setBackgroundColor
- (void)setBackgroundColor:(int)backgroundColor;
Set the background color of the mix stream task object, The color value corresponding to RGBA is 0xRRGGBBAA, and setting the transparency of the background color is currently not supported. The AA in 0xRRGGBBAA is 00. For example, select RGB as \#87CEFA as the background color, this parameter passes 0x87CEFA00.
Declared in ZegoExpressDefines.h

setBackgroundImageURL

setBackgroundImageURL
- (void)setBackgroundImageURL:(NSString *)backgroundImageURL;
Set the background image of the mix stream task object
Declared in ZegoExpressDefines.h

enableSoundLevel

enableSoundLevel
- (void)enableSoundLevel:(BOOL)enable;
Enable or disable sound level callback for the task. If enabled, then the remote player can get the soundLevel of every stream in the inputlist by [onMixerSoundLevelUpdate] callback.
Declared in ZegoExpressDefines.h

setStreamAlignmentMode

setStreamAlignmentMode
- (void)setStreamAlignmentMode:(ZegoStreamAlignmentMode)mode;
Setting the stream mixing alignment mode
Declared in ZegoExpressDefines.h

setUserData:length

setUserData:length
- (void)setUserData:(NSData *)data length:(int)length;
Set custom user data, the length is no more than 1000.Note that only data with length will be read by SDK. If the length is greater than the actual length of data, the SDK will read the data according to the actual length of data.
Declared in ZegoExpressDefines.h

setAdvancedConfig

setAdvancedConfig
- (void)setAdvancedConfig:(NSDictionary<NSString *, NSString *> *)config;
Set advanced configuration, such as specifying video encoding and others. If you need to use it, contact ZEGO technical support.
Declared in ZegoExpressDefines.h

setMinPlayStreamBufferLength

setMinPlayStreamBufferLength
- (void)setMinPlayStreamBufferLength:(int)minPlayStreamBufferLength;
Description: Sets the lower limit of the interval range for the adaptive adjustment of the stream playing cache of the stream mixing server. In the real-time chorus KTV scenario, slight fluctuations in the network at the push end may cause the mixed stream to freeze. At this time, when the audience pulls the mixed stream, there is a high probability of the problem of freeze. By adjusting the lower limit of the interval range for the adaptive adjustment of the stream playing cache of the stream mixing server, it can optimize the freezing problem that occurs when playing mixing streams at the player end, but it will increase the delay. It is not set by default, that is, the server uses its own configuration values. It only takes effect for the new input stream setting, and does not take effect for the input stream that has already started mixing.Value Range: [0,10000], exceeding the maximum value will result in a failure of the stream mixing request. On web platforms, this property does not take effect.
Declared in ZegoExpressDefines.h

setMixImageCheckMode

setMixImageCheckMode
- (void)setMixImageCheckMode:(ZegoMixImageCheckMode)mixImageCheckMode;
Set the mixed stream image check mode.
Declared in ZegoExpressDefines.h

ZegoMixerVideoConfig

Mix stream video config object.

Details

Configure video frame rate, bitrate, and resolution for mixer task

Declared in ZegoExpressDefines.h

Properties

fps

fps
nonatomic, assign int fps

Video FPS, cannot be modified after starting a mixer task

bitrate

bitrate
nonatomic, assign int bitrate

Video bitrate in kbps

quality

quality
nonatomic, assign int quality

Video quality, this value is valid when the video rate control mode parameter is set to constant quality. The valid value ranges from 0 to 51. The default value is 23. If you want better video quality, lower the quality value based on 23 to test the adjustment. If you want a smaller file size, test the adjustment by increasing the high quality value at the base of 23. Take the file size under the value x as an example. The file size under the value x + 6 is half the size of the file size under the value x, and the file size under the value x-6 is twice the size of the file size under the value x. On web platforms, this property does not take effect.

rateControlMode

rateControlMode
nonatomic, assign ZegoVideoRateControlMode rateControlMode

Video bitrate control mode. On web platforms, this property does not take effect.

resolution

resolution
nonatomic, assign CGSize resolution

video resolution

Methods

configWithResolution:fps:bitrate

configWithResolution:fps:bitrate
- (void)+ (instancetype)configWithResolution:(CGSize)resolution fps:(int)fps bitrate:(int)bitrate;
Create a mixer video configuration
Declared in ZegoExpressDefines.h

ZegoMixerVideoConfig instance

initWithResolution:fps:bitrate

initWithResolution:fps:bitrate
- (instancetype)initWithResolution:(CGSize)resolution fps:(int)fps bitrate:(int)bitrate;
Create a mixer video configuration
Declared in ZegoExpressDefines.h

ZegoMixerVideoConfig instance

ZegoMixerWhiteboard

Mixer whiteboard object.

Details

Configure the mix whiteboard ID, aspect ratio and the layout.

Declared in ZegoExpressDefines.h

Properties

whiteboardID

whiteboardID
unsigned long long whiteboardID

Whiteboard ID.

horizontalRatio

horizontalRatio
int horizontalRatio

Whiteboard aspect ratio(width), the default aspect ratio is 16:9.

verticalRatio

verticalRatio
int verticalRatio

Whiteboard aspect ratio(height), the default aspect ratio is 16:9.

isPPTAnimation

isPPTAnimation
BOOL isPPTAnimation

Whether the whiteboard will load dynamic PPT files or not, default value is false.

layout

layout
nonatomic, assign CGRect layout

Whiteboard layout.

zOrder

zOrder
int zOrder

Whiteboard z-order.

backgroundColor

backgroundColor
int backgroundColor

Whiteboard background color. Defaule is 0xF1F3F400 (gray). The color value corresponding to RGBA is 0xRRGGBBAA, and setting the transparency of the background color is currently not supported. The AA in 0xRRGGBBAA is 00. For example, select RGB as #87CEFA as the background color, this parameter passes 0x87CEFA00.F

Methods

initWithWhiteboardID:layout

initWithWhiteboardID:layout
- (instancetype)initWithWhiteboardID:(unsigned long long)whiteboardID layout:(CGRect)layout;
Create a mixer whiteboard object
Declared in ZegoExpressDefines.h

ZegoMixerWhiteboard instance

ZegoNetWorkResourceCache

Media player network cache information

Declared in ZegoExpressDefines.h

Properties

time

time
nonatomic, assign unsigned int time

Cached playable duration, unit ms

size

size
nonatomic, assign unsigned int size

Cached playable size, unit byte

ZegoNetworkProbeConfig

Network probe config

Declared in ZegoExpressDefines.h

Properties

enableTraceroute

enableTraceroute
nonatomic, assign BOOL enableTraceroute

Whether do traceroute, enabling tranceRoute will significantly increase network detection time

ZegoNetworkProbeHttpResult

http probe result

Declared in ZegoExpressDefines.h

Properties

errorCode

errorCode
nonatomic, assign int errorCode

http probe errorCode, 0 means the connection is normal

requestCostTime

requestCostTime
nonatomic, assign unsigned int requestCostTime

http request cost time, the unit is millisecond

ZegoNetworkProbeResult

Network probe result

Declared in ZegoExpressDefines.h

Properties

httpProbeResult

httpProbeResult
nonatomic, strong, nullable ZegoNetworkProbeHttpResult * httpProbeResult

http probe result

tcpProbeResult

tcpProbeResult
nonatomic, strong, nullable ZegoNetworkProbeTcpResult * tcpProbeResult

tcp probe result

udpProbeResult

udpProbeResult
nonatomic, strong, nullable ZegoNetworkProbeUdpResult * udpProbeResult

udp probe result

tracerouteResult

tracerouteResult
nonatomic, strong, nullable ZegoNetworkProbeTracerouteResult * tracerouteResult

traceroute result

ZegoNetworkProbeTcpResult

tcp probe result

Declared in ZegoExpressDefines.h

Properties

errorCode

errorCode
nonatomic, assign int errorCode

tcp probe errorCode, 0 means the connection is normal

rtt

rtt
nonatomic, assign unsigned int rtt

tcp rtt, the unit is millisecond

connectCostTime

connectCostTime
nonatomic, assign unsigned int connectCostTime

tcp connection cost time, the unit is millisecond

ZegoNetworkProbeTracerouteResult

traceroute result

Details

Jump up to 30 times. The traceroute result is for reference and does not represent the final network connection result. The priority is http, tcp, udp probe result.

Declared in ZegoExpressDefines.h

Properties

errorCode

errorCode
nonatomic, assign int errorCode

traceroute error code, 0 means normal

tracerouteCostTime

tracerouteCostTime
nonatomic, assign unsigned int tracerouteCostTime

Time consumed by trace route, the unit is millisecond

ZegoNetworkProbeUdpResult

udp probe result

Declared in ZegoExpressDefines.h

Properties

errorCode

errorCode
nonatomic, assign int errorCode

udp probe errorCode, 0 means the connection is normal

rtt

rtt
nonatomic, assign unsigned int rtt

The total time that the SDK send udp data to server and receive a reply, the unit is millisecond

ZegoNetworkSpeedTestConfig

Network speed test config

Declared in ZegoExpressDefines.h

Properties

testUplink
nonatomic, assign BOOL testUplink

Test uplink or not

expectedUplinkBitrate

expectedUplinkBitrate
nonatomic, assign int expectedUplinkBitrate

The unit is kbps. Recommended to use the bitrate in ZegoVideoConfig when call startPublishingStream to determine whether the network uplink environment is suitable.

testDownlink
nonatomic, assign BOOL testDownlink

Test downlink or not

expectedDownlinkBitrate

expectedDownlinkBitrate
nonatomic, assign int expectedDownlinkBitrate

The unit is kbps. Recommended to use the bitrate in ZegoVideoConfig when call startPublishingStream to determine whether the network downlink environment is suitable.

ZegoNetworkSpeedTestQuality

network speed test quality

Declared in ZegoExpressDefines.h

Properties

connectCost

connectCost
nonatomic, assign unsigned int connectCost

Time to connect to the server, in milliseconds. During the speed test, if the network connection is disconnected, it will automatically initiate a reconnection, and this variable will be updated accordingly.

rtt

rtt
nonatomic, assign unsigned int rtt

rtt, in milliseconds

packetLostRate

packetLostRate
nonatomic, assign double packetLostRate

packet lost rate. in percentage, 0.0 ~ 1.0

quality

quality
nonatomic, assign ZegoStreamQualityLevel quality

network quality. excellent, good, medium and poor

ZegoNetworkTimeInfo

The NTP info

Declared in ZegoExpressDefines.h

Properties

timestamp

timestamp
nonatomic, assign unsigned long long timestamp

Network timestamp after synchronization, 0 indicates not yet synchronized

maxDeviation

maxDeviation
nonatomic, assign int maxDeviation

The max deviation

ZegoObjectSegmentationConfig

Object segmentation config.

Details

It is used to configure parameters when the object segmentation is turned on.

Declared in ZegoExpressDefines.h

Properties

objectSegmentationType

objectSegmentationType
nonatomic, assign ZegoObjectSegmentationType objectSegmentationType

The type of object segmentation.

backgroundConfig

backgroundConfig
nonatomic, strong ZegoBackgroundConfig * backgroundConfig

Background config.

ZegoPerformanceStatus

System performance monitoring status

Declared in ZegoExpressDefines.h

Properties

cpuUsageApp

cpuUsageApp
nonatomic, assign double cpuUsageApp

Current CPU usage of the app, value range [0, 1]

cpuUsageSystem

cpuUsageSystem
nonatomic, assign double cpuUsageSystem

Current CPU usage of the system, value range [0, 1]

memoryUsageApp

memoryUsageApp
nonatomic, assign double memoryUsageApp

Current memory usage of the app, value range [0, 1]

memoryUsageSystem

memoryUsageSystem
nonatomic, assign double memoryUsageSystem

Current memory usage of the system, value range [0, 1]

memoryUsedApp

memoryUsedApp
nonatomic, assign double memoryUsedApp

Current memory used of the app, in MB

ZegoPictureCapturer

Declared in ZegoExpressDefines.h

Methods

setPath:

setPath:
- (void)setPath:(NSString *) path;
Set the path of the picture capturer source.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
pathNSString *The path of the picture. Support local picture file path (file://xxx), Android URI path (uri://xxx), asset resource path (asset://xxx). The URL length cannot exceed 512 characters.

Details

Set the path of the picture capturer source.

  • Related APIs: User can call [createPictureCapturer] function to create a picture capturer instance.
  • Available since: 3.22.0

getIndex

getIndex
- (int)getIndex;
Get picture capturer instance index.
Declared in ZegoExpressDefines.h

Picture capturer instance index.

ZegoPlayStreamQuality

Played stream quality information.

Details

Audio and video parameters and network quality, etc.

Declared in ZegoExpressDefines.h

Properties

videoRecvFPS

videoRecvFPS
nonatomic, assign double videoRecvFPS

Video receiving frame rate. The unit of frame rate is f/s

videoDejitterFPS

videoDejitterFPS
nonatomic, assign double videoDejitterFPS

Video dejitter frame rate. The unit of frame rate is f/s (Available since 1.17.0)

videoDecodeFPS

videoDecodeFPS
nonatomic, assign double videoDecodeFPS

Video decoding frame rate. The unit of frame rate is f/s

videoRenderFPS

videoRenderFPS
nonatomic, assign double videoRenderFPS

Video rendering frame rate. The unit of frame rate is f/s

videoKBPS

videoKBPS
nonatomic, assign double videoKBPS

Video bit rate in kbps

videoBreakRate

videoBreakRate
nonatomic, assign double videoBreakRate

Video break count, break count during the callback cycle (Available since 1.17.0)

audioRecvFPS

audioRecvFPS
nonatomic, assign double audioRecvFPS

Audio receiving frame rate. The unit of frame rate is f/s

audioDejitterFPS

audioDejitterFPS
nonatomic, assign double audioDejitterFPS

Audio dejitter frame rate. The unit of frame rate is f/s (Available since 1.17.0)

audioDecodeFPS

audioDecodeFPS
nonatomic, assign double audioDecodeFPS

Audio decoding frame rate. The unit of frame rate is f/s

audioRenderFPS

audioRenderFPS
nonatomic, assign double audioRenderFPS

Audio rendering frame rate. The unit of frame rate is f/s

audioKBPS

audioKBPS
nonatomic, assign double audioKBPS

Audio bit rate in kbps

audioBreakRate

audioBreakRate
nonatomic, assign double audioBreakRate

Audio break count, break count during the callback cycle (Available since 1.17.0)

mos

mos
nonatomic, assign double mos

The audio quality of the playing stream determined by the audio MOS (Mean Opinion Score) measurement method, value range [-1, 5], where -1 means unknown, [0, 5] means valid score, the higher the score, the better the audio quality. For the subjective perception corresponding to the MOS value, please refer to https://docs.zegocloud.com/article/3720#4_4 (Available since 2.16.0)

rtt

rtt
nonatomic, assign int rtt

Server to local delay, in milliseconds

packetLostRate

packetLostRate
nonatomic, assign double packetLostRate

Packet loss rate, in percentage, 0.0 ~ 1.0

peerToPeerDelay

peerToPeerDelay
nonatomic, assign int peerToPeerDelay

Delay from peer to peer, in milliseconds

peerToPeerPacketLostRate

peerToPeerPacketLostRate
nonatomic, assign double peerToPeerPacketLostRate

Packet loss rate from peer to peer, in percentage, 0.0 ~ 1.0

level

level
nonatomic, assign ZegoStreamQualityLevel level

Published stream quality level

delay

delay
nonatomic, assign int delay

Delay after the data is received by the local end, in milliseconds

avTimestampDiff

avTimestampDiff
nonatomic, assign int avTimestampDiff

The difference between the video timestamp and the audio timestamp, used to reflect the synchronization of audio and video, in milliseconds. This value is less than 0 means the number of milliseconds that the video leads the audio, greater than 0 means the number of milliseconds that the video lags the audio, and 0 means no difference. When the absolute value is less than 200, it can basically be regarded as synchronized audio and video, when the absolute value is greater than 200 for 10 consecutive seconds, it can be regarded as abnormal (Available since 1.19.0)

isHardwareDecode

isHardwareDecode
nonatomic, assign BOOL isHardwareDecode

Whether to enable hardware decoding

videoCodecID

videoCodecID
nonatomic, assign ZegoVideoCodecID videoCodecID

Video codec ID (Available since 1.17.0)

totalRecvBytes

totalRecvBytes
nonatomic, assign double totalRecvBytes

Total number of bytes received, including audio, video, SEI

audioRecvBytes

audioRecvBytes
nonatomic, assign double audioRecvBytes

Number of audio bytes received

videoRecvBytes

videoRecvBytes
nonatomic, assign double videoRecvBytes

Number of video bytes received

audioCumulativeBreakCount

audioCumulativeBreakCount
nonatomic, assign unsigned int audioCumulativeBreakCount

Accumulated audio break count (Available since 2.9.0)

audioCumulativeBreakTime

audioCumulativeBreakTime
nonatomic, assign unsigned int audioCumulativeBreakTime

Accumulated audio break time, in milliseconds (Available since 2.9.0)

audioCumulativeBreakRate

audioCumulativeBreakRate
nonatomic, assign double audioCumulativeBreakRate

Accumulated audio break rate, in percentage, 0.0 ~ 100.0 (Available since 2.9.0)

audioCumulativeDecodeTime

audioCumulativeDecodeTime
nonatomic, assign unsigned int audioCumulativeDecodeTime

Accumulated audio decode time, in milliseconds (Available since 2.9.0)

videoCumulativeBreakCount

videoCumulativeBreakCount
nonatomic, assign unsigned int videoCumulativeBreakCount

Accumulated video break count (Available since 2.9.0)

videoCumulativeBreakTime

videoCumulativeBreakTime
nonatomic, assign unsigned int videoCumulativeBreakTime

Accumulated video break time, in milliseconds (Available since 2.9.0)

videoCumulativeBreakRate

videoCumulativeBreakRate
nonatomic, assign double videoCumulativeBreakRate

Accumulated video break rate, in percentage, 0.0 ~ 1.0 (Available since 2.9.0)

videoCumulativeDecodeTime

videoCumulativeDecodeTime
nonatomic, assign unsigned int videoCumulativeDecodeTime

Accumulated video decode time, in milliseconds (Available since 2.9.0)

muteVideo

muteVideo
nonatomic, assign int muteVideo

Mute video (Available since 3.13.0)

muteAudio

muteAudio
nonatomic, assign int muteAudio

Mute audio (Available since 3.13.0)

ZegoPlayerConfig

Advanced player configuration.

Details

Configure stream resource mode, CDN configuration and other advanced configurations.

Declared in ZegoExpressDefines.h

Properties

resourceMode

resourceMode
nonatomic, assign ZegoStreamResourceMode resourceMode

Stream resource mode.

cdnConfig

cdnConfig
nonatomic, strong, nullable ZegoCDNConfig * cdnConfig

The CDN configuration for playing stream. If set, the stream is play according to the URL instead of the streamID. After that, the streamID is only used as the ID of SDK internal callback.

roomID

roomID
nonatomic, copy NSString * roomID

The Room ID. It only needs to be filled in the multi-room mode, which indicates which room this stream needs to be bound to. This parameter is ignored in single room mode.

videoCodecID

videoCodecID
nonatomic, assign ZegoVideoCodecID videoCodecID

The video encoding type of the stream, please contact ZEGO technical support if you need to use it, otherwise this parameter can be ignored.

sourceResourceType

sourceResourceType
nonatomic, assign ZegoResourceType sourceResourceType

The resource type of the source stream, please contact ZEGO technical support if you need to use it, otherwise this parameter can be ignored.

codecTemplateID

codecTemplateID
nonatomic, assign int codecTemplateID

Preconfigured codec template ID, please contact ZEGO technical support if you need to use it, otherwise this parameter can be ignored.

resourceSwitchMode

resourceSwitchMode
nonatomic, assign ZegoStreamResourceSwitchMode resourceSwitchMode

Play resource switching strategy mode, the default is ZegoStreamResourceSwitchModeDefault

resourceWhenStopPublish

resourceWhenStopPublish
nonatomic, assign ZegoStreamResourceType resourceWhenStopPublish

Play resource type when stop publish, the default is ZegoStreamResourceTypeDefault. This setting takes effect only if the user sets [resourceMode] to ZegoStreamResourceModeDefaut and [resourceSwitchMode] to ZegoStreamResourceSwitchModeDefault or ZegoStreamResourceSwitchModeSwitchToRTC.

adaptiveSwitch

adaptiveSwitch
nonatomic, assign int adaptiveSwitch

Whether to enable adaptive switching of streams, 1 means on, 0 means off. Valid only if [resourceMode] is ZegoStreamResourceModeOnlyL3. Please contact ZEGO technical support if you need to use it, otherwise this parameter can be ignored.

adaptiveTemplateIDList

adaptiveTemplateIDList
nonatomic, copy NSArray<NSNumber *> * adaptiveTemplateIDList

Stream adaptive transcoding template ID list. Please contact ZEGO technical support if you need to use it, otherwise this parameter can be ignored.

customResourceConfig

customResourceConfig
nonatomic, strong, nullable ZegoCustomPlayerResourceConfig * customResourceConfig

Play stream resource type configuration when [resourceMode] is ZegoStreamResourceModeCustom.

switchStreamConfig

switchStreamConfig
nonatomic, strong, nullable ZegoSwitchPlayingStreamConfig * switchStreamConfig

Extended parameters for the [switchPlayingStream] interface.

ZegoPosition

Request configuration of song or accompaniment.

Declared in ZegoExpressDefines.h

Properties

coordinate

coordinate
nonatomic, copy, nonnull NSArray<NSNumber *> * coordinate

The coordinates of the oneself in the world coordinate system. The parameter is a float array of length 3. The three values ​​represent the front, right, and top coordinate values ​​in turn.

motionOrientation

motionOrientation
nonatomic, strong, nonnull ZegoPositionOrientation * motionOrientation

Motion orientation.

cameraOrientation

cameraOrientation
nonatomic, strong, nonnull ZegoPositionOrientation * cameraOrientation

Camera orientation, for 3D range spatializer.

ZegoPositionOrientation

Orientation.

Declared in ZegoExpressDefines.h

Properties

axisForward

axisForward
nonatomic, copy, nonnull NSArray<NSNumber *> * axisForward

The unit vector of the front axis of its own coordinate system. The parameter is a float array with a length of 3. The three values ​​represent the front, right, and top coordinate values ​​in turn.

axisRight

axisRight
nonatomic, copy, nonnull NSArray<NSNumber *> * axisRight

The unit vector of the right axis of its own coordinate system. The parameter is a float array with a length of 3. The three values ​​represent the front, right, and top coordinate values ​​in turn.

axisUp

axisUp
nonatomic, copy, nonnull NSArray<NSNumber *> * axisUp

The unit vector of the up axis of its own coordinate system. The parameter is a float array with a length of 3. The three values ​​represent the front, right, and top coordinate values ​​in turn.

ZegoProxyInfo

Proxy config.

Details

Set proxy config.

Declared in ZegoExpressDefines.h

Properties

ip

ip
nonatomic, copy NSString * ip

ip. Under local proxy: local proxy ip configured by the developer. under cloud proxy: proxy ip provided by ZEGO (either hostname or ip will do).

port

port
nonatomic, assign unsigned int port

port. Under Local Proxy: Local proxy port configured by the developer. Under Cloud Proxy: Proxy port provided by ZEGO.

hostName

hostName
nonatomic, copy NSString * hostName

hostname.Under Local Proxy: Local proxy hostname configured by the developer. Under cloud proxy: proxy hostname provided by ZEGO. proxy hostname (either hostname or ip will do).

userName

userName
nonatomic, copy NSString * userName

userName.Under Local Proxy: the authentication username of the local Proxy configured by the developer, can be ignored if there is none. Under cloud proxy: can be ignored.

password

password
nonatomic, copy NSString * password

password.Under local proxy: authentication password of local proxy configured by developer, can be ignored if there is none. Under cloud proxy: can be ignored.

ZegoPublishDualStreamConfig

Dual stream info.

Declared in ZegoExpressDefines.h

Properties

streamType

streamType

streamType

fps

fps
nonatomic, assign int fps

Video FPS to be adjusted

bitrate

bitrate
nonatomic, assign int bitrate

Video bitrate in kbps to be adjusted

encodeResolution

encodeResolution
nonatomic, assign CGSize encodeResolution

Video resolution to be adjusted

ZegoPublishStreamQuality

Published stream quality information.

Details

Audio and video parameters and network quality, etc.

Declared in ZegoExpressDefines.h

Properties

videoCaptureFPS

videoCaptureFPS
nonatomic, assign double videoCaptureFPS

Video capture frame rate. The unit of frame rate is f/s

videoEncodeFPS

videoEncodeFPS
nonatomic, assign double videoEncodeFPS

Video encoding frame rate. The unit of frame rate is f/s

videoSendFPS

videoSendFPS
nonatomic, assign double videoSendFPS

Video transmission frame rate. The unit of frame rate is f/s

videoKBPS

videoKBPS
nonatomic, assign double videoKBPS

Video bit rate in kbps

audioCaptureFPS

audioCaptureFPS
nonatomic, assign double audioCaptureFPS

Audio capture frame rate. The unit of frame rate is f/s

audioSendFPS

audioSendFPS
nonatomic, assign double audioSendFPS

Audio transmission frame rate. The unit of frame rate is f/s

audioKBPS

audioKBPS
nonatomic, assign double audioKBPS

Audio bit rate in kbps

rtt

rtt
nonatomic, assign int rtt

Local to server delay, in milliseconds

packetLostRate

packetLostRate
nonatomic, assign double packetLostRate

Packet loss rate, in percentage, 0.0 ~ 1.0

level

level
nonatomic, assign ZegoStreamQualityLevel level

Published stream quality level

isHardwareEncode

isHardwareEncode
nonatomic, assign BOOL isHardwareEncode

Whether to enable hardware encoding

videoCodecID

videoCodecID
nonatomic, assign ZegoVideoCodecID videoCodecID

Video codec ID (Available since 1.17.0)

totalSendBytes

totalSendBytes
nonatomic, assign double totalSendBytes

Total number of bytes sent, including audio, video, SEI

audioSendBytes

audioSendBytes
nonatomic, assign double audioSendBytes

Number of audio bytes sent

videoSendBytes

videoSendBytes
nonatomic, assign double videoSendBytes

Number of video bytes sent

audioTrafficControlRate

audioTrafficControlRate
nonatomic, assign int audioTrafficControlRate

Audio traffic control ratio, in percentage, 0 ~ 100. A value of -1 indicates failed streaming. Higher values indicate greater traffic control impact.

videoTrafficControlRate

videoTrafficControlRate
nonatomic, assign int videoTrafficControlRate

Video traffic control ratio, in percentage, 0 ~ 100. A value of -1 indicates failed streaming. Higher values indicate greater traffic control impact.

ZegoPublisherConfig

Advanced publisher configuration.

Details

Configure room id

Declared in ZegoExpressDefines.h

Properties

roomID

roomID
nonatomic, copy NSString * roomID

The Room ID, It is not necessary to pass in single room mode, but the ID of the corresponding room must be passed in multi-room mode

forceSynchronousNetworkTime

forceSynchronousNetworkTime
nonatomic, assign int forceSynchronousNetworkTime

Whether to synchronize the network time when pushing streams. 1 is synchronized with 0 is not synchronized. And must be used with setStreamAlignmentProperty. It is used to align multiple streams at the mixed stream service or streaming end, such as the chorus scene of KTV.

streamCensorshipMode

streamCensorshipMode
nonatomic, assign ZegoStreamCensorshipMode streamCensorshipMode

When pushing a flow, review the pattern of the flow. By default, no audit is performed. If you want to use this function, contact ZEGO technical support.

streamCensorFlag

streamCensorFlag
nonatomic, assign int streamCensorFlag

Inspect flag. If you want to use this function, contact ZEGO technical support.

codecNegotiationType

codecNegotiationType
nonatomic, assign ZegoCapabilityNegotiationType codecNegotiationType

Codec capability negotiation type. By default, no reference to the outcome of the capability negotiation. If you want to use this function, contact ZEGO technical support.

streamTitle

streamTitle
nonatomic, copy NSString * streamTitle

Stream title, a utf8 string with a maximum length of 255 bytes or less.

ZegoPublisherTakeSnapshotConfig

The config of publish stream snapshot.

Declared in ZegoExpressDefines.h

Properties

position

position
nonatomic, assign ZegoPublisherTakeSnapshotPosition position
  • Default value: .

ZegoRangeAudio

Declared in ZegoExpressDefines.h

Methods

setEventHandler:

setEventHandler:
- (void)setEventHandler:(nullable id<ZegoRangeAudioEventHandler>) handler;
set range audio event handler.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
handlernullable id<ZegoRangeAudioEventHandler>The object used to receive range audio callbacks.

Details

Set the callback function of the range audio module, which can receive the callback notification of the microphone on state [onRangeAudioMicrophoneStateUpdate]. Use case: Used to monitor the connection status of the current microphone.

  • When to call: After initializing the range audio [createRangeAudio].
  • Available since: 2.11.0

setAudioReceiveRange:

setAudioReceiveRange:
- (void)setAudioReceiveRange:(float) range;
Set the maximum range of received audio.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
rangefloatthe audio range, the value must be greater than or equal to 0.

Details

Set the audio receiving range, the audio source sound beyond this range will not be received. Use case: Set the receiver's receiving range in the World mode.

  • Default value: When this function is not called, only the voices of the members in the team can be received, and all voices outside the team cannot be received.
  • When to call: After initializing the range audio [createRangeAudio].
  • Available since: 2.11.0
  • Restrictions: This range only takes effect for people outside the team.

setAudioReceiveRangeWithParam:

setAudioReceiveRangeWithParam:
- (int)setAudioReceiveRangeWithParam:(ZegoReceiveRangeParam *) param;
Set the configuration of the audio receiving range.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
paramZegoReceiveRangeParam *Configuration of audio receiving range.

Details

Set the audio receiving range, the audio source sound beyond this range will not be received. Use case: Set the receiver's receiving range in the World mode.

  • Default value: When this function is not called, only the voices of the members in the team can be received, and all voices outside the team cannot be received.
  • When to call: After initializing the range audio [createRangeAudio].
  • Available since: 3.7.0
  • Restrictions: This range only takes effect for people outside the team.

Return

Error code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details.

setPositionUpdateFrequency:

setPositionUpdateFrequency:
- (void)setPositionUpdateFrequency:(int) frequency;
Set the frequency of real-time update locations within the SDK.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
frequencyintthe frequency, the value must be greater than 15 ms.

Details

Set the frequency of real-time update locations within the SDK min 15 ms. Use case: After setting the update position, the sensitivity of audio gradient is very high.

  • Default value: 100 ms.
  • When to call: After initializing the range audio [createRangeAudio].
  • Available since: 2.21.0

setRangeAudioVolume:

setRangeAudioVolume:
- (void)setRangeAudioVolume:(int) volume;
Set range voice volume.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
volumeintvolume, [0,200].

Details

Set range voice volume. Use case: This interface allows you to increase or decrease the volume of a range voice stream when the user calls [startPlayingStream] and pulls another stream.

  • Default value: 100.
  • When to call: After initializing the range audio [createRangeAudio].
  • Available since: 2.23.0

setStreamVocalRange:vocalRange:

setStreamVocalRange:vocalRange:
- (void)setStreamVocalRange:(NSString *) streamID vocalRange:(float) vocalRange;
Set the sound range for the stream.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
streamIDNSString *play stream id
vocalRangefloatFlow sound range.

Details

Set range voice volume. Use case: When a user calls [startPlayingStream] and pulls another stream, the stream has a range speech effect by setting the range of sounds for that stream and calling [updateStreamPosition]. After the call will be the sound source of the sound range of the distance attenuation effect.

  • When to call: After initializing the range audio [createRangeAudio] and after [startPlayingStream].
  • Caution: When calling [enableMicrophone] to enable range speech, the resource of the stream will be switched to RTC, regardless of whether the resource specified when [startPlayingStream] was originally called to pull the stream is RTC. If you really need to specify the resource of the stream as CDN, please configure it to pull a custom CDN stream and specify the CDN address information.
  • Available since: 2.23.0

setStreamVocalRangeWithParam:param:

setStreamVocalRangeWithParam:param:
- (int)setStreamVocalRangeWithParam:(NSString *) streamID param:(ZegoVocalRangeParam *) param;
Set the sound range for the stream.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
streamIDNSString *play stream id
paramZegoVocalRangeParam *Flow sound range.

Details

Set range voice volume. Use case: When a user calls [startPlayingStream] and pulls another stream, the stream has a range speech effect by setting the range of sounds for that stream and calling [updateStreamPosition]. After the call will be the sound source of the sound range of the distance attenuation effect.

  • When to call: After initializing the range audio [createRangeAudio] and after [startPlayingStream].
  • Caution: When calling [enableMicrophone] to enable range speech, the resource of the stream will be switched to RTC, regardless of whether the resource specified when [startPlayingStream] was originally called to pull the stream is RTC. If you really need to specify the resource of the stream as CDN, please configure it to pull a custom CDN stream and specify the CDN address information.
  • Available since: 3.7.0

Return

Error code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details.

updateStreamPosition:position:

updateStreamPosition:position:
- (void)updateStreamPosition:(NSString *) streamID position:(float[_Nonnull 3]) position;
Update the location of the flow.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
streamIDNSString *play stream id.
positionfloat[_Nonnull 3]The unit vector of the front axis of its own coordinate system. The parameter is a float array with a length of 3. The three values ​​represent the front, right, and top coordinate values ​​in turn.

Details

Set range voice volume. Use case: When the user calls [startPlayingStream] to pull another stream, call [setStreamVocalRange] to set the stream's voice position, then call this interface to set the stream's position, so that the stream also has the range voice effect.

  • When to call: After initializing the range audio [createRangeAudio] and after [startPlayingStream].
  • Available since: 2.23.0

updateSelfPosition:axisForward:axisRight:axisUp:

updateSelfPosition:axisForward:axisRight:axisUp:
- (void)updateSelfPosition:(float[_Nonnull 3]) position axisForward:(float[_Nonnull 3]) axisForward axisRight:(float[_Nonnull 3]) axisRight axisUp:(float[_Nonnull 3]) axisUp;
Update self position and orentation.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
positionfloat[_Nonnull 3]The coordinates of the oneself in the world coordinate system. The parameter is a float array of length 3. The three values ​​represent the front, right, and top coordinate values ​​in turn.
axisForwardfloat[_Nonnull 3]The unit vector of the front axis of its own coordinate system. The parameter is a float array with a length of 3. The three values ​​represent the front, right, and top coordinate values ​​in turn.
axisRightfloat[_Nonnull 3]The unit vector of the right axis of its own coordinate system. The parameter is a float array with a length of 3. The three values ​​represent the front, right, and top coordinate values ​​in turn.
axisUpfloat[_Nonnull 3]The unit vector of the up axis of its own coordinate system. The parameter is a float array with a length of 3. The three values ​​represent the front, right, and top coordinate values ​​in turn.

Details

Update the user's position and orientation so that the SDK can calculate the distance between the user and the audio source and the stereo effect of the left and right ears. Use case: When the role operated by the user in the game moves on the world map, the position information and head orientation of the role are updated.

  • When to call: Called after logging in to the room [loginRoom].
  • Caution: Before calling [enableSpeaker] to turn on the speaker, if you do not call this interface to set the location information, you will not be able to receive voices from other people except the team.
  • Available since: 2.11.0

updateAudioSource:position:

updateAudioSource:position:
- (void)updateAudioSource:(NSString *) userID position:(float[_Nonnull 3]) position;
Add or update audio source position information.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
userIDNSString *The userID of the sound source.
positionfloat[_Nonnull 3]The coordinates of the speaker in the world coordinate system. The parameter is a float array of length 3. The three values ​​represent the front, right, and top coordinate values ​​in turn.

Details

Set the position of the audio source corresponding to the userID on the game map in the room, so that the SDK can calculate the distance and orientation of the listener to the audio source. Use case: Update the position of the voice user in the game map coordinates.

  • When to call: Call [loginRoom] to call after logging in to the room, and the recorded audio source information will be cleared after logging out of the room.
  • Available since: 2.11.0

enableSpatializer:

enableSpatializer:
- (void)enableSpatializer:(BOOL) enable;
Turn the 3D spatial sound on or off.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
enableBOOLWhether to enable 3D sound effects.

Details

After the 3D sound effect is turned on, the sound effect in the actual space will be simulated according to the position of the speaker equivalent to the listener. The intuitive feeling is that the sound size and the left and right sound difference will also change when the distance and orientation of the sound source change. Use case: It is a feature of audio recognition in FPS games or social scene games.

  • Default value: When this function is not called, 3D sound effects are turned off by default.
  • When to call: After initializing the range audio [createRangeAudio].
  • Caution: The 3D audio effect will only take effect when [setRangeAudioMode] is called and set to World mode.
  • Related APIs: After enabling the 3D sound effect, you can use [updateAudioSource] or [updateSelfPosition] to change the position and orientation to experience the 3D effect.
  • Available since: 2.11.0

enableMicrophone:

enableMicrophone:
- (void)enableMicrophone:(BOOL) enable;
Turn the microphone on or off.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
enableBOOLWhether to turn on the microphone.

Details

When enable is true, turn on the microphone and push audio stream; when it is false, turn off the microphone and stop pushing audio stream. Use case: The user turns on or off the microphone to communicate in the room.

  • Default value: When this function is not called, the microphone is turned off by default.
  • When to call: After initializing the range audio [createRangeAudio] and login room [loginRoom].
  • Caution: Turning on the microphone will automatically use the main channel to push the audio stream.
  • Related callbacks: Get the microphone switch state change through the callback [onRangeAudioMicrophoneStateUpdate].
  • Available since: 2.11.0

enableSpeaker:

enableSpeaker:
- (void)enableSpeaker:(BOOL) enable;
Turn the speaker on or off.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
enableBOOLWhether to turn on the speaker.

Details

When enable is true, turn on the speaker and play audio stream; when it is false, turn off the speaker and stop playing audio stream. Use case: The user turns on or off the speaker to communicate in the room.

  • Default value: When this function is not called, the speaker is turned off by default.
  • When to call: After initializing the range audio [createRangeAudio] and login room [loginRoom].
  • Caution: Turning on the speaker will automatically pull the audio stream in the room.
  • Available since: 2.11.0

setRangeAudioMode:

setRangeAudioMode:
- (void)setRangeAudioMode:(ZegoRangeAudioMode) mode;
Set range audio mode.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
modeZegoRangeAudioModeThe range audio mode.

Details

The audio mode can be set to World mode or Team mode. Use case: The user can choose to chat with everyone in the World mode (with distance limitation), or to communicate within the team in the Team mode (without distance limitation).

  • Default value: If this function is not called, the World mode is used by default.
  • When to call: After initializing the range audio [createRangeAudio].
  • Related APIs: In the World mode, you can set the sound receiving range [setAudioReceiveRange], in the Team mode, you need to set [setTeamID] to join the corresponding team to hear the voice in the team.
  • Available since: 2.11.0

setRangeAudioCustomMode:listenMode:

setRangeAudioCustomMode:listenMode:
- (void)setRangeAudioCustomMode:(ZegoRangeAudioSpeakMode) speakMode listenMode:(ZegoRangeAudioListenMode) listenMode;
Set range audio custom mode.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
speakModeZegoRangeAudioSpeakModeThe range audio speak mode.
listenModeZegoRangeAudioListenModeThe range audio listening mode.

Details

Can set the speak mode and listening mode respectively to control the speak and listening behavior in the world and team. Use case: The user can decide who can listen to his voice by selecting the speak mode, and can also decide whose voice to listen to by selecting the listening mode.

  • Default value: If this interface is not called, the ZegoRangeAudioSpeakModeAll mode and ZegoRangeAudioListenModeAll mode is used by default.
  • When to call: After initializing the range audio [createRangeAudio].
  • Related APIs: When you want to listen to sounds from the world, you need to set the sound reception range [setAudioReceiveRange]. When you want to sound and listen in the squad, you need to set [setTeamID] to join the corresponding squad.
  • Available since: 3.3.0
  • Restrictions: 1. Cannot be called with [setRangeAudioMode];
  1. Not compatible with versions prior to 3.3.0.

setTeamID:

setTeamID:
- (void)setTeamID:(NSString *) teamID;
Set team ID.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
teamIDNSString *Team ID, empty to exit the team, a string of up to 64 bytes in length. Support numbers, English characters and '~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', '=', '-', '`', ';', '’', ',', '.', '<', '>', ''.

Details

After setting the team ID, you will be able to communicate with other users of the same team, and the sound will not change with the distance. It is also possible to exit the team by setting an empty string. Use case: Users join the team or exit the team.

  • Default value: When this function is not called, no team will be added by default.
  • When to call: After initializing the range audio [createRangeAudio].
  • Caution: There will be no distance limit for the sounds in the team, and there will be no 3D sound effects.

muteUser:mute:

muteUser:mute:
- (void)muteUser:(NSString *) userID mute:(BOOL) mute;
Whether can receive the audio data of the specified user.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
userIDNSString *User ID.
muteBOOLWhether it can receive the audio data of the specified remote user, "true" means prohibition, "false" means receiving, the default value is "false".

Details

In the process of real-time audio and video interaction, local users can use this function to control whether to receive audio data from designated remote users when pulling streams as needed. When the developer does not receive the audio receipt, the hardware and network overhead can be reduced.

  • Use cases: When developers need to quickly close and restore remote audio, they can call this function to enhance the interactive experience.
  • Default value: The default is false, which means to receive audio data from all users.
  • When to call: After initializing the range audio [createRangeAudio].
  • Caution: This function is valid only when the [muteAllPlayStreamAudio] function is set to false.
  • Related APIs: You can call the [muteAllPlayStreamAudio] function to control whether to receive all audio data. 1. When the [muteAllPlayStreamAudio(true)] function is called, it takes effect globally, that is, local users will be prohibited from receiving audio data from all remote users. At this time, the [muteUser] function will not take effect regardless of whether the [muteUser] function is called before or after [muteAllPlayStreamAudio]. 2. When the [muteAllPlayStreamAudio(false)] function is called, the local user can receive the audio data of all remote users. At this time, the [muteUser] function can be used to control whether to receive the audio data of the specified user. Calling the [muteUser(userID, true)] function allows the local user to receive audio data other than the userID; calling the [muteUser(userID, false)] function allows the local user to receive the audio data of the userID.
  • Available since: 2.16.0

ZegoRangeScene

Declared in ZegoExpressDefines.h

Methods

getRangeSceneStream

getRangeSceneStream
- (ZegoRangeSceneStream *)getRangeSceneStream;
Get a range scene stream instance.
Declared in ZegoExpressDefines.h

Get a range scene stream instance. Use case: Often used in meta world scenarios, users can use related functions by getting range scene stream instance objects.

  • When to call: After creating the range scene via [createRangeScene], before destroying the range scene via [destroyRangeScene].
  • Available since: 3.0.0
  • Restrictions: None.

range scene stream instance.

getRangeSceneTeam

getRangeSceneTeam
- (ZegoRangeSceneTeam *)getRangeSceneTeam;
Get a range scene team instance.
Declared in ZegoExpressDefines.h

Get a range scene team instance. Use case: Often used in meta world scenarios, users can use related functions by getting range scene team instance objects.

  • When to call: After creating the range scene via [createRangeScene], before destroying the range scene via [destroyRangeScene].
  • Available since: 3.1.0
  • Restrictions: None.

range scene team instance.

getRangeSceneItem

getRangeSceneItem
- (ZegoRangeSceneItem *)getRangeSceneItem;
Get a range scene item instance.
Declared in ZegoExpressDefines.h

Get a range scene item instance. Use case: Often used in meta world scenarios, users can use related functions by getting range scene item instance objects.

  • When to call: After creating the range scene via [createRangeScene], before destroying the range scene via [destroyRangeScene].
  • Available since: 3.1.0
  • Restrictions: None.

range scene item instance.

getRangeSceneHandle

getRangeSceneHandle
- (int)getRangeSceneHandle;
Get range scene instance handle.
Declared in ZegoExpressDefines.h

Get range scene instance handle. Use case: Used to publish stream to the scene.

  • When to call: After creating the range scene via [createRangeScene], before destroying the range scene via [destroyRangeScene].
  • Available since: 3.0.0
  • Restrictions: None.

Range scene instance handle.

setEventHandler:

setEventHandler:
- (BOOL)setEventHandler:(nullable id<ZegoRangeSceneEventHandler>) handler;
set range scene event handler.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
handlernullable id<ZegoRangeSceneEventHandler>The object used to receive range scene callbacks.

Details

Set the callback function of the range scene module.

  • When to call: After creating the range scene via [createRangeScene], before destroying the range scene via [destroyRangeScene].
  • Available since: 3.0.0

Return

The result of set range scene event handler, true: success, false: fail.

loginScene:callback:

loginScene:callback:
- (int)loginScene:(ZegoSceneParam *) param callback:(nullable ZegoRangeSceneLoginSceneCallback) callback;
Logs in to a scene.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
paramZegoSceneParam *Scene param.
callbacknullable ZegoRangeSceneLoginSceneCallbackThe callback of login scene.

Details

SDK RangeScene uses the 'scene' to organize users.

  • Use cases: Users interact in the RangeScene within the same scene.
  • When to call: After creating the range scene via [createRangeScene], before destroying the range scene via [destroyRangeScene].
  • Caution: 1. Apps that use different appIDs cannot intercommunication with each other. 2. It is strongly recommended that userID corresponds to the user ID of the business APP, that is, a userID and a real user are fixed and unique, and should not be passed to the SDK in a random userID. Because the unique and fixed userID allows ZEGO technicians to quickly locate online problems.
  • Privacy reminder: Please do not fill in sensitive user information in this interface, including but not limited to mobile phone number, ID number, passport number, real name, etc.
  • Related callbacks: 1. When the user starts to log in to the scene, the scene is successfully logged in, or the scene fails to log in, the [onSceneStateUpdate] callback will be triggered to notify the developer of the status of the current user connected to the scene. 2. If the network is temporarily interrupted due to network quality reasons, the SDK will automatically reconnect internally. You can get the current connection status of the local scene by listening to the [onSceneStateUpdate] callback method.
  • Related APIs: 1. Users can call [logoutScene] to log out.

Return

Error code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details.

logoutScene:

logoutScene:
- (int)logoutScene:(nullable ZegoRangeSceneLogoutSceneCallback) callback;
Logs out of a scene.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
callbacknullable ZegoRangeSceneLogoutSceneCallbackThe callback of logout scene.

Details

This API will log out the current user has logged in the scene.

  • When to call: After successfully logging in to the scene, if the scene is no longer used, the user can call the function [logoutScene].
  • Caution: Exiting a scene stops all publishing and playing stream associated with the scene for that user.
  • Related callbacks: After calling this function, you will receive [onSceneStateUpdate] callback notification successfully exits the scene.
  • Related APIs: Users can use [loginScene] functions to log in scene.
  • Restrictions: None.

Return

Error code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details.

updateUserStatus:channel:status:

updateUserStatus:channel:status:
- (int)updateUserStatus:(ZegoPosition *) position channel:(unsigned int) channel status:(NSData *) status;
Update user status.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
positionZegoPosition *User's current location.
channelunsigned intThe channel to which the status belongs, starting from 0, cannot exceed the maximum channel number.
statusNSData *Current status data.

Details

Developers can call this function to update the user status.

  • When to call: After [LoginScene], before [LogoutScene].
  • Caution: None.
  • Restrictions: None.

Return

Error code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details.

updateUserCommand:channel:command:

updateUserCommand:channel:command:
- (int)updateUserCommand:(ZegoPosition *) position channel:(unsigned int) channel command:(NSData *) command;
Update user status.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
positionZegoPosition *User's current location.
channelunsigned intThe channel to which the command belongs, starting from 0, cannot exceed the maximum channel number.
commandNSData *Next command data.

Details

Developers can call this function to update the user command.

  • When to call: After [LoginScene], before [LogoutScene].
  • Caution: None.
  • Restrictions: None.

Return

Error code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details.

updateUserPosition:

updateUserPosition:
- (int)updateUserPosition:(ZegoPosition *) position;
Update user position.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
positionZegoPosition *User's current location.

Details

Developers can call this function to update the user position.

  • When to call: After [LoginScene], before [LogoutScene].
  • Caution: None.
  • Restrictions: None.

Return

Error code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details.

getUserCount:

getUserCount:
- (int)getUserCount:(nullable ZegoRangeSceneGetUserCountCallback) callback;
Get user count in scene.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
callbacknullable ZegoRangeSceneGetUserCountCallbackThe callback of get user count in scene.

Details

Developers can call this function to get user count in scene.

  • When to call: After [LoginScene], before [LogoutScene].
  • Default value: nil.
  • Caution: None.
  • Restrictions: None.

Return

Error code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details.

getUserListInView:

getUserListInView:
- (int)getUserListInView:(nullable ZegoRangeSceneGetUserListInViewCallback) callback;
Get user list in view.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
callbacknullable ZegoRangeSceneGetUserListInViewCallbackThe callback of get user list in view.

Details

Developers can call this function to get user list in view.

  • When to call: After [LoginScene], before [LogoutScene].
  • Default value: nil.
  • Caution: None.
  • Restrictions: None.

Return

Error code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details.

sendCustomCommand:callback:

sendCustomCommand:callback:
- (int)sendCustomCommand:(NSData *) command callback:(nullable ZegoRangeSceneSendCustomCommandCallback) callback;
Send custom command.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
commandNSData *Custom command.
callbacknullable ZegoRangeSceneSendCustomCommandCallbackThe callback of send custom command.

Details

Developers can call this function to send custom command.

  • When to call: After [LoginScene], before [LogoutScene].
  • Default value: nil.
  • Caution: None.
  • Restrictions: None.

Return

Error code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details.

renewToken:

renewToken:
- (int)renewToken:(NSString *) token;
Renew token.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
tokenNSString *The token that needs to be renew.

Details

After the developer receives [onSceneTokenWillExpire], they can use this API to update the token to ensure that the subsequent RTC functions are normal.

  • Use cases: Used when the token is about to expire.
  • When to call /Trigger: After the developer receives [onSceneTokenWillExpire].
  • Available since: 3.1.0
  • Restrictions: None.

Return

Error code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details.

setStreamConfig:

setStreamConfig:
- (int)setStreamConfig:(ZegoSceneStreamConfig *) config;
Set range scene stream config.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
configZegoSceneStreamConfig *Range scene stream config.

Details

Developers can call this function to set range scene stream config.

  • When to call: After [createRangeScene].
  • Default value: nil.
  • Caution: None.
  • Restrictions: None.

Return

Error code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details.

ZegoRangeSceneEventHandler

Declared in ZegoExpressEventHandler.h

Methods

rangeScene:sceneStateUpdate:errorCode

rangeScene:sceneStateUpdate:errorCode
- (void)rangeScene:(ZegoRangeScene *)rangeScene sceneStateUpdate:(ZegoSceneState)state errorCode:(int)errorCode;
The callback triggered when the scene connection state changes.
Declared in ZegoExpressEventHandler.h

Parameters

NameTypeDescription
rangeSceneZegoRangeScene *Range scene instance that triggers this callback.
stateZegoSceneStateCurrent scene state.
errorCodeintError code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details.

Details

The callback triggered when the scene connection state changes. When to trigger: Scene connection state changes.

  • Restrictions: Do not call the SDK interface in the callback thread.

rangeScene:enterView:position

rangeScene:enterView:position
- (void)rangeScene:(ZegoRangeScene *)rangeScene enterView:(ZegoUser *)user position:(ZegoPosition *)position;
Callback notification when another user enters the current user's field of view.
Declared in ZegoExpressEventHandler.h

Parameters

NameTypeDescription
rangeSceneZegoRangeScene *Range scene instance that triggers this callback.
userZegoUser *User object.
positionZegoPosition *User position.

Details

Callback notification when another user enters the current user's field of view. When to trigger: Another user enters the current user's field of view.

  • Restrictions: Do not call the SDK interface in the callback thread.

rangeScene:leaveView

rangeScene:leaveView
- (void)rangeScene:(ZegoRangeScene *)rangeScene leaveView:(NSString *)userID;
Callback notification when other users leave the current user's field of view.
Declared in ZegoExpressEventHandler.h

Parameters

NameTypeDescription
rangeSceneZegoRangeScene *Range scene instance that triggers this callback.
userIDNSString *User ID.

Details

Callback notification when other users leave the current user's field of view. When to trigger: Other users leave the current user's field of view.

  • Restrictions: Do not call the SDK interface in the callback thread.

rangeScene:userStatusUpdate:position:channel:status

rangeScene:userStatusUpdate:position:channel:status
- (void)rangeScene:(ZegoRangeScene *)rangeScene userStatusUpdate:(NSString *)userID position:(ZegoPosition *)position channel:(unsigned int)channel status:(NSData *)status;
User state update callback.
Declared in ZegoExpressEventHandler.h

Parameters

NameTypeDescription
rangeSceneZegoRangeScene *Range scene instance that triggers this callback.
userIDNSString *User ID.
positionZegoPosition *User's current position.
channelunsigned intThe channel to which the status belongs.
statusNSData *Current status data.

Details

User state update callback. When to trigger: User state update.

  • Caution: This callback is a high-frequency callback, please do not perform time-consuming operations in this callback.
  • Restrictions: Do not call the SDK interface in the callback thread.

rangeScene:userCommandUpdate:position:channel:command

rangeScene:userCommandUpdate:position:channel:command
- (void)rangeScene:(ZegoRangeScene *)rangeScene userCommandUpdate:(NSString *)userID position:(ZegoPosition *)position channel:(unsigned int)channel command:(NSData *)command;
User command update callback.
Declared in ZegoExpressEventHandler.h

Parameters

NameTypeDescription
rangeSceneZegoRangeScene *Range scene instance that triggers this callback.
userIDNSString *User ID.
positionZegoPosition *User's current position.
channelunsigned intThe channel to which the command belongs.
commandNSData *Next command data.

Details

User command update callback. When to trigger: User command update.

  • Caution: This callback is a high-frequency callback, please do not perform time-consuming operations in this callback.
  • Restrictions: Do not call the SDK interface in the callback thread.

rangeScene:customCommandUpdate

rangeScene:customCommandUpdate
- (void)rangeScene:(ZegoRangeScene *)rangeScene customCommandUpdate:(NSData *)command;
Custom command update callback.
Declared in ZegoExpressEventHandler.h

Parameters

NameTypeDescription
rangeSceneZegoRangeScene *Range scene instance that triggers this callback.
commandNSData *Custom command.

Details

Custom command update callback. When to trigger: Custom command update.

  • Restrictions: Do not call the SDK interface in the callback thread.

rangeScene:tokenWillExpire

rangeScene:tokenWillExpire
- (void)rangeScene:(ZegoRangeScene *)rangeScene tokenWillExpire:(int)remainTimeInSecond;
Callback notification that scene Token authentication is about to expire.
Declared in ZegoExpressEventHandler.h

Parameters

NameTypeDescription
rangeSceneZegoRangeScene *Range scene instance that triggers this callback.
remainTimeInSecondintThe remaining time before the token expires.

Details

The callback notification that the scene Token authentication is about to expire, please use [renewToken] to update the scene Token authentication.

  • When to call /Trigger: 30 seconds before the Token expires, the SDK will call [onSceneTokenWillExpire] to notify developer.
  • Related APIs: When the developer receives this callback, he can use [renewToken] to update the token authentication information.
  • Available since: 3.1.0
  • Restrictions: Do not call the SDK interface in the callback thread.

ZegoRangeSceneItem

Declared in ZegoExpressDefines.h

Methods

setEventHandler:

setEventHandler:
- (BOOL)setEventHandler:(nullable id<ZegoRangeSceneItemEventHandler>) handler;
set range scene item event handler.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
handlernullable id<ZegoRangeSceneItemEventHandler>The object used to receive range scene item callbacks.

Details

Set the callback function of the range scene item module.

  • When to call: After getting range scene item instance by [getRangeSceneItem].
  • Available since: 3.1.0

Return

The result of set range scene item event handler, true: success, false: fail.

createItem:callback:

createItem:callback:
- (int)createItem:(ZegoItemParam *) param callback:(nullable ZegoRangeSceneCreateItemCallback) callback;
Create item.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
paramZegoItemParam *Item param.
callbacknullable ZegoRangeSceneCreateItemCallbackThe callback of create item.

Details

Create item.

  • Use cases: Item competition in the meta world.
  • When to call: After receive login Scene success, before [logoutScene].
  • Caution: 1. Items belong to range scene, not a certain user. When a user successfully binds an item, it only means that the user has the temporary right to use the item. 2. An item is allowed to have one or more bound users, and the principle of first-come, first-served is followed when applying for bound items.
  1. When multiple users bind an item at the same time, their changes to the item follow the cas principle.
  2. When creating an item, it is allowed to specify whether to bind the item after the creation is successful.
  3. When the item is created successfully, users within the range of the item will receive the [onItemEnterView] callback notification.
  • Related APIs: Users can call [destroyItem] to destroy item.

Return

Error code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details.

destroyItem:callback:

destroyItem:callback:
- (int)destroyItem:(long long) itemID callback:(nullable ZegoRangeSceneDestroyItemCallback) callback;
Destroy item.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
itemIDlong longItem ID.
callbacknullable ZegoRangeSceneDestroyItemCallbackThe callback of destroy item.

Details

Destroy item.

  • Use cases: Item competition in the meta world.
  • When to call: After receive after login Scene success , before [logoutScene].
  • Caution: When an item is destroyed, users within the range of the item will be notified by the [onItemLeaveView] callback.
  • Related APIs: Users can call [createItem] to create item.

Return

Error code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details.

bindItem:callback:

bindItem:callback:
- (int)bindItem:(long long) itemID callback:(nullable ZegoRangeSceneBindItemCallback) callback;
Bind item.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
itemIDlong longItem ID.
callbacknullable ZegoRangeSceneBindItemCallbackThe callback of bind item.

Details

Bind item.

  • Use cases: Item competition in the meta world.
  • When to call: After receive after login Scene success, before [logoutScene].
  • Caution: When an item is successfully bound, users within the range of the item will be notified by the [onItemBindUpdate] callback.
  • Related APIs: Users can call [unbindItem] to unbind item.

Return

Error code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details.

unbindItem:callback:

unbindItem:callback:
- (int)unbindItem:(long long) itemID callback:(nullable ZegoRangeSceneUnbindItemCallback) callback;
Unbind item.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
itemIDlong longItem ID.
callbacknullable ZegoRangeSceneUnbindItemCallbackThe callback of unbind item.

Details

Unbind item.

  • Use cases: Item competition in the meta world.
  • When to call: After receive [bindItem], before [logoutScene].
  • Caution: When an item is successfully unbound, users within the scope of the item will be notified by the [onItemUnbindUpdate] callback.
  • Related APIs: Users can call [bindItem] to bind item.

Return

Error code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details.

updateItemStatus:position:channel:status:callback:

updateItemStatus:position:channel:status:callback:
- (int)updateItemStatus:(long long) itemID position:(ZegoPosition *) position channel:(unsigned int) channel status:(NSData *) status callback:(nullable ZegoRangeSceneUpdateItemStatusCallback) callback;
Update item status.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
itemIDlong longItem ID.
positionZegoPosition *Item's current location.
channelunsigned intThe channel to which the status belongs, starting from 0, cannot exceed the maximum channel number.
statusNSData *Current status data.
callbacknullable ZegoRangeSceneUpdateItemStatusCallbackThe callback of update item status.

Details

Developers can call this function to update the item status.

  • When to call: After [onBindItem], before [unbindItem].
  • Caution: None.
  • Restrictions: None.

Return

Error code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details.

updateItemCommand:position:channel:command:callback:

updateItemCommand:position:channel:command:callback:
- (int)updateItemCommand:(long long) itemID position:(ZegoPosition *) position channel:(unsigned int) channel command:(NSData *) command callback:(nullable ZegoRangeSceneUpdateItemCommandCallback) callback;
Update item status.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
itemIDlong longItem ID.
positionZegoPosition *Item's current location.
channelunsigned intThe channel to which the status belongs, starting from 0, cannot exceed the maximum channel number.
commandNSData *Next command data.
callbacknullable ZegoRangeSceneUpdateItemCommandCallbackThe callback of update item next command.

Details

Developers can call this function to update the item command.

  • When to call: After [onBindItem], before [unbindItem].
  • Caution: None.
  • Restrictions: None.

Return

Error code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details.

ZegoRangeSceneItemEventHandler

Declared in ZegoExpressEventHandler.h

Methods

rangeScene:itemEnterView:capacity:position:userList

rangeScene:itemEnterView:capacity:position:userList
- (void)rangeScene:(ZegoRangeScene *)rangeScene itemEnterView:(long long)itemID capacity:(unsigned int)capacity position:(ZegoPosition *)position userList:(NSArray<NSString *> *)userList;
Callback notification when item enters the current user's field of view.
Declared in ZegoExpressEventHandler.h

Parameters

NameTypeDescription
rangeSceneZegoRangeScene *Range scene instance that triggers this callback.
itemIDlong longItem ID.
capacityunsigned intThe number of users allowed to bind the item.
positionZegoPosition *Item position.
userListNSArray<NSString *> *List of users the item is currently bound to.

Details

Callback notification when item enters the current user's field of view. When to trigger: Item enters the current user's field of view.

  • Restrictions: Do not call the SDK interface in the callback thread.

rangeScene:itemLeaveView

rangeScene:itemLeaveView
- (void)rangeScene:(ZegoRangeScene *)rangeScene itemLeaveView:(long long)itemID;
Callback notification when item leave the current user's field of view.
Declared in ZegoExpressEventHandler.h

Parameters

NameTypeDescription
rangeSceneZegoRangeScene *Range scene instance that triggers this callback.
itemIDlong longItem ID.

Details

Callback notification when item leave the current user's field of view. When to trigger: Item leave the current user's field of view.

  • Restrictions: Do not call the SDK interface in the callback thread.

rangeScene:itemBindUpdate:userID

rangeScene:itemBindUpdate:userID
- (void)rangeScene:(ZegoRangeScene *)rangeScene itemBindUpdate:(long long)itemID userID:(NSString *)userID;
Item binding user change callback notification.
Declared in ZegoExpressEventHandler.h

Parameters

NameTypeDescription
rangeSceneZegoRangeScene *Range scene instance that triggers this callback.
itemIDlong longItem ID.
userIDNSString *The user ID of the item binding.

Details

Item binding user change callback notification. When to trigger: Item binding user change.

  • Restrictions: Do not call the SDK interface in the callback thread.

rangeScene:itemUnbindUpdate:userList

rangeScene:itemUnbindUpdate:userList
- (void)rangeScene:(ZegoRangeScene *)rangeScene itemUnbindUpdate:(long long)itemID userList:(NSArray<NSString *> *)userList;
Item unbind user change callback notification.
Declared in ZegoExpressEventHandler.h

Parameters

NameTypeDescription
rangeSceneZegoRangeScene *Range scene instance that triggers this callback.
itemIDlong longItem ID.
userListNSArray<NSString *> *List of users the item unbind.

Details

Item unbind user change callback notification. When to trigger: Item unbind user change.

  • Restrictions: Do not call the SDK interface in the callback thread.

rangeScene:itemStatusUpdate:position:channel:status

rangeScene:itemStatusUpdate:position:channel:status
- (void)rangeScene:(ZegoRangeScene *)rangeScene itemStatusUpdate:(long long)itemID position:(ZegoPosition *)position channel:(unsigned int)channel status:(NSData *)status;
Item state update callback.
Declared in ZegoExpressEventHandler.h

Parameters

NameTypeDescription
rangeSceneZegoRangeScene *Range scene instance that triggers this callback.
itemIDlong longItem ID.
positionZegoPosition *Item's current position.
channelunsigned intThe channel to which the status belongs.
statusNSData *Current status data.

Details

Item state update callback. When to trigger: Item state update.

  • Caution: This callback is a high-frequency callback, please do not perform time-consuming operations in this callback.
  • Restrictions: Do not call the SDK interface in the callback thread.

rangeScene:itemCommandUpdate:position:channel:command

rangeScene:itemCommandUpdate:position:channel:command
- (void)rangeScene:(ZegoRangeScene *)rangeScene itemCommandUpdate:(long long)itemID position:(ZegoPosition *)position channel:(unsigned int)channel command:(NSData *)command;
Item command update callback.
Declared in ZegoExpressEventHandler.h

Parameters

NameTypeDescription
rangeSceneZegoRangeScene *Range scene instance that triggers this callback.
itemIDlong longItem ID.
positionZegoPosition *Item's current position.
channelunsigned intThe channel to which the command belongs.
commandNSData *Next command data.

Details

Item command update callback. When to trigger: Item command update.

  • Caution: This callback is a high-frequency callback, please do not perform time-consuming operations in this callback.
  • Restrictions: Do not call the SDK interface in the callback thread.

ZegoRangeSceneStream

Declared in ZegoExpressDefines.h

Methods

setEventHandler:

setEventHandler:
- (BOOL)setEventHandler:(nullable id<ZegoRangeSceneStreamEventHandler>) handler;
set range scene stream event handler.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
handlernullable id<ZegoRangeSceneStreamEventHandler>The object used to receive range scene stream callbacks.

Details

Set the callback function of the range scene stream module.

  • When to call: After getting range scene stream instance by [getRangeSceneStream].
  • Available since: 3.0.0

Return

The result of set range scene stream event handler, true: success, false: fail.

setReceiveRange:

setReceiveRange:
- (int)setReceiveRange:(float) range;
Set the receiving range of audio and video streams.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
rangefloatThe range distance from the center point of the person.

Details

This interface will set the receiving range of audio and video streams, and ZEGO SDK will actively playing the streams of users in this range.

  • When to call: After [getRangeSceneStream].
  • Default value: The default value of receive range is 0.0 .
  • Caution: None.
  • Restrictions: None.

Return

Error code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details.

setReceiveRangeWithParam:

setReceiveRangeWithParam:
- (int)setReceiveRangeWithParam:(ZegoReceiveRangeParam *) param;
Set the receiving range of audio and video streams.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
paramZegoReceiveRangeParam *The configuration of audio receiving range.

Details

This interface will set the receiving range of audio and video streams, and ZEGO SDK will actively playing the streams of users in this range.

  • When to call: After [getRangeSceneStream].
  • Default value: The default value of receive range is 0.0 .
  • Caution: None.
  • Restrictions: None.

Return

Error code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details.

enableRangeSpatializer:

enableRangeSpatializer:
- (int)enableRangeSpatializer:(BOOL) enable;
Turn 3D spatial sound on or off.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
enableBOOLWhether to turn 3D spatial sound on, true: enable, false: disable.

Details

After it is turned on, the audio of non-team members in the world will change spatially with the distance and direction from the person.

  • When to call: After [getRangeSceneStream].
  • Default value: Disable.
  • Caution: None.
  • Restrictions: Media volume is required to use 3D spatial sound.

Return

Error code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details.

mutePlayAudio:mute:

mutePlayAudio:mute:
- (int)mutePlayAudio:(NSString *) userID mute:(BOOL) mute;
Set whether to receive the audio data of the specified user.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
userIDNSString *User ID.
muteBOOLtrue: do not receive the user's audio stream, false: receive the user's audio stream.

Details

Set whether to receive the audio data of the specified user.

  • When to call: After [LoginScene], before [LogoutScene].
  • Default value: Receive.
  • Caution: None.
  • Restrictions: None.

Return

Error code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details.

mutePlayVideo:mute:

mutePlayVideo:mute:
- (int)mutePlayVideo:(NSString *) userID mute:(BOOL) mute;
Set whether to receive the video data of the specified user.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
userIDNSString *User ID.
muteBOOLtrue: do not receive the user's video stream, false: receive the user's video stream.

Details

After it is turned on, the audio of non-team members in the world will change spatially with the distance and direction from the person.

  • When to call: After [LoginScene], before [LogoutScene].
  • Default value: Receive.
  • Caution: None.
  • Restrictions: None.

Return

Error code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details.

ZegoRangeSceneStreamEventHandler

Declared in ZegoExpressEventHandler.h

Methods

rangeScene:userStreamStateUpdate:forUserID:streamID

rangeScene:userStreamStateUpdate:forUserID:streamID
- (void)rangeScene:(ZegoRangeScene *)rangeScene userStreamStateUpdate:(ZegoStreamState)state forUserID:(NSString *)userID streamID:(NSString *)streamID;
The callback notification of local user play other users' stream state change.
Declared in ZegoExpressEventHandler.h

Parameters

NameTypeDescription
rangeSceneZegoRangeScene *Range scene instance that triggers this callback.
userIDNSString *User ID.
streamIDNSString *User's stream ID.
stateZegoStreamStateThe state of local user play stream.

Details

The callback notification of local user plays other users' stream state change. When to trigger: The local user plays other users' stream state changes.

  • Available since: 3.0.0
  • Restrictions: Do not call the SDK interface in the callback thread.

rangeScene:userMicUpdate:forUserID

rangeScene:userMicUpdate:forUserID
- (void)rangeScene:(ZegoRangeScene *)rangeScene userMicUpdate:(ZegoDeviceState)state forUserID:(NSString *)userID;
User microphone state change callback.
Declared in ZegoExpressEventHandler.h

Parameters

NameTypeDescription
rangeSceneZegoRangeScene *Range scene instance that triggers this callback.
userIDNSString *User ID.
stateZegoDeviceStateDevice state.

Details

User microphone state change callback. When to trigger: User microphone state change

  • Restrictions: Do not call the SDK interface in the callback thread.

rangeScene:userCameraUpdate:forUserID

rangeScene:userCameraUpdate:forUserID
- (void)rangeScene:(ZegoRangeScene *)rangeScene userCameraUpdate:(ZegoDeviceState)state forUserID:(NSString *)userID;
User camera state change callback.
Declared in ZegoExpressEventHandler.h

Parameters

NameTypeDescription
rangeSceneZegoRangeScene *Range scene instance that triggers this callback.
userIDNSString *User ID.
stateZegoDeviceStateDevice state.

Details

User camera state change callback. When to trigger: User camera state change.

  • Restrictions: Do not call the SDK interface in the callback thread.

rangeScene:userSpeakerUpdate:forUserID

rangeScene:userSpeakerUpdate:forUserID
- (void)rangeScene:(ZegoRangeScene *)rangeScene userSpeakerUpdate:(ZegoDeviceState)state forUserID:(NSString *)userID;
User speaker state change callback.
Declared in ZegoExpressEventHandler.h

Parameters

NameTypeDescription
rangeSceneZegoRangeScene *Range scene instance that triggers this callback.
userIDNSString *User ID.
stateZegoDeviceStateDevice state.

Details

User speaker state change callback. When to trigger: User speaker state change.

  • Restrictions: Do not call the SDK interface in the callback thread.

ZegoRangeSceneTeam

Declared in ZegoExpressDefines.h

Methods

setEventHandler:

setEventHandler:
- (BOOL)setEventHandler:(nullable id<ZegoRangeSceneTeamEventHandler>) handler;
set range scene team event handler.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
handlernullable id<ZegoRangeSceneTeamEventHandler>The object used to receive range scene team callbacks.

Details

Set the callback function of the range scene team module.

  • When to call: After getting range scene team instance by [getRangeSceneTeam].
  • Available since: 3.1.0

Return

The result of set range scene team event handler, true: success, false: fail.

joinTeam:callback:

joinTeam:callback:
- (int)joinTeam:(ZegoTeamParam *) config callback:(nullable ZegoRangeSceneJoinTeamCallback) callback;
Join team.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
configZegoTeamParam *Team Param.
callbacknullable ZegoRangeSceneJoinTeamCallbackThe callback of join team.

Details

Join team. Use case: Often used in meta world scenarios, after join the same team, team members can see and hear each other.

  • When to call: After login scene by [loginScene].
  • Available since: 3.1.0
  • Restrictions: None.

Return

Error code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details.

leaveTeam:callback:

leaveTeam:callback:
- (int)leaveTeam:(unsigned int) teamID callback:(nullable ZegoRangeSceneLeaveTeamCallback) callback;
Leave team.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
teamIDunsigned intTeam ID.
callbacknullable ZegoRangeSceneLeaveTeamCallbackThe callback of leave team.

Details

Join team. Use case: Often used in meta world scenarios, after join the same team, team members can see and hear each other.

  • When to call: After join team by [joinTeam].
  • Available since: 3.1.0
  • Restrictions: None.

Return

Error code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details.

ZegoRangeSceneTeamEventHandler

Declared in ZegoExpressEventHandler.h

Methods

onTeamStateUpdate:state:errorCode:teamID:

onTeamStateUpdate:state:errorCode:teamID:
- (void)onTeamStateUpdate:(ZegoRangeScene *) rangeScene state:(ZegoTeamState) state errorCode:(int) errorCode teamID:(unsigned int) teamID;
The callback triggered when the team connection state changes.
Declared in ZegoExpressEventHandler.h

Parameters

NameTypeDescription
rangeSceneZegoRangeScene *Range scene instance that triggers this callback.
stateZegoTeamStateChanged team state.
errorCodeintError code, For details, please refer to Common Error Codes.
teamIDunsigned intTeam ID.

Details

This callback is triggered when the connection status of the team changes, and the reason for the change is notified.

  • Use cases: Developers can use this callback to determine the status of the current user in the team. When to trigger:
  1. The developer will receive this notification when calling the [joinTeam], [leaveTeam] functions.
  2. This notification may also be received when the network condition of the user's device changes (SDK will automatically join the team when reconnected, please refer to [Does ZEGO SDK support a fast reconnection for temporary disconnection] for details](https://docs.zegocloud.com/faq/reconnect?product=ExpressVideo&platform=all).
  • Caution: If the connection is being requested for a long time, the general probability is that the user's network is unstable.
  • Related APIs: [joinTeam]、[leaveTeam]
  • Available since: 3.1.0
  • Restrictions: None.

onTeamMemberUpdate:updateType:userList:teamID:

onTeamMemberUpdate:updateType:userList:teamID:
- (void)onTeamMemberUpdate:(ZegoRangeScene *) rangeScene updateType:(ZegoUpdateType) updateType userList:(NSArray<ZegoUser *> *) userList teamID:(unsigned int) teamID;
The callback triggered when the number of other users in the team increases or decreases.
Declared in ZegoExpressEventHandler.h

Parameters

NameTypeDescription
rangeSceneZegoRangeScene *Range scene instance that triggers this callback.
updateTypeZegoUpdateTypeUpdate type (add/delete).
userListNSArray<ZegoUser *> *List of users changed in the current team.
teamIDunsigned intTeam ID.

Details

When other users in the room are online or offline, which causes the user list in the room to change, the developer will be notified through this callback.

  • Use cases: Developers can use this callback to update the user list display in the room in real time. When to trigger:
    1. When the user join the room for the first time, if there are other users in the team, the SDK will trigger a callback notification with updateType being [ZegoUpdateTypeAdd], and userList is the other users in the team at this time.
    2. The user is already in the team. If another user join the team through the [joinTeam] function, the SDK will trigger a callback notification with updateType being [ZegoUpdateTypeAdd].
    3. If other users leave the team through the [leaveTeam] function, the SDK will trigger a callback notification with updateType being [ZegoUpdateTypeDelete].
  • Related APIs: [joinTeam]、[leaveTeam]
  • Available since: 3.1.0

ZegoRealTimeSequentialDataEventHandler

Declared in ZegoExpressEventHandler.h

Methods

manager:receiveRealTimeSequentialData:streamID

manager:receiveRealTimeSequentialData:streamID
- (void)manager:(ZegoRealTimeSequentialDataManager *)manager receiveRealTimeSequentialData:(NSData *)data streamID:(NSString *)streamID;
Callback for receiving real-time sequential data.
Declared in ZegoExpressEventHandler.h

Parameters

NameTypeDescription
managerZegoRealTimeSequentialDataManager *The real-time sequential data manager instance that triggers this callback.
dataNSData *The received real-time sequential data.
streamIDNSString *Subscribed stream ID

Details

Through this callback, you can receive real-time sequential data from the current subscribing stream.

  • Use cases: You need to listen to this callback when you need to receive real-time sequential data. When to trigger: After calling [startSubscribing] to successfully start the subscription, and when data is sent on the stream, this callback will be triggered.
  • Caution: None.
  • Available since: 2.14.0
  • Restrictions: None.

ZegoRealTimeSequentialDataManager

Declared in ZegoExpressDefines.h

Methods

setEventHandler:

setEventHandler:
- (void)setEventHandler:(nullable id<ZegoRealTimeSequentialDataEventHandler>) handler;
Sets up the real-time sequential data event handler.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
handlernullable id<ZegoRealTimeSequentialDataEventHandler>Event handler for real-time sequential data

Details

Set up real-time sequential data callback to monitor callbacks such as sending data results, receiving data, etc.

  • When to call: After create the [ZegoRealTimeSequentialDataManager] instance.
  • Caution: Calling this function will overwrite the callback set by the last call to this function.
  • Available since: 2.14.0
  • Restrictions: None.

startBroadcasting:

startBroadcasting:
- (void)startBroadcasting:(NSString *) streamID;
Start broadcasting real-time sequential data stream.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
streamIDNSString *Stream ID, a string of up to 256 characters.
Caution:
1. Need to be globally unique within the entire AppID (Note that it cannot be the same as the stream ID passed in [startPublishingStream]). 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.
2. Only support numbers, English characters and '-', '_'.

Details

This function allows users to broadcast their local real-time sequential data stream to the ZEGO RTC server, and other users in the same room can subscribe to the real-time sequential data stream for intercommunication through "streamID".

  • Use cases: Before sending real-time sequential data, you need to call this function to start broadcasting.
  • When to call: After creating the [ZegoRealTimeSequentialDataManager] instance.
  • Caution: After calling this function, you will receive the [onPublisherStateUpdate] callback to tell you the broadcast state (publish state) of this stream. After the broadcast is successful, other users in the same room will receive the [onRoomStreamUpdate] callback to tell them this stream has been added to the room.
  • Available since: 2.14.0
  • Restrictions: None.

stopBroadcasting:

stopBroadcasting:
- (void)stopBroadcasting:(NSString *) streamID;
Stop broadcasting real-time sequential data stream.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
streamIDNSString *The ID of the stream that needs to stop broadcasting.

Details

This function allows users to stop broadcasting their local real-time sequential data stream.

  • Use cases: When you no longer need to send real-time sequential data, you need to call this function to stop broadcasting.
  • When to call: After creating the [ZegoRealTimeSequentialDataManager] instance.
  • Caution: After calling this function, you will receive the [onPublisherStateUpdate] callback to tell you the broadcast state (publish state) of this stream. After stopping the broadcast, other users in the same room will receive the [onRoomStreamUpdate] callback to tell them this stream has been deleted from the room.
  • Available since: 2.14.0
  • Restrictions: None.

sendRealTimeSequentialData:streamID:callback:

sendRealTimeSequentialData:streamID:callback:
- (void)sendRealTimeSequentialData:(NSData *) data streamID:(NSString *) streamID callback:(nullable ZegoRealTimeSequentialDataSentCallback) callback;
Send real-time sequential data to the broadcasting stream ID.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
dataNSData *The real-time sequential data to be sent.
streamIDNSString *The stream ID to which the real-time sequential data is sent.
callbacknullable ZegoRealTimeSequentialDataSentCallbackSend real-time sequential data result callback.

Details

This function can be used to send real-time sequential data on the stream currently being broadcast.

  • Use cases: You need to call this function when you need to send real-time sequential data.
  • When to call: After calling [startBroadcasting].
  • Caution: None.
  • Available since: 2.14.0
  • Restrictions: None.

startSubscribing:

startSubscribing:
- (void)startSubscribing:(NSString *) streamID;
Start subscribing real-time sequential data stream.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
streamIDNSString *Stream ID, a string of up to 256 characters.
Caution:
Only support numbers, English characters and '-', '_'.

Details

This function allows users to subscribe to the real-time sequential data stream of remote users from the ZEGO RTC server.

  • Use cases: When you need to receive real-time sequential data sent from other remote users, you need to call this function to start subscribing to the stream broadcasted by other remote users.
  • When to call: After creating the [ZegoRealTimeSequentialDataManager] instance.
  • Caution: After calling this function, you will receive the [onPlayerStateUpdate] callback to tell you the subscribe state (play state) of this stream.
  • Available since: 2.14.0
  • Restrictions: None.

stopSubscribing:

stopSubscribing:
- (void)stopSubscribing:(NSString *) streamID;
Stop subscribing real-time sequential data stream.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
streamIDNSString *The ID of the stream that needs to stop subscribing.

Details

This function can be used to stop subscribing to the real-time sequential data stream.

  • Use cases: When you no longer need to receive real-time sequential data sent by other users, you need to call this function to stop subscribing to the other user's stream.
  • When to call: After creating the [ZegoRealTimeSequentialDataManager] instance.
  • Caution: After calling this function, you will receive the [onPlayerStateUpdate] callback to tell you the subscribe state (play state) of this stream.
  • Available since: 2.14.0
  • Restrictions: None.

getIndex

getIndex
- (NSNumber *)getIndex;
Get real-time sequential data manager index.
Declared in ZegoExpressDefines.h

Index of the real-time sequential data manager.

ZegoReceiveRangeParam

Receive range configuration.

Declared in ZegoExpressDefines.h

Properties

min

min
nonatomic, assign float min

The minimum distance at which the 3D sound effect starts to have attenuation effect, the value needs to be >= 0 and <= max, the default value is 0.

max

max
nonatomic, assign float max

The maximum range received, the value needs to be >= min, the default value is 0.

ZegoReplayKitExt

Declared in ZegoExpressDefines.h

Methods

sharedInstance

static
sharedInstance
+ (ZegoReplayKitExt *)sharedInstance;
Create a screen capture extension singleton.
Declared in ZegoExpressDefines.h

Create a screen sharing extension singleton for Broadcast upload Extension to send the capture screen data to the SDK.

  • Available since: 3.1.0

Extension singleton instance.

setupWithDelegate:

setupWithDelegate:
- (void)setupWithDelegate:(id<ZegoReplayKitExtHandler>)delegate API_AVAILABLE(ios (12.0));
Initialize the extension app.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
delegatenullable id<ZegoReplayKitExtHandler>Screen capture extension application event notification callback. Passing [nil] means no callback notification will be received.

Details

If the App Group configuration is not enabled, this interface can be used for initialization.

  • Use cases: It needs to be called in the [broadcastStartedWithSetupInfo] method in the implementation class of [RPBroadcastSampleHandler].
  • Available since: 3.1.0

setupWithDelegate:appGroup

setupWithDelegate:appGroup
- (void)setupWithDelegate:(id<ZegoReplayKitExtHandler>)delegate appGroup:(NSString *)groupID API_AVAILABLE(ios (12.0));
Use App Group to initialize the extension process, which can provide better performance and stability when sharing screens.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
delegatenullable id<ZegoReplayKitExtHandler>Screen capture extension application event notification callback. Passing [nil] means no callback notification will be received.
groupIDNSString *The host app and the extension app should belong to the same App Group, and the AppGroupID needs to be passed in here.

Details

Setting AppGroupID is used to share memory between app, which can improve the performance and stability of data transmission. At the same time, it is necessary to call the [setAppGroupID:] method to set the AppGroupID before starting [startScreenCapture] in the host App.

  • Use cases: It needs to be called in the [broadcastStartedWithSetupInfo] method in the implementation class of [RPBroadcastSampleHandler].
  • Available since: 3.3.0

finished

finished
- (void)finished API_AVAILABLE(ios (12.0));
Finish screen capture.
Declared in ZegoExpressDefines.h
  • Use cases: When the screen recording is stopped through the system control center, RPBroadcastSampleHandler.broadcastFinished will be called back and called in the broadcastFinished method.
  • Available since: 3.1.0

sendSampleBuffer:withType

sendSampleBuffer:withType
- (void)sendSampleBuffer:(CMSampleBufferRef)sampleBuffer withType:(RPSampleBufferType)sampleBufferType API_AVAILABLE(ios (12.0));
Media data sending method
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
sampleBufferCMSampleBufferRefCMSampleBuffer object which contains either video or audio data.
sampleBufferTypeRPSampleBufferTypeDetermine's the type of the sample buffer defined by the RPSampleBufferType enum.
  • Use cases: It needs to be called in the processSampleBuffer: method in the implementation class of RPBroadcastSampleHandler.
  • Available since: 3.1.0

ZegoReplayKitExtHandler

Declared in ZegoExpressEventHandler.h

Methods

broadcastFinished:reason

broadcastFinished:reason
- (void)broadcastFinished:(ZegoReplayKitExt *_Nonnull)broadcast reason:(ZegoReplayKitExtReason)reason API_AVAILABLE(ios (12.0));
Screen capture finished callback.
Declared in ZegoExpressEventHandler.h

Parameters

NameTypeDescription
broadcastZegoReplayKitExt *_NonnullScreen capture extended application instance.
reasonZegoReplayKitExtReasonThe reason why the screen capture extension application ended.
  • Use cases: You need to implement the ZegoReplayKitExtHandler protocol in the implementation class of RPBroadcastSampleHandler, get the information after the collection, and call the finishBroadcastWithError: method.
  • Available since: 3.1.0

ZegoReverbAdvancedParam

Audio reverberation advanced parameters.

Details

Developers can use the SDK's built-in presets to change the parameters of the reverb.

Declared in ZegoExpressDefines.h

Properties

roomSize

roomSize
nonatomic, assign float roomSize

Room size(%), in the range [0.0, 1.0], to control the size of the "room" in which the reverb is generated, the larger the room, the stronger the reverb.

reverberance

reverberance
nonatomic, assign float reverberance

Echo(%), in the range [0.0, 100.0], to control the trailing length of the reverb.

damping

damping
nonatomic, assign float damping

Reverb Damping(%), range [0.0, 100.0], controls the attenuation of the reverb, the higher the damping, the higher the attenuation.

wetOnly

wetOnly
nonatomic, assign BOOL wetOnly

only wet

wetGain

wetGain
nonatomic, assign float wetGain

wet gain(dB), range [-20.0, 10.0]

dryGain

dryGain
nonatomic, assign float dryGain

dry gain(dB), range [-20.0, 10.0]

toneLow

toneLow
nonatomic, assign float toneLow

Tone Low. 100% by default

toneHigh

toneHigh
nonatomic, assign float toneHigh

Tone High. 100% by default

preDelay

preDelay
nonatomic, assign float preDelay

PreDelay(ms), range [0.0, 200.0]

stereoWidth

stereoWidth
nonatomic, assign float stereoWidth

Stereo Width(%). 0% by default

ZegoReverbEchoParam

Audio reverberation echo parameters.

Declared in ZegoExpressDefines.h

Properties

inGain

inGain
nonatomic, assign float inGain

Gain of input audio signal, in the range [0.0, 1.0]

outGain

outGain
nonatomic, assign float outGain

Gain of output audio signal, in the range [0.0, 1.0]

numDelays

numDelays
nonatomic, assign int numDelays

Number of echos, in the range [0, 7]

delay

delay
nonatomic, copy NSArray<NSNumber *> * delay

Respective delay of echo signal, in milliseconds, in the range [0, 5000] ms

decay

decay
nonatomic, copy NSArray<NSNumber *> * decay

Respective decay coefficient of echo signal, in the range [0.0, 1.0]

ZegoReverbParam

Audio reverberation parameters.

Details

Developers can use the SDK's built-in presets to change the parameters of the reverb.

Declared in ZegoExpressDefines.h

Properties

roomSize

roomSize
nonatomic, assign float roomSize

Room size, in the range [0.0, 1.0], to control the size of the "room" in which the reverb is generated, the larger the room, the stronger the reverb.

reverberance

reverberance
nonatomic, assign float reverberance

Echo, in the range [0.0, 0.5], to control the trailing length of the reverb.

damping

damping
nonatomic, assign float damping

Reverb Damping, range [0.0, 2.0], controls the attenuation of the reverb, the higher the damping, the higher the attenuation.

dryWetRatio

dryWetRatio
nonatomic, assign float dryWetRatio

Dry/wet ratio, the range is greater than or equal to 0.0, to control the ratio between reverberation, direct sound and early reflections; dry part is set to 1 by default; the smaller the dry/wet ratio, the larger the wet ratio, the stronger the reverberation effect.

ZegoRoiRect

Coordinates used by the ROI function.

Declared in ZegoExpressDefines.h

Properties

x

x
nonatomic, assign int x

The horizontal offset from the top-left corner

y

y
nonatomic, assign int y

The vertical offset from the top-left corner

width

width
nonatomic, assign int width

The width of the rectangle

height

height
nonatomic, assign int height

The height of the rectangle

strength

strength
nonatomic, assign int strength

ROI strength, currently supported value range is [0, 4], 0 is no effect, 4 is the strongest.

ZegoRoomConfig

Advanced room configuration.

Details

Configure maximum number of users in the room and authentication token, etc.

Declared in ZegoExpressDefines.h

Properties

maxMemberCount

maxMemberCount
nonatomic, assign unsigned int maxMemberCount

The maximum number of users in the room, Passing 0 means unlimited, the default is unlimited.

isUserStatusNotify

isUserStatusNotify
nonatomic, assign BOOL isUserStatusNotify

Whether to enable the user in and out of the room callback notification [onRoomUserUpdate], the default is off. If developers need to use ZEGO Room user notifications, make sure that each user who login sets this flag to true

token

token
nonatomic, copy NSString * token

The token issued by the developer's business server is used to ensure security. For the generation rules, please refer to Using Token Authentication, the default is an empty string, that is, no authentication. In versions 2.17.0 and above, if appSign is not passed in when calling the [createEngine] API to create an engine, or if appSign is empty, this parameter must be set for authentication when logging in to a room.

capabilityNegotiationTypes

capabilityNegotiationTypes
nonatomic, assign unsigned int capabilityNegotiationTypes

The bitmask marker for capability negotiation, refer to enum [ZegoRoomCapabilityNegotiationTypesBitMask], when this param converted to binary, 0b01 that means 1 << 0 for enable the capability negotiation of all user in the room, 0x10 that means 1 << 1 for enable the capability negotiation of publisher in the room. The masks can be combined to allow different types of capability negotiation.

roomType

roomType
nonatomic, assign unsigned int roomType

The type of the room, generally, it can be ignored and set to 0.

Methods

defaultConfig

static
defaultConfig
+ (instancetype)defaultConfig;
Create a default room configuration
Declared in ZegoExpressDefines.h

The default configuration parameters are: the maximum number of users in the room is unlimited, the user will not be notified when the user enters or leaves the room, no authentication.

ZegoRoomConfig instance

ZegoRoomExtraInfo

Room extra information.

Declared in ZegoExpressDefines.h

Properties

key

key
nonatomic, copy NSString * key

The key of the room extra information.

value

value
nonatomic, copy NSString * value

The value of the room extra information.

updateUser

updateUser
nonatomic, strong ZegoUser * updateUser

The user who update the room extra information.Please do not fill in sensitive user information in this field, including but not limited to mobile phone number, ID number, passport number, real name, etc.

updateTime

updateTime
nonatomic, assign unsigned long long updateTime

Update time of the room extra information, UNIX timestamp, in milliseconds.

ZegoRoomRecvTransparentMessage

Received a transparent message from the room.

Details

Room transparent message, including message content, sending user, sending type, sending mode

Declared in ZegoExpressDefines.h

Properties

sendUser

sendUser
nonatomic, strong ZegoUser * sendUser

send message user

content

content
nonatomic, strong NSData * content

Message send content.

ZegoRoomSendTransparentMessage

Transparent message info.

Details

Room transparent message, including room id, message content, sending user, sending type, sending mode, timeout period

Declared in ZegoExpressDefines.h

Properties

sendMode

sendMode
nonatomic, assign ZegoRoomTransparentMessageMode sendMode

send mode

sendType

sendType
nonatomic, assign ZegoRoomTransparentMessageType sendType

send type

content

content
nonatomic, strong NSData * content

Message send content.

recvUserList

recvUserList
nonatomic, strong NSArray<ZegoUser *> * recvUserList

Message receiver list, when sendType appointed ZegoRoomTransparentMessageModeOnlyServer don't fill in. When appointed ZegoRoomTransparentMessageModeClientAndServer or ZegoRoomTransparentMessageModeOnlyClient, empty room will be sent to all online users.

timeOut

timeOut
nonatomic, assign int timeOut

send message timeout, The default value is 10s.

ZegoRoomStreamList

Room stream list.

Details

Room stream list.

Declared in ZegoExpressDefines.h

Properties

publishStreamList

publishStreamList
nonatomic, strong NSArray<ZegoStream *> * publishStreamList

Publish stream list

playStreamList

playStreamList
nonatomic, strong NSArray<ZegoStream *> * playStreamList

Play stream list

ZegoRtcStatsInfo

RTC Network Statistics

Declared in ZegoExpressDefines.h

Properties

totalTxBandwidth

totalTxBandwidth
nonatomic, assign double totalTxBandwidth

total upstream bandwidth, in kbps

avgTxRtt

avgTxRtt
nonatomic, assign unsigned int avgTxRtt

upstream average rtt, in milliseconds

avgTxPacketLostRate

avgTxPacketLostRate
nonatomic, assign double avgTxPacketLostRate

upstream average packet lost rate. in percentage, 0.0 ~ 1.0

totalRxBandwidth

totalRxBandwidth
nonatomic, assign double totalRxBandwidth

total downlink bandwidth, in kbps

avgRxRtt

avgRxRtt
nonatomic, assign unsigned int avgRxRtt

downlink average rtt, in milliseconds

avgRxPacketLostRate

avgRxPacketLostRate
nonatomic, assign double avgRxPacketLostRate

downlink average packet lost rate. in percentage, 0.0 ~ 1.0

avgPeerToPeerDelay

avgPeerToPeerDelay
nonatomic, assign unsigned int avgPeerToPeerDelay

average peer to peer delay, in milliseconds

ZegoSEIConfig

SEI configuration

Details

Used to set the relevant configuration of the Supplemental Enhancement Information.

Declared in ZegoExpressDefines.h

Properties

type

type
nonatomic, assign ZegoSEIType type

SEI type

Methods

defaultConfig

defaultConfig
- (void)+ (instancetype)defaultConfig;
Create a default SEI config object
Declared in ZegoExpressDefines.h

ZegoSEIConfig instance

ZegoSceneConfig

Scene config.

Declared in ZegoExpressDefines.h

Properties

channelCount

channelCount
unsigned int channelCount

State channel count.

ZegoSceneParam

Scene param.

Declared in ZegoExpressDefines.h

Properties

user

user
nonatomic, strong, nonnull ZegoUser * user

User object instance, configure userID, userName. that the userID needs to be globally unique with the same appID, otherwise the user who logs in later will kick out the user who logged in first.

sceneID

sceneID
long long sceneID

Scene ID.

templateID

templateID
unsigned int templateID

Scene template ID.

position

position
nonatomic, strong, nonnull ZegoPosition * position

User position.

broadcastMode

broadcastMode
ZegoBroadcastMode broadcastMode

Broadcast user's own information mode, the default is ALL.

token

token
NSString * token

Authentication token.

ZegoScenePlayerConfig

Advanced scene player configuration.

Declared in ZegoExpressDefines.h

Properties

rangeSceneHandle

rangeSceneHandle
nonatomic, assign int rangeSceneHandle

Range scene handle. Obtained through [getHandle] of ZegoRangeScene instance.

resourceMode

resourceMode
nonatomic, assign ZegoStreamResourceMode resourceMode

Stream resource mode.

cdnConfig

cdnConfig
nonatomic, strong, nullable ZegoCDNConfig * cdnConfig

The CDN configuration for playing stream. If set, the stream is play according to the URL instead of the streamID. After that, the streamID is only used as the ID of SDK internal callback.

ZegoScenePublisherConfig

Advanced scene publisher configuration.

Declared in ZegoExpressDefines.h

Properties

rangeSceneHandle

rangeSceneHandle
nonatomic, assign int rangeSceneHandle

Range scene handle. Obtained through [getHandle] of ZegoRangeScene instance.

ZegoSceneStreamConfig

Scene stream config.

Declared in ZegoExpressDefines.h

Properties

enablePlayInRange

enablePlayInRange
BOOL enablePlayInRange

Enable play stream in range or not.

enablePublishToWorld

enablePublishToWorld
BOOL enablePublishToWorld

Enable publish stream to world or not.

ZegoScreenCaptureAudioConfig

Screen capture audio config

Declared in ZegoExpressDefines.h

Properties

enableWindowCapture

enableWindowCapture
nonatomic, assign BOOL enableWindowCapture

Whether to collect window sound. true for collection, false for no collection, default false. (only for Windows 10 2004 and above versions)

ZegoScreenCaptureConfig

Screen capture configuration parameters.

Declared in ZegoExpressDefines.h

Properties

captureVideo

captureVideo
nonatomic, assign BOOL captureVideo

Whether to capture video when screen capture. The default is true.

captureAudio

captureAudio
nonatomic, assign BOOL captureAudio

Whether to capture audio when screen capture. The default is true.

microphoneVolume

microphoneVolume
nonatomic, assign unsigned int microphoneVolume

Set Microphone audio volume for ReplayKit. The range is 0 ~ 200. The default is 100. (only for iOS)

applicationVolume

applicationVolume
nonatomic, assign unsigned int applicationVolume

Set Application audio volume for ReplayKit. The range is 0 ~ 200. The default is 100. (only for iOS and Android)

cropRect

cropRect
nonatomic, assign CGRect cropRect

Set the crop rectangle during screen capture. The crop rectangle must be included in the rectangle of the original data, unit is pixel. (only for iOS/Android)

orientation

orientation
nonatomic, assign ZegoScreenCaptureOrientation orientation

Set the capture orientation of the screen capture. The capture orientation will be fixed, ignoring the system returned orientation. (only for iOS/Android)

muteExtensMicrophone

muteExtensMicrophone
nonatomic, assign BOOL muteExtensMicrophone

Set whether to mute the microphone of the extension process. The default is false. (only for iOS)

audioDeviceMode

audioDeviceMode
nonatomic, assign ZegoScreenCaptureAudioDeviceMode audioDeviceMode

Set the audio device mode for the specified scene, the default is None. (only for iOS) s:

  1. Only works when the audio main source is always a microphone;
  2. Only works for [startScreenCapture] interface, [updateScreenCapture] does not take effect;
  3. The audio device mode changes during screen capture may cause the audio output of the screen capture to be abnormal, which can be monitored through [onMobileScreenCaptureExceptionOccurred] callback, and if necessary, the screen capture needs to be restarted.;
  4. After the screen capture is stopped, the audio device mode before the screen capture will be restored.

ZegoScreenCaptureSource

Declared in ZegoExpressDefines.h

Methods

setEventHandler:

setEventHandler:
- (void)setEventHandler:(nullable id<ZegoScreenCaptureSourceEventHandler>) handler;
Sets up the screen capture source event handler.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
handlernullable id<ZegoScreenCaptureSourceEventHandler>Event handler for real-time sequential data.

Details

Set up screen capture source callback to monitor callbacks such as capture data, etc.

  • When to call: After create the [ZegoScreenCaptureSource] instance.
  • Caution: Calling this function will overwrite the callback set by the last call to this function.
  • Available since: 3.1.0
  • Restrictions: None.

updateCaptureSource:sourceType:

updateCaptureSource:sourceType:
- (void)updateCaptureSource:(unsigned int) sourceId sourceType:(ZegoScreenCaptureSourceType) sourceType;
Create the screen capture source
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
sourceIdunsigned intThe specified screen ID or window ID.
sourceTypeZegoScreenCaptureSourceTypeThe specified screen source type.

Details

Update a screen capture source object based on the provided source ID and source type.

  • Use cases: It is used when you need to record and share the screen or window.
  • When to call: It can be called after the engine by [createScreenCaptureSource] has been initialized.
  • Restrictions: Only available on Windows/macOS.

startCapture

startCapture
- (void)startCapture;
Start screen capture.
Declared in ZegoExpressDefines.h

Start screen capture.

  • When to call: It can be called after the engine by [createScreenCaptureSource] has been initialized.
  • Available since: 3.1.0

stopCapture

stopCapture
- (void)stopCapture;
Stop screen capture.
Declared in ZegoExpressDefines.h

Stop screen capture.

  • Available since: 3.1.0

getCaptureSourceRect

getCaptureSourceRect
- (CGRect)getCaptureSourceRect;
Gets the rectangle of the screen capture source.
Declared in ZegoExpressDefines.h

Gets the rectangle of the screen capture source.

  • Available since: 3.6.0
  • Restrictions: Called after starting [startScreenCapture] acquisition, only support in Windows/macOS.

Rect information about the capture resource.

updateCaptureRegion:

updateCaptureRegion:
- (void)updateCaptureRegion:(CGRect) rect;
Update the area captured by the screen.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
rectCGRectThe position of the area to be captured relative to the entire screen or window.

Details

Update the area captured by the screen.

  • When to call: It can be called after the engine by [createScreenCaptureSource] has been initialized.
  • Available since: 3.1.0
  • Restrictions: Only support in Windows/macOS.

updatePublishRegion:

updatePublishRegion:
- (void)updatePublishRegion:(CGRect) rect;
Update the streaming area of ​​the screen capture.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
rectCGRectThe position of the area to be pushed relative to the upper left corner of the capture screen, the actual capture screen size can be obtained through [onAvailableFrame].

Details

Update the streaming area of ​​the screen capture.

  • When to call: After updating the screen capture source [updateScreenCaptureSource].
  • Caution: The set area cannot exceed the size returned by [onAvailableFrame], otherwise the setting will fail and the original frame will be pushed. The failure of the streaming area will be notified through [onExceptionOccurred].
  • Available since: 3.8.0
  • Restrictions: Every time the screen capture source [updateScreenCaptureSource] is updated, the area will be cleared and needs to be reset, only support in Windows/macOS.

setExcludeWindowList:

setExcludeWindowList:
- (void)setExcludeWindowList:(NSArray<NSNumber *> *) list;
Sets the filtered list of windows.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
listNSArray<NSNumber *> *List of IDs to filter windows.

Details

Specify a list of windows, and filter these windows when capturing the screen, and not display them on the screen.

  • When to call: It can be called after the engine by [createScreenCaptureSource] has been initialized.
  • Available since: 3.1.0
  • Restrictions: Only available on Windows/macOS.

enableWindowActivate:

enableWindowActivate:
- (void)enableWindowActivate:(BOOL) active;
Whether to activate the promotion of the window to the foreground.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
activeBOOLWhether to activate the window. true to activate the window, false to not activate the window, the default is true.

Details

When the capture target is a window, set whether to activate the window to be displayed in the foreground during the first capture.

  • When to call: It can be called after the engine by [createScreenCaptureSource] has been initialized.
  • Available since: 3.1.0
  • Restrictions: Only available on Windows/macOS.

enableCursorVisible:

enableCursorVisible:
- (void)enableCursorVisible:(BOOL) visible;
Set whether to show the cursor
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
visibleBOOLWhether to show the cursor. true to show the cursor, false to not show the cursor, the default is true.

Details

Set whether to show the cursor.

  • When to call: It can be called after the engine by [createScreenCaptureSource] has been initialized.
  • Available since: 3.1.0
  • Restrictions: Only available on Windows/macOS.

enableHightLight:config:

enableHightLight:config:
- (void)enableHightLight:(BOOL) enable config:(ZegoLayerBorderConfig *) config;
Set whether to highlight the capture area
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
enableBOOLWhether to highlight the capture area. true to highlight, false to not highlight, the default is false.
configZegoLayerBorderConfig *Highlight capture area border configuration.

Details

Set whether to highlight the capture area.

  • When to call: It can be called after the engine by [createScreenCaptureSource] has been initialized.
  • Available since: 3.21.0
  • Restrictions: Only available on Windows/macOS.

enableAudioCapture:config:

enableAudioCapture:config:
- (void)enableAudioCapture:(BOOL) enable config:(ZegoScreenCaptureAudioConfig *) config;
Set whether to collect sound
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
enableBOOLWhether to collect sound. true for collection, false for no collection, default false.
configZegoScreenCaptureAudioConfig *Audio collection parameters.

Details

Set whether to collect sound.

  • When to call: At any time, it takes effect after starting screen capture. [setAudioSource] Set the acquisition source to ZegoAudioSourceTypeScreenCapture, and the screen acquisition and streaming channels are the same.
  • Available since: 3.23.0
  • Restrictions: Only applicable to Windows 8 and above versions.

getIndex

getIndex
- (NSNumber *)getIndex;
Get screen capture source index.
Declared in ZegoExpressDefines.h

Index of the screen capture source.

ZegoScreenCaptureSourceEventHandler

Declared in ZegoExpressEventHandler.h

Methods

screenCapture:availableFrame:dataLength:param

screenCapture:availableFrame:dataLength:param
- (void)screenCapture:(ZegoScreenCaptureSource *)source availableFrame:(const void *)data dataLength:(unsigned int)dataLength param:(ZegoVideoFrameParam *)param;
Callback for screen capture data
Declared in ZegoExpressEventHandler.h

Parameters

NameTypeDescription
sourceZegoScreenCaptureSource *Callback screen capture source object.
dataconst void *The screen captures the data of the image frame (eg: RGBA only needs to consider data[0], I420 needs to consider data[0,1,2]).
dataLengthunsigned intData length (eg: RGBA only needs to consider dataLength[0], I420 needs to consider dataLength[0,1,2]).
paramZegoVideoFrameParam *Screen capture image frame parameters.

Details

Callback for screen capture data.

  • Trigger: This callback is fired after the screen starts capturing [startCapture].
  • Caution: The callback does not actually take effect until call [setEventHandler] to set.
  • Available since: 3.1.0

screenCapture:exceptionOccurred

screenCapture:exceptionOccurred
- (void)screenCapture:(ZegoScreenCaptureSource *)source exceptionOccurred:(ZegoScreenCaptureSourceExceptionType)exceptionType;
The callback triggered when a screen capture source exception occurred
Declared in ZegoExpressEventHandler.h

Parameters

NameTypeDescription
sourceZegoScreenCaptureSource *Callback screen capture source object.
exceptionTypeZegoScreenCaptureSourceExceptionTypeCapture source exception type.

Details

The callback triggered when a screen capture source exception occurred.

  • Trigger: This callback is triggered when an exception occurs after the screen start capture.
  • Caution: The callback does not actually take effect until call [setEventHandler] to set.
  • Available since: 3.1.0
  • Restrictions: Only available on Windows/macOS.

screenCapture:captureType:exceptionOccurred

screenCapture:captureType:exceptionOccurred
- (void)screenCapture:(ZegoScreenCaptureSource *)source captureType:(ZegoScreenCaptureSourceType)sourceType exceptionOccurred:(ZegoScreenCaptureSourceExceptionType)exceptionType;
The callback triggered when a screen capture source capture type exception occurred
Declared in ZegoExpressEventHandler.h

Parameters

NameTypeDescription
sourceZegoScreenCaptureSource *Callback screen capture source object.
sourceTypeZegoScreenCaptureSourceTypeCapture source type.
exceptionTypeZegoScreenCaptureSourceExceptionTypeCapture source exception type.

Details

The callback triggered when a screen capture source capture type exception occurred.

  • Trigger: This callback is triggered when an exception occurs after the screen start capture.
  • Caution: The callback does not actually take effect until call [setEventHandler] to set.
  • Available since: 3.21.0
  • Restrictions: Only available on Windows/macOS.

screenCapture:windowState:windowRect

screenCapture:windowState:windowRect
- (void)screenCapture:(ZegoScreenCaptureSource *)source windowState:(ZegoScreenCaptureWindowState)windowState windowRect:(CGRect)windowRect;
The callback will be triggered when the state of the capture target window change.
Declared in ZegoExpressEventHandler.h

Parameters

NameTypeDescription
sourceZegoScreenCaptureSource *Callback screen capture source object.
windowStateZegoScreenCaptureWindowStateCapture window state.
windowRectZegoRectCapture window rect.
  • Caution: The callback does not actually take effect until call [setEventHandler] to set.
  • Available since: 3.4.0
  • Restrictions: Only available on Windows/macOS.

screenCapture:rectChanged

screenCapture:rectChanged
- (void)screenCapture:(ZegoScreenCaptureSource *)source rectChanged:(CGRect)rect;
The callback will be triggered when the state of the capture target window change.
Declared in ZegoExpressEventHandler.h

Parameters

NameTypeDescription
sourceZegoScreenCaptureSource *Callback screen capture source object.
rectZegoRectCapture source rect.
  • Caution: The callback does not actually take effect until call [setEventHandler] to set.
  • Available since: 3.7.0
  • Restrictions: Only available on Windows/macOS.

ZegoScreenCaptureSourceInfo

The screen captures source information.

Declared in ZegoExpressDefines.h

Properties

sourceType

sourceType
nonatomic, assign ZegoScreenCaptureSourceType sourceType

Target type for screen capture. (only for desktop)

sourceID

sourceID
nonatomic, assign unsigned int sourceID

The ID of the capture source.

sourceName

sourceName
nonatomic, copy NSString * sourceName

Capture source name (in UTF8 encoding).

thumbnailImage

thumbnailImage
nonatomic, copy ZGImage * _Nullable thumbnailImage

Thumbnail of the capture window.

iconImage

iconImage
nonatomic, copy ZGImage * _Nullable iconImage

The image content of the icon.

ZegoSoundLevelConfig

Configuration for start sound level monitor.

Declared in ZegoExpressDefines.h

Properties

millisecond

millisecond
nonatomic, assign unsigned int millisecond

Monitoring time period of the sound level, in milliseconds, has a value range of [100, 3000]. Default is 100 ms.

enableVAD

enableVAD
nonatomic, assign BOOL enableVAD

Set whether the sound level callback includes the VAD detection result.

ZegoSoundLevelInfo

Sound level info object.

Declared in ZegoExpressDefines.h

Properties

soundLevel

soundLevel
nonatomic, assign float soundLevel

Sound level value.

vad

vad
nonatomic, assign int vad

Whether the stream corresponding to StreamID contains voice, 0 means noise, 1 means normal voice. This value is valid only when the [enableVAD] parameter in the [ZegoSoundLevelConfig] configuration is set to true when calling [startSoundLevelMonitor].

ZegoStream

Stream object.

Details

Identify an stream object

Declared in ZegoExpressDefines.h

Properties

user

user
nonatomic, strong ZegoUser * user

User object instance.Please do not fill in sensitive user information in this field, including but not limited to mobile phone number, ID number, passport number, real name, etc.

streamID

streamID
nonatomic, copy NSString * streamID
  • Caution: You cannot include URL keywords, otherwise publishing stream and playing stream will fails. Only support numbers, English characters and '-', '_'.

extraInfo

extraInfo
nonatomic, copy NSString * extraInfo

Stream extra info

ZegoStreamRelayCDNInfo

Relay to CDN info.

Details

Including the URL of the relaying CDN, relaying state, etc.

Declared in ZegoExpressDefines.h

Properties

url

url
nonatomic, copy NSString * url

URL of publishing stream to CDN

state

state
nonatomic, assign ZegoStreamRelayCDNState state

State of relaying to CDN

updateReason

updateReason
nonatomic, assign ZegoStreamRelayCDNUpdateReason updateReason

Reason for relay state changed

stateTime

stateTime
nonatomic, assign unsigned long long stateTime

The timestamp when the state changed, UNIX timestamp, in milliseconds.

ZegoSwitchPlayingStreamConfig

Extended parameters for the [switchPlayingStream] interface.

Details

Extended parameters for the [switchPlayingStream] interface.

Declared in ZegoExpressDefines.h

Properties

switchType

switchType
nonatomic, assign ZegoSwitchPlayingStreamType switchType

Switch playing stream type.

switchTimeout

switchTimeout
nonatomic, assign int switchTimeout

Switch the stream timeout, the unit is seconds.

ZegoTeamParam

Team param.

Declared in ZegoExpressDefines.h

Properties

teamID

teamID
unsigned int teamID

Team ID.

ZegoTestNetworkConnectivityResult

test connectivity result

Declared in ZegoExpressDefines.h

Properties

connectCost

connectCost
nonatomic, assign unsigned int connectCost

connect cost

ZegoTrafficControlInfo

Externally encoded data traffic control information.

Declared in ZegoExpressDefines.h

Properties

fps

fps
nonatomic, assign int fps

Video FPS to be adjusted

bitrate

bitrate
nonatomic, assign int bitrate

Video bitrate in kbps to be adjusted

resolution

resolution
nonatomic, assign CGSize resolution

Video resolution to be adjusted

ZegoUser

User object.

Details

Configure user ID and username to identify users in the room. that the userID must be unique under the same appID, otherwise, there will be mutual kicks when logging in to the room. It is strongly recommended that userID corresponds to the user ID of the business APP, that is, a userID and a real user are fixed and unique, and should not be passed to the SDK in a random userID. Because the unique and fixed userID allows ZEGO technicians to quickly locate online problems.

Declared in ZegoExpressDefines.h

Properties

userID

userID
nonatomic, copy NSString * userID
  • Privacy reminder: Please do not fill in sensitive user information in this field, including but not limited to mobile phone number, ID number, passport number, real name, etc.
  • Caution: Only support numbers, English characters and '~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', '=', '-', '`', ';', '’', ',', '.', '<', '>', ''. Do not use '%' if you need to communicate with the Web SDK.

userName

userName
nonatomic, copy NSString * userName

User Name, a utf8 string with a maximum length of 256 bytes or less.Please do not fill in sensitive user information in this field, including but not limited to mobile phone number, ID number, passport number, real name, etc.

Methods

userWithUserID

userWithUserID
+ (instancetype)userWithUserID:(NSString *)userID;
Create a ZegoUser object
Declared in ZegoExpressDefines.h

userName and userID are set to match

ZegoUser instance

initWithUserID

initWithUserID
- (instancetype)initWithUserID:(NSString *)userID;
Create a ZegoUser object
Declared in ZegoExpressDefines.h

userName and userID are set to match

userWithUserID:userName

userWithUserID:userName
+ (instancetype)userWithUserID:(NSString *)userID userName:(NSString *)userName;
Create a ZegoUser object
Declared in ZegoExpressDefines.h

ZegoUser instance

initWithUserID:userName

initWithUserID:userName
- (instancetype)initWithUserID:(NSString *)userID userName:(NSString *)userName;
Create a ZegoUser object
Declared in ZegoExpressDefines.h

ZegoUser instance

ZegoVideoConfig

Video config.

Details

Configure parameters used for publishing stream, such as bitrate, frame rate, and resolution. Developers should note that the width and height resolution of the mobile and desktop are opposite. For example, 360p, the resolution of the mobile is 360x640, and the desktop is 640x360. When using external capture, the capture and encoding resolution of RTC cannot be set to 0*0, otherwise, there will be no video data in the publishing stream in the entire engine life cycle.

Declared in ZegoExpressDefines.h

Properties

captureResolution

captureResolution
nonatomic, assign CGSize captureResolution

Capture resolution, control the resolution of camera image acquisition. SDK requires the width and height to be set to even numbers. Only the camera is not started and the custom video capture is not used, the setting is effective. For performance reasons, the SDK scales the video frame to the encoding resolution after capturing from camera and before rendering to the preview view. Therefore, the resolution of the preview image is the encoding resolution. If you need the resolution of the preview image to be this value, Please call [setCapturePipelineScaleMode] first to change the capture pipeline scale mode to [Post]

encodeResolution

encodeResolution
nonatomic, assign CGSize encodeResolution

Encode resolution, control the image resolution of the encoder when publishing stream. SDK requires the width and height to be set to even numbers. The settings before and after publishing stream can be effective

fps

fps
nonatomic, assign int fps

Frame rate, control the frame rate of the camera and the frame rate of the encoder. Publishing stream set to 60 fps, playing stream to take effect need contact technical support

bitrate

bitrate
nonatomic, assign int bitrate

Bit rate in kbps. The settings before and after publishing stream can be effective. The SDK will automatically set the bit rate suitable for the scenario selected by the developer. If the bit rate manually set by the developer exceeds the reasonable range, the SDK will automatically process the bit rate according to the reasonable range. If you need to configure a high bit rate due to business needs, please contact ZEGO Business.

codecID

codecID
nonatomic, assign ZegoVideoCodecID codecID

The codec id to be used, the default value is [default]. Settings only take effect before publishing stream

keyFrameInterval

keyFrameInterval
nonatomic, assign int keyFrameInterval
  • Required: No.
  • Default value: 2 seconds.
  • Value range: [2, 5].
  • Caution: The setting is only valid before pushing.

Methods

defaultConfig

defaultConfig
- (void)+ (instancetype)defaultConfig;
Create default video configuration(360p, 15fps, 600kbps)
Declared in ZegoExpressDefines.h

360p, 15fps, 600kbps

ZegoVideoConfig instance

configWithPreset

configWithPreset
- (void)+ (instancetype)configWithPreset:(ZegoVideoConfigPreset)preset;
Create video configuration with preset enumeration values
Declared in ZegoExpressDefines.h

ZegoVideoConfig instance

initWithPreset

initWithPreset
- (instancetype)initWithPreset:(ZegoVideoConfigPreset)preset;
Create video configuration with preset enumeration values
Declared in ZegoExpressDefines.h

ZegoVideoConfig instance

ZegoVideoDenoiseParams

Video denoise params.

Declared in ZegoExpressDefines.h

Properties

mode

mode
nonatomic, assign ZegoVideoDenoiseMode mode

Video denoise mode.

  • Default value: Off.

strength

strength
nonatomic, assign ZegoVideoDenoiseStrength strength

Video denoise strength.

  • Default value: Light.

ZegoVideoEncodedFrameParam

Object for video encoded frame fieldeter.

Details

Including video encoded frame format, width and height, etc.

Declared in ZegoExpressDefines.h

Properties

format

format
nonatomic, assign ZegoVideoEncodedFrameFormat format

Video encoded frame format

isKeyFrame

isKeyFrame
nonatomic, assign BOOL isKeyFrame

Whether it is a keyframe

rotation

rotation
nonatomic, assign int rotation

Video frame counterclockwise rotation angle

size

size
nonatomic, assign CGSize size

Video frame size

SEIData

SEIData
nonatomic, strong, nullable NSData * SEIData

SEI data (Optional, if you don't need to send SEI, set it to nil. Deprecated, use [sendSEI] instead). Useful when set format as [AVCC] or [AnnexB]

isExternalClock

isExternalClock
nonatomic, assign BOOL isExternalClock

Whether to use the external timestamp completely. The default is false. When set to false, the SDK will adjust based on the timestamps of the audio frame and video frame to ensure audio-video synchronization. When set to true, the SDK does not adjust the timestamp and uses the external timestamp completely.

ZegoVideoFrameParam

Object for video frame fieldeter.

Details

Including video frame format, width and height, etc.

Declared in ZegoExpressDefines.h

Properties

format

format
nonatomic, assign ZegoVideoFrameFormat format

Video frame format

strides

strides
nonatomic, assign int * strides

Number of bytes per line (for example: BGRA only needs to consider strides [0], I420 needs to consider strides [0,1,2])

rotation

rotation
nonatomic, assign int rotation

The rotation direction of the video frame, the SDK rotates clockwise

size

size
nonatomic, assign CGSize size

Video frame size

ZegoVocalRangeParam

Vocal range configuration.

Declared in ZegoExpressDefines.h

Properties

min

min
nonatomic, assign float min

The minimum distance at which the 3D sound effect starts to have attenuation effect, the value needs to be >= 0 and <= max, the default value is 0.

max

max
nonatomic, assign float max

The maximum range of the sound, the value needs to be >= min, the default value is 0.

ZegoVoiceChangerParam

Voice changer parameter.

Details

Developer can use the built-in presets of the SDK to change the parameters of the voice changer.

Declared in ZegoExpressDefines.h

Properties

pitch

pitch
nonatomic, assign float pitch

Pitch parameter, value range [-12.0, 12.0], the larger the value, the sharper the sound, set it to 0.0 to turn off. that on v2.18.0 and older version, the value range is [-8.0, 8.0].

ZegoWatermark

Watermark object.

Details

Configure a watermark image URL and the layout of the watermark in the screen.

Declared in ZegoExpressDefines.h

Properties

imageURL

imageURL
nonatomic, copy NSString * imageURL

The path of the watermark image. Support local file absolute path (file://xxx), Asset resource path (asset://xxx). The format supports png, jpg. The maximum length is less than 512 bytes.

layout

layout
nonatomic, assign CGRect layout

Watermark image layout

Methods

initWithImageURL:layout

initWithImageURL:layout
- (instancetype)initWithImageURL:(NSString *)imageURL layout:(CGRect)layout;
Create a watermark object
Declared in ZegoExpressDefines.h

ZegoWatermark instance

Previous

Function Overview

Next

Protocol

On this page

Back to top