logo
On this page

Class

IZegoCopyrightedMusicHandlerIZegoEventHandler
ZegoCopyrightedMusicZegoExpressEngine

IZegoCopyrightedMusicHandler

Declared in IZegoCopyrightedMusicHandler.cs

Methods

OnDownloadProgressUpdate

OnDownloadProgressUpdate
public delegate void OnDownloadProgressUpdate(ZegoCopyrightedMusic copyrightedMusic,string resourceID,float progressRate)
Callback for download song or accompaniment progress rate.
Declared in IZegoCopyrightedMusicHandler.cs
NameTypeDescription
copyrightedMusicZegoCopyrightedMusicCopyrighted music instance that triggers this callback.
resourceIDstringThe resource ID of the song or accompaniment that triggered this callback.
progressRatefloatdownload progress rate.

IZegoEventHandler

Declared in IZegoEventHandler.cs

Methods

OnDebugError

OnDebugError
public delegate void OnDebugError(int errorCode,string funcName,string info)
The callback for obtaining debugging error information.
Declared in IZegoEventHandler.cs

Parameters

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

Details

When the SDK functions are not used correctly, the callback prompts for detailed error information.

  • Trigger: Notify the developer when an exception occurs in the SDK.
  • Caution: None.
  • Available since: 1.1.0
  • Restrictions: None.

OnEngineStateUpdate

OnEngineStateUpdate
public delegate void OnEngineStateUpdate(ZegoEngineState state)
The callback triggered when the audio/video engine state changes.
Declared in IZegoEventHandler.cs

Parameters

NameTypeDescription
stateZegoEngineStateThe audio/video engine state.

Details

Callback notification of audio/video engine status update. When audio/video functions are enabled, such as preview, push streaming, local media player, audio data observering, etc., the audio/video engine will enter the start state. When you exit the room or disable all audio/video functions , The audio/video engine will enter the stop state.

  • Trigger: The developer called the relevant function to change the state of the audio and video engine. For example: 1. Called ZegoExpressEngine's [startPreview], [stopPreview], [startPublishingStream], [stopPublishingStream], [startPlayingStream], [stopPlayingStream], [startAudioDataObserver], [stopAudioDataObserver] and other functions. 2. The related functions of MediaPlayer are called. 3. The [LogoutRoom] function was called. 4. The related functions of RealTimeSequentialDataManager are called.
  • Caution: 1. When the developer calls [destroyEngine], this notification will not be triggered because the resources of the SDK are completely released. 2. If there is no special need, the developer does not need to pay attention to this callback.
  • Available since: 1.1.0
  • Restrictions: Not available for WebGL.

OnRoomStateUpdate

OnRoomStateUpdate
public delegate void OnRoomStateUpdate(string roomID,ZegoRoomState state,int errorCode,string extendedData)
Notification of the room connection state changes.
Declared in IZegoEventHandler.cs

Parameters

NameTypeDescription
roomIDstringRoom ID, a string of up to 128 bytes in length.
stateZegoRoomStateChanged room state.
errorCodeintError code, For details, please refer to Common Error Codes.
extendedDatastringExtended Information with state updates. When the room login is successful, the key "room_session_id" can be used to obtain the unique RoomSessionID of each audio and video communication, which identifies the continuous communication from the first user in the room to the end of the audio and video communication. It can be used in scenarios such as call quality scoring and call problem diagnosis.

Details

This callback is triggered when the connection status of the room changes, and the reason for the change is notified.For versions 2.18.0 and above, it is recommended to use the onRoomStateChanged callback instead of the onRoomStateUpdate callback to monitor room state changes.

  • Use cases: Developers can use this callback to determine the status of the current user in the room. When to trigger:
  1. The developer will receive this notification when calling the [loginRoom], [logoutRoom], [switchRoom] functions.
  2. This notification may also be received when the network condition of the user's device changes (SDK will automatically log in to the room when disconnected, 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: [loginRoom]、[logoutRoom]、[switchRoom]
  • Available since: 1.1.0
  • Restrictions: None.

OnRoomUserUpdate

OnRoomUserUpdate
public delegate void OnRoomUserUpdate(string roomID,ZegoUpdateType updateType,uint userCount,List<ZegoUser> userList)
The callback triggered when the number of other users in the room increases or decreases.
Declared in IZegoEventHandler.cs

Parameters

NameTypeDescription
roomIDstringRoom ID where the user is logged in, a string of up to 128 bytes in length.
updateTypeZegoUpdateTypeUpdate type (add/delete).
userCountuint
userListList<ZegoUser>List of users changed in the current room.

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 logs in to the room for the first time, if there are other users in the room, the SDK will trigger a callback notification with updateType being [ZegoUpdateTypeAdd], and userList is the other users in the room at this time.
    2. The user is already in the room. If another user logs in to the room through the [loginRoom] or [switchRoom] functions, the SDK will trigger a callback notification with updateType being [ZegoUpdateTypeAdd].
    3. If other users log out of this room through the [logoutRoom] or [switchRoom] functions, the SDK will trigger a callback notification with updateType being [ZegoUpdateTypeDelete].
    4. The user is already in the room. If another user is kicked out of the room from the server, the SDK will trigger a callback notification with updateType being [ZegoUpdateTypeDelete].
  • Related APIs: [loginRoom]、[logoutRoom]、[switchRoom]
  • Available since: 1.1.0
  • Restrictions: If developers need to use ZEGO room users notifications, please ensure that the [ZegoRoomConfig] sent by each user when logging in to the room has the [isUserStatusNotify] property set to true, otherwise the callback notification will not be received.

OnRoomOnlineUserCountUpdate

OnRoomOnlineUserCountUpdate
public delegate void OnRoomOnlineUserCountUpdate(string roomID,int count)
The callback triggered every 30 seconds to report the current number of online users.
Declared in IZegoEventHandler.cs

Parameters

NameTypeDescription
roomIDstringRoom ID where the user is logged in, a string of up to 128 bytes in length.
countintCount of online users.

Details

This method will notify the user of the current number of online users in the room.

  • Use cases: Developers can use this callback to show the number of user online in the current room.
  • When to call /Trigger: After successfully logging in to the room.
  • Caution: 1. This function is called back every 30 seconds. 2. Because of this design, when the number of users in the room exceeds 500, there will be some errors in the statistics of the number of online people in the room.
  • Available since: 1.7.0
  • Restrictions: None.

OnRoomStreamUpdate

OnRoomStreamUpdate
public delegate void OnRoomStreamUpdate(string roomID,ZegoUpdateType updateType,List<ZegoStream> streamList,string extendedData)
The callback triggered when the number of streams published by the other users in the same room increases or decreases.
Declared in IZegoEventHandler.cs

Parameters

NameTypeDescription
roomIDstringRoom ID where the user is logged in, a string of up to 128 bytes in length.
updateTypeZegoUpdateTypeUpdate type (add/delete).
streamListList<ZegoStream>Updated stream list.
extendedDatastringExtended information with stream updates.When receiving a stream deletion notification, the developer can convert the string into a json object to get the stream_delete_reason field, which is an array of stream deletion reasons, and the stream_delete_reason[].code field may have the following values: 1 (the user actively stops publishing stream) ; 2 (user heartbeat timeout); 3 (user repeated login); 4 (user kicked out); 5 (user disconnected); 6 (removed by the server).

Details

When other users in the room start publishing stream or stop publishing stream, the streaming list in the room changes, and the developer will be notified through this callback.

  • Use cases: This callback is used to monitor stream addition or stream deletion notifications of other users in the room. Developers can use this callback to determine whether other users in the same room start or stop publishing stream, so as to achieve active playing stream [startPlayingStream] or take the initiative to stop the playing stream [stopPlayingStream], and use it to change the UI controls at the same time. When to trigger:
    1. When the user logs in to the room for the first time, if there are other users publishing streams in the room, the SDK will trigger a callback notification with updateType being [ZegoUpdateTypeAdd], and streamList is an existing stream list.
    2. The user is already in the room. if another user adds a new push, the SDK will trigger a callback notification with updateType being [ZegoUpdateTypeAdd].
    3. The user is already in the room. If other users stop streaming, the SDK will trigger a callback notification with updateType being [ZegoUpdateTypeDelete].
    4. The user is already in the room. If other users leave the room, the SDK will trigger a callback notification with updateType being [ZegoUpdateTypeDelete].
  • Available since: 1.1.0
  • Restrictions: None.

OnRoomStreamExtraInfoUpdate

OnRoomStreamExtraInfoUpdate
public delegate void OnRoomStreamExtraInfoUpdate(string roomID,List<ZegoStream> streamList)
The callback triggered when there is an update on the extra information of the streams published by other users in the same room.
Declared in IZegoEventHandler.cs

Parameters

NameTypeDescription
roomIDstringRoom ID where the user is logged in, a string of up to 128 bytes in length.
streamListList<ZegoStream>List of streams that the extra info was updated.

Details

All users in the room will be notified by this callback when the extra information of the stream in the room is updated.

  • Use cases: Users can realize some business functions through the characteristics of stream extra information consistent with stream life cycle.
  • When to call /Trigger: When a user publishing the stream update the extra information of the stream in the same room, other users in the same room will receive the callback.
  • Caution: Unlike the stream ID, which cannot be modified during the publishing process, the stream extra information can be updated during the life cycle of the corresponding stream ID.
  • Related APIs: Users who publish stream can set extra stream information through [setStreamExtraInfo].
  • Available since: 1.1.0
  • Restrictions: None.

OnRoomExtraInfoUpdate

OnRoomExtraInfoUpdate
public delegate void OnRoomExtraInfoUpdate(string roomID,List<ZegoRoomExtraInfo> roomExtraInfoList)
The callback triggered when there is an update on the extra information of the room.
Declared in IZegoEventHandler.cs

Parameters

NameTypeDescription
roomIDstringRoom ID where the user is logged in, a string of up to 128 bytes in length.
roomExtraInfoListList<ZegoRoomExtraInfo>List of the extra info updated.

Details

After the room extra information is updated, all users in the room will be notified except update the room extra information user.

  • Use cases: Extra information for the room.
  • When to call /Trigger: When a user update the room extra information, other users in the same room will receive the callback.
  • Related APIs: Users can update room extra information through [setRoomExtraInfo] function.
  • Available since: 1.1.0
  • Restrictions: None.

OnPublisherStateUpdate

OnPublisherStateUpdate
public delegate void OnPublisherStateUpdate(string streamID,ZegoPublisherState state,int errorCode,string extendedData)
The callback triggered when the state of stream publishing changes.
Declared in IZegoEventHandler.cs

Parameters

NameTypeDescription
streamIDstringStream ID.
stateZegoPublisherStateState of publishing stream.
errorCodeintThe error code corresponding to the status change of the publish stream, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.
extendedDatastringExtended information with state updates, include playing stream CDN address.

Details

After calling the [startPublishingStream] successfully, the notification of the publish stream state change can be obtained through the callback function. You can roughly judge the user's uplink network status based on whether the state parameter is in [PUBLISH_REQUESTING].

  • Caution: The parameter [extendedData] is extended information with state updates. If you use ZEGO's CDN content distribution network, after the stream is successfully published, the keys of the content of this parameter are [flv_url_list], [rtmp_url_list], [hls_url_list], these correspond to the publishing stream URLs of the flv, rtmp, and hls protocols.
  • Related callbacks: After calling the [startPlayingStream] successfully, the notification of the play stream state change can be obtained through the callback function [onPlayerStateUpdate]. You can roughly judge the user's downlink network status based on whether the state parameter is in [PLAY_REQUESTING].
  • Available since: 1.1.0

OnPublisherQualityUpdate

OnPublisherQualityUpdate
public delegate void OnPublisherQualityUpdate(string streamID,ZegoPublishStreamQuality quality)
Callback for current stream publishing quality.
Declared in IZegoEventHandler.cs

Parameters

NameTypeDescription
streamIDstringStream ID.
qualityZegoPublishStreamQualityPublishing stream quality, including audio and video framerate, bitrate, RTT, etc.

Details

After calling the [startPublishingStream] successfully, the callback will be received every 3 seconds default(If you need to change the time, please contact the instant technical support to configure). Through the callback, the collection frame rate, bit rate, RTT, packet loss rate and other quality data of the published audio and video stream can be obtained, and the health of the publish stream can be monitored in real time.You can monitor the health of the published audio and video streams in real time according to the quality parameters of the callback function, in order to show the uplink network status in real time on the device UI.

  • Caution: If you does not know how to use the parameters of this callback function, you can only pay attention to the [level] field of the [quality] parameter, which is a comprehensive value describing the uplink network calculated by SDK based on the quality parameters.
  • Related callbacks: After calling the [startPlayingStream] successfully, the callback [onPlayerQualityUpdate] will be received every 3 seconds. You can monitor the health of play streams in real time based on quality data such as frame rate, code rate, RTT, packet loss rate, etc.
  • Available since: 1.1.0

OnPublisherCapturedAudioFirstFrame

OnPublisherCapturedAudioFirstFrame
public delegate void OnPublisherCapturedAudioFirstFrame()
The callback triggered when the first audio frame is captured.
Declared in IZegoEventHandler.cs

This callback will be received when the SDK starts the microphone to capture the first frame of audio data. If this callback is not received, the audio capture device is occupied or abnormal.

  • Trigger: When the engine of the audio/video module inside the SDK starts, the SDK will go and collect the audio data from the local device and will receive the callback at that time.
  • Related callbacks: Determine if the SDK actually collected video data by the callback function [onPublisherCapturedVideoFirstFrame], determine if the SDK has rendered the first frame of video data collected by calling back [onPublisherRenderVideoFirstFrame].
  • Available since: 1.1.0

OnPublisherCapturedVideoFirstFrame

OnPublisherCapturedVideoFirstFrame
public delegate void OnPublisherCapturedVideoFirstFrame(ZegoPublishChannel channel)
The callback triggered when the first video frame is captured.
Declared in IZegoEventHandler.cs

Parameters

NameTypeDescription
channelZegoPublishChannelPublishing stream channel.If you only publish one audio and video stream, you can ignore this parameter.

Details

The SDK will receive this callback when the first frame of video data is captured. If this callback is not received, the video capture device is occupied or abnormal.

  • Trigger: When the SDK's internal audio/video module's engine starts, the SDK will collect video data from the local device and will receive this callback.
  • Related callbacks: Determine if the SDK actually collected audio data by the callback function [onPublisherCapturedAudioFirstFrame], determine if the SDK has rendered the first frame of video data collected by calling back [onPublisherRenderVideoFirstFrame].
  • Available since: 1.1.0

OnPublisherVideoSizeChanged

OnPublisherVideoSizeChanged
public delegate void OnPublisherVideoSizeChanged(int width,int height,ZegoPublishChannel channel)
The callback triggered when the video capture resolution changes.
Declared in IZegoEventHandler.cs

Parameters

NameTypeDescription
widthintVideo capture resolution width.
heightintVideo capture resolution height.
channelZegoPublishChannelPublishing stream channel.If you only publish one audio and video stream, you can ignore this parameter.

Details

When the audio and video stream is not published [startPublishingStream] or previewed [startPreview] for the first time, the publishing stream or preview first time, that is, the engine of the audio and video module inside the SDK is started, the video data of the local device will be collected, and the collection resolution will change at this time.

  • Trigger: After the successful publish [startPublishingStream], the callback will be received if there is a change in the video capture resolution in the process of publishing the stream.
  • Use cases: You can use this callback to remove the cover of the local preview UI and similar operations.You can also dynamically adjust the scale of the preview view based on the resolution of the callback.
  • Caution: What is notified during external collection is the change in encoding resolution, which will be affected by flow control.
  • Available since: 1.1.0

OnPublisherRelayCDNStateUpdate

OnPublisherRelayCDNStateUpdate
public delegate void OnPublisherRelayCDNStateUpdate(string streamID,List<ZegoStreamRelayCDNInfo> infoList)
The callback triggered when the state of relayed streaming to CDN changes.
Declared in IZegoEventHandler.cs

Parameters

NameTypeDescription
streamIDstringStream ID.
infoListList<ZegoStreamRelayCDNInfo>List of information that the current CDN is relaying.

Details

Developers can use this callback to determine whether the audio and video streams of the relay CDN are normal. If they are abnormal, further locate the cause of the abnormal audio and video streams of the relay CDN and make corresponding disaster recovery strategies.

  • Trigger: After the ZEGO RTC server relays the audio and video streams to the CDN, this callback will be received if the CDN relay status changes, such as a stop or a retry.
  • Caution: If you do not understand the cause of the abnormality, you can contact ZEGO technicians to analyze the specific cause of the abnormality.
  • Available since: 1.1.0
  • Restrictions: Not available for WebGL.

OnPlayerStateUpdate

OnPlayerStateUpdate
public delegate void OnPlayerStateUpdate(string streamID,ZegoPlayerState state,int errorCode,string extendedData)
The callback triggered when the state of stream playing changes.
Declared in IZegoEventHandler.cs

Parameters

NameTypeDescription
streamIDstringstream ID.
stateZegoPlayerStateState of playing stream.
errorCodeintThe error code corresponding to the status change of the playing stream, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.
extendedDatastringExtended Information with state updates. As the standby, only an empty json table is currently returned.

Details

After calling the [startPlayingStream] successfully, the notification of the playing stream state change can be obtained through the callback function. You can roughly judge the user's downlink network status based on whether the state parameter is in [PLAY_REQUESTING]. When to trigger: After calling the [startPublishingStream], this callback is triggered when a playing stream's state changed.

  • Related callbacks: After calling the [startPublishingStream] successfully, the notification of the publish stream state change can be obtained through the callback function [onPublisherStateUpdate]. You can roughly judge the user's uplink network status based on whether the state parameter is in [PUBLISH_REQUESTING].
  • Available since: 1.1.0

OnPlayerQualityUpdate

OnPlayerQualityUpdate
public delegate void OnPlayerQualityUpdate(string streamID,ZegoPlayStreamQuality quality)
Callback for current stream playing quality.
Declared in IZegoEventHandler.cs

Parameters

NameTypeDescription
streamIDstringStream ID.
qualityZegoPlayStreamQualityPlaying stream quality, including audio and video framerate, bitrate, RTT, etc.

Details

After calling the [startPlayingStream] successfully, the callback will be received every 3 seconds default(If you need to change the time, please contact the instant technical support to configure). Through the callback, the collection frame rate, bit rate, RTT, packet loss rate and other quality data can be obtained, and the health of the played audio and video streams can be monitored in real time.

  • Use cases: You can monitor the health of the played audio and video streams in real time according to the quality parameters of the callback function, in order to show the downlink network status on the device UI in real time.
  • Caution: If you does not know how to use the various parameters of the callback function, you can only focus on the level field of the quality parameter, which is a comprehensive value describing the downlink network calculated by SDK based on the quality parameters.
  • Related callbacks: After calling the [startPublishingStream] successfully, a callback [onPublisherQualityUpdate] will be received every 3 seconds. You can monitor the health of publish streams in real time based on quality data such as frame rate, code rate, RTT, packet loss rate, etc.
  • Available since: 1.1.0

OnPlayerMediaEvent

OnPlayerMediaEvent
public delegate void OnPlayerMediaEvent(string streamID,ZegoPlayerMediaEvent mediaEvent)
The callback triggered when a media event occurs during streaming playing.
Declared in IZegoEventHandler.cs

Parameters

NameTypeDescription
streamIDstringStream ID.
mediaEventZegoPlayerMediaEventSpecific events received when playing the stream.

Details

This callback is used to receive pull streaming events.

  • Use cases: You can use this callback to make statistics on stutters or to make friendly displays in the UI of the app.
  • Available since: 1.1.0
  • Restrictions: Not available for WebGL. When to trigger: After calling the [startPublishingStream], this callback is triggered when an event such as audio and video jamming and recovery occurs in the playing stream.

OnPlayerRecvAudioFirstFrame

OnPlayerRecvAudioFirstFrame
public delegate void OnPlayerRecvAudioFirstFrame(string streamID)
The callback triggered when the first audio frame is received.
Declared in IZegoEventHandler.cs

Parameters

NameTypeDescription
streamIDstringStream ID.

Details

After the [startPlayingStream] function is called successfully, this callback will be called when SDK received the first frame of audio data.

  • Use cases: Developer can use this callback to count time consuming that take the first frame time or update the UI for playing stream.
  • Trigger: This callback is triggered when SDK receives the first frame of audio data from the network.
  • Related callbacks: After a successful call to [startPlayingStream], the callback function [onPlayerRecvVideoFirstFrame] determines whether the SDK has received the video data, and the callback [onPlayerRenderVideoFirstFrame] determines whether the SDK has rendered the first frame of the received video data.
  • Available since: 1.1.0

OnPlayerRecvVideoFirstFrame

OnPlayerRecvVideoFirstFrame
public delegate void OnPlayerRecvVideoFirstFrame(string streamID)
The callback triggered when the first video frame is received.
Declared in IZegoEventHandler.cs

Parameters

NameTypeDescription
streamIDstringStream ID.

Details

After the [startPlayingStream] function is called successfully, this callback will be called when SDK received the first frame of video data.

  • Use cases: Developer can use this callback to count time consuming that take the first frame time or update the UI for playing stream.
  • Trigger: This callback is triggered when SDK receives the first frame of video data from the network.
  • Related callbacks: After a successful call to [startPlayingStream], the callback function [onPlayerRecvAudioFirstFrame] determines whether the SDK has received the audio data, and the callback [onPlayerRenderVideoFirstFrame] determines whether the SDK has rendered the first frame of the received video data.
  • Available since: 1.1.0

OnPlayerRenderVideoFirstFrame

OnPlayerRenderVideoFirstFrame
public delegate void OnPlayerRenderVideoFirstFrame(string streamID)
The callback triggered when the first video frame is rendered.
Declared in IZegoEventHandler.cs

Parameters

NameTypeDescription
streamIDstringStream ID.

Details

After the [startPlayingStream] function is called successfully, this callback will be called when SDK rendered the first frame of video data.

  • Use cases: Developer can use this callback to count time consuming that take the first frame time or update the UI for playing stream.
  • Trigger: This callback is triggered when SDK rendered the first frame of video data from the network.
  • Related callbacks: After a successful call to [startPlayingStream], the callback function [onPlayerRecvAudioFirstFrame] determines whether the SDK has received the audio data, and the callback [onPlayerRecvVideoFirstFrame] determines whether the SDK has received the video data.
  • Available since: 1.1.0

OnPlayerVideoSizeChanged

OnPlayerVideoSizeChanged
public delegate void OnPlayerVideoSizeChanged(string streamID,int width,int height)
The callback triggered when the stream playback resolution changes.
Declared in IZegoEventHandler.cs

Parameters

NameTypeDescription
streamIDstringStream ID.
widthintVideo decoding resolution width.
heightintVideo decoding resolution height.

Details

After the [startPlayingStream] function is called successfully, the play resolution will change when the first frame of video data is received, or when the publisher changes the encoding resolution by calling [setVideoConfig], or when the network traffic control strategies work.

  • Use cases: Developers can update or switch the UI components that actually play the stream based on the final resolution of the stream.
  • Trigger: After the [startPlayingStream] function is called successfully, this callback is triggered when the video resolution changes while playing the stream.
  • Caution:
  1. If the stream is only audio data, the callback will not be triggered.
  2. If the user enables custom video rendering of the ZegoVideoBufferTypeEncodedData type, the SDK is not responsible for video decoding and will not trigger this callback.
  • Available since: 1.1.0

OnPlayerRecvSEI

OnPlayerRecvSEI
deprecated
public delegate void OnPlayerRecvSEI(string streamID,byte[] data)
The callback triggered when Supplemental Enhancement Information is received.
Declared in IZegoEventHandler.cs

Parameters

NameTypeDescription
streamIDstringStream ID.
databyte[]SEI content.

Details

After the [startPlayingStream] function is called successfully, when the remote stream sends SEI (such as directly calling [sendSEI], audio mixing with SEI data, and sending custom video capture encoded data with SEI, etc.), the local end will receive this callback.

  • Trigger: After the [startPlayingStream] function is called successfully, when the remote stream sends SEI, the local end will receive this callback.
  • Caution: 1. Since the video encoder itself generates an SEI with a payload type of 5, or when a video file is used for publishing, such SEI may also exist in the video file. Therefore, if the developer needs to filter out this type of SEI, it can be before [createEngine] Call [ZegoEngineConfig.advancedConfig("unregister_sei_filter", "XXXXX")]. Among them, unregister_sei_filter is the key, and XXXXX is the uuid filter string to be set. 2. When [mutePlayStreamVideo] or [muteAllPlayStreamVideo] is called to set only the audio stream to be pulled, the SEI will not be received.
  • Available since: 1.1.0
  • Restrictions: Not available for WebGL.
Deprecated
It will be deprecated in version 3.4.0 and above. Please use the [onPlayerSyncRecvSEI] function instead.

OnMixerRelayCDNStateUpdate

OnMixerRelayCDNStateUpdate
public delegate void OnMixerRelayCDNStateUpdate(string taskID,List<ZegoStreamRelayCDNInfo> infoList)
The callback triggered when the state of relayed streaming of the mixed stream to CDN changes.
Declared in IZegoEventHandler.cs

Parameters

NameTypeDescription
taskIDstringThe mixing task ID. Value range: the length does not exceed 256. Caution: This parameter is in string format and cannot contain URL keywords, such as 'http' and '?' etc., otherwise the push and pull flow will fail. Only supports numbers, English characters and'~','!','@','$','%','^','&','*','(',')','_' ,'+','=','-','`',';',''',',','.','<','>',''.
infoListList<ZegoStreamRelayCDNInfo>List of information that the current CDN is being mixed.

Details

The general situation of the mixing task on the ZEGO RTC server will push the output stream to the CDN using the RTMP protocol, and the state change during the push process will be notified from the callback function.

  • Use cases: It is often used when multiple video images are required to synthesize a video using mixed streaming, such as education, live teacher and student images. When to trigger: After the developer calls the [startMixerTask] function to start mixing, when the ZEGO RTC server pushes the output stream to the CDN, there is a state change.
  • Related callbacks: Develop can get the sound update notification of each single stream in the mixed stream through [OnMixerSoundLevelUpdate].
  • Related APIs: Develop can start a mixed flow task through [startMixerTask].
  • Available since: 1.2.1
  • Restrictions: Not available for WebGL.

OnMixerSoundLevelUpdate

OnMixerSoundLevelUpdate
public delegate void OnMixerSoundLevelUpdate(Dictionary<uint, float> soundLevels)
The callback triggered when the sound level of any input stream changes in the stream mixing process.
Declared in IZegoEventHandler.cs

Parameters

NameTypeDescription
soundLevelsDictionary<uint, float>The sound key-value pair of each single stream in the mixed stream, the key is the soundLevelID of each single stream, and the value is the sound value of the corresponding single stream. Value range: The value range of value is 0.0 ~ 100.0 (This value only represents the range of the sound level value returned by the callback, not the precision.).

Details

Developers can use this callback to display the effect of which stream’s anchor is talking on the UI interface of the mixed stream of the audience.

  • Use cases: It is often used when multiple video images are required to synthesize a video using mixed streaming, such as education, live teacher and student images. When to trigger: After the developer calls the [startPlayingStream] function to start playing the mixed stream. Callback notification period is 100 ms.
  • Related callbacks: [OnMixerRelayCDNStateUpdate] can be used to get update notification of mixing stream repost CDN status.
  • Related APIs: Develop can start a mixed flow task through [startMixerTask].
  • Available since: 1.2.1
  • Restrictions: The callback is triggered every 100 ms, and the trigger frequency cannot be set.Due to the high frequency of this callback, please do not perform time-consuming tasks or UI operations in this callback to avoid stalling.Not available for WebGL.

OnCapturedSoundLevelUpdate

OnCapturedSoundLevelUpdate
public delegate void OnCapturedSoundLevelUpdate(float soundLevel)
The local captured audio sound level callback.
Declared in IZegoEventHandler.cs

Parameters

NameTypeDescription
soundLevelfloatLocally captured sound level value, ranging from 0.0 to 100.0 (This value only represents the range of the sound level value returned by the callback, not the precision.) .

Details

The local captured audio sound level callback.

  • Trigger: After you start the sound level monitor by calling [startSoundLevelMonitor].
  • Caution: 1. The callback notification period is the parameter value set when the [startSoundLevelMonitor] is called. The callback value is the default value of 0 When you have not called the interface [startPublishingStream] and [startPreview]. 2. This callback is a high-frequency callback, and it is recommended not to do complex logic processing inside the callback.
  • Related APIs: Start sound level monitoring via [startSoundLevelMonitor]. Monitoring remote played audio sound level by callback [onRemoteSoundLevelUpdate]
  • Available since: 1.1.0

OnRemoteSoundLevelUpdate

OnRemoteSoundLevelUpdate
public delegate void OnRemoteSoundLevelUpdate(Dictionary<string, float> soundLevels)
The remote playing streams audio sound level callback.
Declared in IZegoEventHandler.cs

Parameters

NameTypeDescription
soundLevelsDictionary<string, float>Remote sound level hash map, key is the streamID, value is the sound level value of the corresponding streamID, value ranging from 0.0 to 100.0 (This value only represents the range of the sound level value returned by the callback, not the precision.).

Details

The remote playing streams audio sound level callback.

  • Trigger: After you start the sound level monitor by calling [startSoundLevelMonitor], you are in the state of playing the stream [startPlayingStream].
  • Caution: The callback notification period is the parameter value set when the [startSoundLevelMonitor] is called.
  • Related APIs: Start sound level monitoring via [startSoundLevelMonitor]. Monitoring local captured audio sound by callback [onCapturedSoundLevelUpdate] or [onCapturedSoundLevelInfoUpdate].
  • Available since: 1.1.0
  • Restrictions: Not available for WebGL.

OnCapturedAudioSpectrumUpdate

OnCapturedAudioSpectrumUpdate
public delegate void OnCapturedAudioSpectrumUpdate(float[] audioSpectrum)
The local captured audio spectrum callback.
Declared in IZegoEventHandler.cs

Parameters

NameTypeDescription
audioSpectrumfloat[]Locally captured audio spectrum value list. Spectrum value range is [0-2^30].

Details

The local captured audio spectrum callback.

  • Trigger: After you start the audio spectrum monitor by calling [startAudioSpectrumMonitor].
  • Caution: The callback notification period is the parameter value set when the [startAudioSpectrumMonitor] is called. The callback value is the default value of 0 When you have not called the interface [startPublishingStream] and [startPreview].
  • Related APIs: Start audio spectrum monitoring via [startAudioSpectrumMonitor]. Monitoring remote played audio spectrum by callback [onRemoteAudioSpectrumUpdate]
  • Available since: 1.1.0
  • Restrictions: Not available for WebGL.

OnRemoteAudioSpectrumUpdate

OnRemoteAudioSpectrumUpdate
public delegate void OnRemoteAudioSpectrumUpdate(Dictionary<string, float[]> audioSpectrums)
The remote playing streams audio spectrum callback.
Declared in IZegoEventHandler.cs

Parameters

NameTypeDescription
audioSpectrumsDictionary<string, float[]>Remote audio spectrum hash map, key is the streamID, value is the audio spectrum list of the corresponding streamID. Spectrum value range is [0-2^30]

Details

The remote playing streams audio spectrum callback.

  • Trigger: After you start the audio spectrum monitor by calling [startAudioSpectrumMonitor], you are in the state of playing the stream [startPlayingStream].
  • Caution: The callback notification period is the parameter value set when the [startAudioSpectrumMonitor] is called.
  • Related APIs: Start audio spectrum monitoring via [startAudioSpectrumMonitor]. Monitoring local played audio spectrum by callback [onCapturedAudioSpectrumUpdate].
  • Available since: 1.1.0
  • Restrictions: Not available for WebGL.

OnLocalDeviceExceptionOccurred

OnLocalDeviceExceptionOccurred
public delegate void OnLocalDeviceExceptionOccurred(ZegoDeviceExceptionType exceptionType,ZegoDeviceType deviceType,string deviceID)
The callback triggered when a local device exception occurred.
Declared in IZegoEventHandler.cs

Parameters

NameTypeDescription
exceptionTypeZegoDeviceExceptionTypeThe type of the device exception.
deviceTypeZegoDeviceTypeThe type of device where the exception occurred.
deviceIDstringDevice ID. Currently, only desktop devices are supported to distinguish different devices; for mobile devices, this parameter will return an empty string.

Details

The callback triggered when a local device exception occurs.

  • Trigger: This callback is triggered when the function of the local audio or video device is abnormal.
  • Available since: 2.15.0

OnRemoteCameraStateUpdate

OnRemoteCameraStateUpdate
public delegate void OnRemoteCameraStateUpdate(string streamID,ZegoRemoteDeviceState state)
The callback triggered when the state of the remote camera changes.
Declared in IZegoEventHandler.cs

Parameters

NameTypeDescription
streamIDstringStream ID.
stateZegoRemoteDeviceStateRemote camera status.

Details

The callback triggered when the state of the remote camera changes.

  • Use cases: Developers of 1v1 education scenarios or education small class scenarios and similar scenarios can use this callback notification to determine whether the camera device of the remote publishing stream device is working normally, and preliminary understand the cause of the device problem according to the corresponding state.
  • Trigger: When the state of the remote camera device changes, such as switching the camera, by monitoring this callback, it is possible to obtain an event related to the far-end camera, which can be used to prompt the user that the video may be abnormal.
  • Caution: This callback will not be called back when the remote stream is play from the CDN, or when custom video acquisition is used at the peer.
  • Available since: 1.1.0

OnRemoteMicStateUpdate

OnRemoteMicStateUpdate
public delegate void OnRemoteMicStateUpdate(string streamID,ZegoRemoteDeviceState state)
The callback triggered when the state of the remote microphone changes.
Declared in IZegoEventHandler.cs

Parameters

NameTypeDescription
streamIDstringStream ID.
stateZegoRemoteDeviceStateRemote microphone status.

Details

The callback triggered when the state of the remote microphone changes.

  • Use cases: Developers of 1v1 education scenarios or education small class scenarios and similar scenarios can use this callback notification to determine whether the microphone device of the remote publishing stream device is working normally, and preliminary understand the cause of the device problem according to the corresponding state.
  • Trigger: When the state of the remote microphone device is changed, such as switching a microphone, etc., by listening to the callback, it is possible to obtain an event related to the remote microphone, which can be used to prompt the user that the audio may be abnormal.
  • Caution: This callback will not be called back when the remote stream is play from the CDN, or when custom audio acquisition is used at the peer (But the stream is not published to the ZEGO RTC server.).
  • Available since: 1.1.0

OnIMRecvBroadcastMessage

OnIMRecvBroadcastMessage
public delegate void OnIMRecvBroadcastMessage(string roomID,List<ZegoBroadcastMessageInfo> messageList)
The callback triggered when Broadcast Messages are received.
Declared in IZegoEventHandler.cs

Parameters

NameTypeDescription
roomIDstringRoom ID. Value range: The maximum length is 128 bytes.
messageListList<ZegoBroadcastMessageInfo>List of received messages. Value range: Up to 50 messages can be received each time.

Details

This callback is used to receive broadcast messages sent by other users in the same room.

  • Use cases: Generally used in the live room. When to trigger: After calling [loginRoom] to log in to the room, if a user in the room sends a broadcast message via [sendBroadcastMessage] function, this callback will be triggered.
  • Caution: The broadcast message sent by the user will not be notified through this callback.
  • Related callbacks: You can receive room barrage messages through [onIMRecvBarrageMessage], and you can receive room custom signaling through [onIMRecvCustomCommand].
  • Available since: 1.2.1
  • Restrictions: Not available for WebGL.

OnIMRecvBarrageMessage

OnIMRecvBarrageMessage
public delegate void OnIMRecvBarrageMessage(string roomID,List<ZegoBarrageMessageInfo> messageList)
The callback triggered when Barrage Messages are received.
Declared in IZegoEventHandler.cs

Parameters

NameTypeDescription
roomIDstringRoom ID. Value range: The maximum length is 128 bytes.
messageListList<ZegoBarrageMessageInfo>List of received messages. Value range: Up to 50 messages can be received each time.

Details

This callback is used to receive barrage messages sent by other users in the same room.

  • 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 trigger: After calling [loginRoom] to log in to the room, if a user in the room sends a barrage message through the [sendBarrageMessage] function, this callback will be triggered.
  • Caution: Barrage messages sent by users themselves will not be notified through this callback. When there are a large number of barrage messages in the room, the notification may be delayed, and some barrage messages may be lost.
  • Related callbacks: Develop can receive room broadcast messages through [onIMRecvBroadcastMessage], and can receive room custom signaling through [onIMRecvCustomCommand].
  • Available since: 1.5.0
  • Restrictions: Not available for WebGL.

OnIMRecvCustomCommand

OnIMRecvCustomCommand
public delegate void OnIMRecvCustomCommand(string roomID,ZegoUser fromUser,string command)
The callback triggered when a Custom Command is received.
Declared in IZegoEventHandler.cs

Parameters

NameTypeDescription
roomIDstringRoom ID. Value range: The maximum length is 128 bytes.
fromUserZegoUserSender of the command.
commandstringCommand content received.Value range: The maximum length is 1024 bytes.

Details

This callback is used to receive custom command sent by other users in the same room.

  • Use cases: Generally used in the live room. When to trigger: After calling [loginRoom] to log in to the room, if other users in the room send custom signaling to the developer through the [sendCustomCommand] function, this callback will be triggered.
  • Caution: The custom command sent by the user himself will not be notified through this callback.
  • Related callbacks: You can receive room broadcast messages through [onIMRecvBroadcastMessage], and you can receive room barrage message through [onIMRecvBarrageMessage].
  • Available since: 1.2.1
  • Restrictions: None

OnCapturedDataRecordStateUpdate

OnCapturedDataRecordStateUpdate
public delegate void OnCapturedDataRecordStateUpdate(ZegoDataRecordState state,int errorCode,ZegoDataRecordConfig config,ZegoPublishChannel channel)
The callback triggered when the state of data recording (to a file) changes.
Declared in IZegoEventHandler.cs

Parameters

NameTypeDescription
stateZegoDataRecordStateFile recording status.
errorCodeintError code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details.
configZegoDataRecordConfigRecord config.
channelZegoPublishChannelPublishing stream channel.

Details

The callback triggered when the state of data recording (to a file) changes.

  • Use cases: The developer should use this callback to determine the status of the file recording or for UI prompting. When to trigger: After [startRecordingCapturedData] is called, if the state of the recording process changes, this callback will be triggered.
  • Available since: 1.10.0
  • Restrictions: None.

OnCapturedDataRecordProgressUpdate

OnCapturedDataRecordProgressUpdate
public delegate void OnCapturedDataRecordProgressUpdate(ZegoDataRecordProgress progress,ZegoDataRecordConfig config,ZegoPublishChannel channel)
The callback to report the current recording progress.
Declared in IZegoEventHandler.cs

Parameters

NameTypeDescription
progressZegoDataRecordProgressFile recording progress, which allows developers to hint at the UI, etc.
configZegoDataRecordConfigRecord config.
channelZegoPublishChannelPublishing stream channel.

Details

Recording progress update callback, triggered at regular intervals during recording.

  • Use cases: Developers can do UI hints for the user interface. When to trigger: After [startRecordingCapturedData] is called, If configured to require a callback, timed trigger during recording.
  • Available since: 1.10.0
  • Restrictions: None.

OnCustomVideoCaptureStart

OnCustomVideoCaptureStart
public delegate void OnCustomVideoCaptureStart(ZegoPublishChannel channel)
Customize the notification of the start of video capture.
Declared in IZegoEventHandler.cs

Parameters

NameTypeDescription
channelZegoPublishChannelPublishing stream channel.

Details

The SDK informs that the video frame is about to be collected, and the video frame data sent to the SDK is valid after receiving the callback.

  • Use cases: Live data collected by non-cameras. For example, local video file playback, screen sharing, game live broadcast, etc. When to
  • Trigger: After calling [startPreview] or [startPublishingStream] successfully.
  • Caution: The video frame data sent to the SDK after receiving the callback is valid.
  • Related callbacks: Customize the end of capture notification [onCaptureStop].
  • Related APIs: Call [setCustomVideoCaptureHandler] to set custom video capture callback.
  • Available since: 1.1.0

OnCustomVideoCaptureStop

OnCustomVideoCaptureStop
public delegate void OnCustomVideoCaptureStop(ZegoPublishChannel channel)
Customize the notification of the end of the collection.
Declared in IZegoEventHandler.cs

Parameters

NameTypeDescription
channelZegoPublishChannelPublishing stream channel.

Details

The SDK informs that it is about to end the video frame capture.

  • Use cases: Live data collected by non-cameras. For example, local video file playback, screen sharing, game live broadcast, etc. When to
  • Trigger: After calling [stopPreview] or [stopPublishingStream] successfully.
  • Caution: If you call [startPreview] and [startPublishingStream] to start preview and push stream at the same time after you start custom capture, you should call [stopPreview] and [stopPublishingStream] to stop the preview and push stream before triggering the callback.
  • Related callbacks: Custom video capture start notification [onCaptureStart].
  • Related APIs: Call [setCustomVideoCaptureHandler] to set custom video capture callback.
  • Available since: 1.1.0

OnCapturedVideoFrameRawData

OnCapturedVideoFrameRawData
public delegate void OnCapturedVideoFrameRawData(ref IntPtr data,ref uint dataLength,ZegoVideoFrameParam param,ZegoVideoFlipMode flipMode,ZegoPublishChannel channel)
When custom video rendering is enabled, the original video frame data collected by the local preview is called back.
Declared in IZegoEventHandler.cs

Parameters

NameTypeDescription
dataref IntPtrRaw video frame data (eg: RGBA only needs to consider data[0], I420 needs to consider data[0,1,2]).
dataLengthref uintData length (eg: RGBA only needs to consider dataLength[0], I420 needs to consider dataLength[0,1,2]).
paramZegoVideoFrameParamVideo frame parameters.
flipModeZegoVideoFlipModevideo flip mode.
channelZegoPublishChannelPublishing stream channel.

Details

When using custom video rendering, the SDK callbacks the original video frame data collected by the local preview, which is rendered by the developer.

  • Use cases: Use a cross-platform interface framework or game engine; need to obtain the video frame data collected or streamed by the SDK for special processing. When to
  • Trigger: When the local preview is turned on, when the SDK collects the local preview video frame data.
  • Related APIs: Call [setCustomVideoRenderHandler] to set custom video rendering callback.
  • Available since: 1.1.0

OnRemoteVideoFrameRawData

OnRemoteVideoFrameRawData
public delegate void OnRemoteVideoFrameRawData(ref IntPtr data,ref uint dataLength,ZegoVideoFrameParam param,string streamID)
When custom video rendering is enabled, the remote end pulls the original video frame data to call back, and distinguishes different streams by streamID.
Declared in IZegoEventHandler.cs

Parameters

NameTypeDescription
dataref IntPtrRaw video frame data (eg: RGBA only needs to consider data[0], I420 needs to consider data[0,1,2]).
dataLengthref uintData length (eg: RGBA only needs to consider dataLength[0], I420 needs to consider dataLength[0,1,2]).
paramZegoVideoFrameParamVideo frame parameters.
streamIDstringStream ID.

Details

When custom video rendering is enabled, the SDK calls back the remote end to pull the original video frame data, distinguishes different streams by streamID, and renders them by the developer.

  • Use cases: Use a cross-platform interface framework or game engine; need to obtain the video frame data collected or streamed by the SDK for special processing. When to
  • Trigger: After starting to stream, when the SDK receives the video frame data of the remote stream.
  • Related APIs: Call [setCustomVideoRenderHandler] to set custom video rendering callback.
  • Available since: 1.1.0

OnCapturedAudioData

OnCapturedAudioData
public delegate void OnCapturedAudioData(IntPtr data,uint dataLength,ZegoAudioFrameParam param)
The callback for obtaining the audio data captured by the local microphone.
Declared in IZegoEventHandler.cs

Parameters

NameTypeDescription
dataIntPtrAudio data in PCM format.
dataLengthuintLength of the data.
paramZegoAudioFrameParamParameters of the audio frame.

Details

In non-custom audio capture mode, the SDK capture the microphone's sound, but the developer may also need to get a copy of the audio data captured by the SDK is available through this callback. When to trigger: On the premise of calling [setAudioDataHandler] to set the listener callback, after calling [startAudioDataObserver] to set the mask 0b01 that means 1 << 0, this callback will be triggered only when it is in the publishing stream state.

  • Caution: This callback is a high-frequency callback, please do not perform time-consuming operations in this callback.
  • Restrictions: Not available for WebGL.

OnPlaybackAudioData

OnPlaybackAudioData
public delegate void OnPlaybackAudioData(IntPtr data,uint dataLength,ZegoAudioFrameParam param)
The callback for obtaining the audio data of all the streams playback by SDK.
Declared in IZegoEventHandler.cs

Parameters

NameTypeDescription
dataIntPtrAudio data in PCM format.
dataLengthuintLength of the data.
paramZegoAudioFrameParamParameters of the audio frame.

Details

This function will callback all the mixed audio data to be playback. This callback can be used for that you needs to fetch all the mixed audio data to be playback to proccess. When to trigger: On the premise of calling [setAudioDataHandler] to set the listener callback, after calling [startAudioDataObserver] to set the mask 0b10 that means 1 << 1, this callback will be triggered only when it is in the SDK inner audio and video engine started(called the [startPreview] or [startPlayingStream] or [startPublishingStream]).

  • Caution: This callback is a high-frequency callback. Please do not perform time-consuming operations in this callback. When the engine is not in the stream publishing state and the media player is not used to play media files, the audio data in the callback is muted audio data.
  • Restrictions: When playing copyrighted music, this callback will be disabled by default. If necessary, please contact ZEGO technical support.Not available for WebGL.

OnMixedAudioData

OnMixedAudioData
public delegate void OnMixedAudioData(IntPtr data,uint dataLength,ZegoAudioFrameParam param)
Callback to get the audio data played by the SDK and the audio data captured by the local microphone. The audio data is the data mixed by the SDK.
Declared in IZegoEventHandler.cs

Parameters

NameTypeDescription
dataIntPtrAudio data in PCM format.
dataLengthuintLength of the data.
paramZegoAudioFrameParamParameters of the audio frame.

Details

The audio data played by the SDK is mixed with the data captured by the local microphone before being sent to the speaker, and is called back through this function. When to trigger: On the premise of calling [setAudioDataHandler] to set the listener callback, after calling [startAudioDataObserver] to set the mask 0x04, this callback will be triggered only when it is in the publishing stream state or playing stream state.

  • Caution: This callback is a high-frequency callback, please do not perform time-consuming operations in this callback.
  • Restrictions: When playing copyrighted music, this callback will be disabled by default. If necessary, please contact ZEGO technical support.Not available for WebGL.

OnPlayerAudioData

OnPlayerAudioData
public delegate void OnPlayerAudioData(IntPtr data,uint dataLength,ZegoAudioFrameParam param,string streamID)
The callback for obtaining the audio data of each stream.
Declared in IZegoEventHandler.cs

Parameters

NameTypeDescription
dataIntPtrAudio data in PCM format.
dataLengthuintLength of the data.
paramZegoAudioFrameParamParameters of the audio frame.
streamIDstringCorresponding stream ID.

Details

This function will call back the data corresponding to each playing stream. Different from [onPlaybackAudioData], the latter is the mixed data of all playing streams. If developers need to process a piece of data separately, they can use this callback. When to trigger: On the premise of calling [setAudioDataHandler] to set up listening for this callback, calling [startAudioDataObserver] to set the mask 0x08 that is 1 << 3, and this callback will be triggered when the SDK audio and video engine starts to play the stream.

  • Caution: This callback is a high-frequency callback, please do not perform time-consuming operations in this callback.
  • Restrictions: Not available for WebGL.

ZegoCopyrightedMusic

Declared in ZegoCopyrightedMusic.cs

Methods

InitCopyrightedMusic

InitCopyrightedMusic
public abstract void InitCopyrightedMusic(ZegoCopyrightedMusicConfig config,OnCopyrightedMusicInit callback)
Initialize the copyrighted music module.
Declared in ZegoCopyrightedMusic.cs

Parameters

NameTypeDescription
configZegoCopyrightedMusicConfigthe copyrighted music configuration.
callbackOnCopyrightedMusicInitinit 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
public abstract ulong GetCacheSize()
Get cache size.
Declared in ZegoCopyrightedMusic.cs

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
  • Restrictions: Not available for WebGL.

cache file size, in byte.

ClearCache

ClearCache
public abstract void ClearCache()
Clear cache.
Declared in ZegoCopyrightedMusic.cs

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

SendExtendedRequest
public abstract void SendExtendedRequest(string command,string param,OnCopyrightedMusicSendExtendedRequest callback)
Send extended feature request.
Declared in ZegoCopyrightedMusic.cs

Parameters

NameTypeDescription
commandstringrequest command, details about the commands supported.
paramstringrequest parameters, each request command has corresponding request parameters.
callbackOnCopyrightedMusicSendExtendedRequestsend 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

GetLrcLyric
public abstract void GetLrcLyric(string songID,ZegoCopyrightedMusicVendorID vendorID,OnCopyrightedMusicGetLrcLyric callback)
Get lyrics in lrc format.
Declared in ZegoCopyrightedMusic.cs

Parameters

NameTypeDescription
songIDstringthe ID of the song or accompaniment, the song and accompaniment of a song share the same ID.
vendorIDZegoCopyrightedMusicVendorIDCopyright music resource song copyright provider.
callbackOnCopyrightedMusicGetLrcLyricget 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

GetKrcLyricByToken

GetKrcLyricByToken
public abstract void GetKrcLyricByToken(string krcToken,OnCopyrightedMusicGetKrcLyricByToken callback)
Get lyrics in krc format.
Declared in ZegoCopyrightedMusic.cs

Parameters

NameTypeDescription
krcTokenstringThe 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
callbackOnCopyrightedMusicGetKrcLyricByTokenget 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

Download

Download
public abstract void Download(string resourceID,OnCopyrightedMusicDownload callback)
Download music resource.
Declared in ZegoCopyrightedMusic.cs

Parameters

NameTypeDescription
resourceIDstringthe resource ID corresponding to the song or accompaniment.
callbackOnCopyrightedMusicDownloaddownload 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

GetDuration

GetDuration
public abstract ulong GetDuration(string resourceID)
Get the playing time of a song or accompaniment file.
Declared in ZegoCopyrightedMusic.cs

Parameters

NameTypeDescription
resourceIDstringthe 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

RequestSong

RequestSong
deprecated
public abstract void RequestSong(ZegoCopyrightedMusicRequestConfig config,OnCopyrightedMusicRequestSong callback)
[Deprecated] Request a song. Deprecated since 3.0.2, please use the [requestResource] function instead.
Declared in ZegoCopyrightedMusic.cs

Parameters

NameTypeDescription
configZegoCopyrightedMusicRequestConfigrequest configuration.
callbackOnCopyrightedMusicRequestSongrequest 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

RequestAccompaniment
deprecated
public abstract void RequestAccompaniment(ZegoCopyrightedMusicRequestConfig config,OnCopyrightedMusicRequestAccompaniment callback)
[Deprecated] Request accompaniment. Deprecated since 3.0.2, please use the [requestResource] function instead.
Declared in ZegoCopyrightedMusic.cs

Parameters

NameTypeDescription
configZegoCopyrightedMusicRequestConfigrequest configuration.
callbackOnCopyrightedMusicRequestAccompanimentrequest 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.

GetMusicByToken

GetMusicByToken
deprecated
public abstract void GetMusicByToken(string shareToken,OnCopyrightedMusicGetMusicByToken callback)
[Deprecated] Get a song or accompaniment. Deprecated since 3.0.2, please use the [getSharedResource] function instead.
Declared in ZegoCopyrightedMusic.cs

Parameters

NameTypeDescription
shareTokenstringaccess the corresponding authorization token for a song or accompaniment.
callbackOnCopyrightedMusicGetMusicByTokenget 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

GetLrcLyric
deprecated
public abstract void GetLrcLyric(string songID,OnCopyrightedMusicGetLrcLyric 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 ZegoCopyrightedMusic.cs

Parameters

NameTypeDescription
songIDstringthe ID of the song or accompaniment, the song and accompaniment of a song share the same ID.
callbackOnCopyrightedMusicGetLrcLyricget 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.

ZegoExpressEngine

Declared in ZegoExpressEngine.cs

Methods

CreateEngine

static
CreateEngine
public static ZegoExpressEngine CreateEngine(ZegoEngineProfile profile,SynchronizationContext uiThreadContext)
Create ZegoExpressEngine singleton object and initialize SDK.
Declared in ZegoExpressEngine.cs

Parameters

NameTypeDescription
profileZegoEngineProfileThe basic configuration information is used to create the engine.
uiThreadContextSynchronizationContext

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
public static void DestroyEngine(IZegoDestroyCompletionCallback onDestroyCompletion)
Destroy the ZegoExpressEngine singleton object and deinitialize the SDK.
Declared in ZegoExpressEngine.cs

Parameters

NameTypeDescription
onDestroyCompletionIZegoDestroyCompletionCallbackNotification 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 [null].

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.

GetEngine

static
GetEngine
public static ZegoExpressEngine GetEngine()
Returns the singleton instance of ZegoExpressEngine.
Declared in ZegoExpressEngine.cs

If the engine has not been created or has been destroyed, returns [null].

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

Engine singleton instance

SetEngineConfig

static
SetEngineConfig
public static void SetEngineConfig(ZegoEngineConfig config)
Set advanced engine configuration.
Declared in ZegoExpressEngine.cs

Parameters

NameTypeDescription
configZegoEngineConfigAdvanced 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
public static void SetLogConfig(ZegoLogConfig config)
Set log configuration.
Declared in ZegoExpressEngine.cs

Parameters

NameTypeDescription
configZegoLogConfiglog 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: Not available for WebGL.

SetRoomMode

static
SetRoomMode
public static void SetRoomMode(ZegoRoomMode mode)
Set room mode.
Declared in ZegoExpressEngine.cs

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.Not available for WebGL.

GetVersion

static
GetVersion
public static string GetVersion()
Gets the SDK's version number.
Declared in ZegoExpressEngine.cs

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.

SubmitLog

static
SubmitLog
public static void SubmitLog()
Uploads logs to the ZEGO server.
Declared in ZegoExpressEngine.cs

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.

CreateEngine

static
CreateEngine
deprecated
public static ZegoExpressEngine CreateEngine(uint appID,string appSign,bool isTestEnv,ZegoScenario scenario)
[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.cs

Parameters

NameTypeDescription
appIDuintApplication ID issued by ZEGO for developers, please apply from the ZEGO Admin Console https://console.zegocloud.com The value ranges from 0 to 4294967295.
appSignstringApplication 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

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.

UploadLog

UploadLog
public abstract void UploadLog()
Uploads logs to the ZEGO server.
Declared in ZegoExpressEngine.cs

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: 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.
  • Available since: 1.1.0
  • Restrictions: If you call this interface repeatedly within 10 minutes, only the last call will take effect.Not available for WebGL.

EnableDebugAssistant

EnableDebugAssistant
public abstract 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.cs

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.Not available for WebGL.
  • 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.

LoginRoom

LoginRoom
public abstract void LoginRoom(string roomID,ZegoUser user,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.cs

Parameters

NameTypeDescription
roomIDstringRoom 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 '%'.
userZegoUserUser 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.
configZegoRoomConfigAdvanced 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.

LogoutRoom

LogoutRoom
public abstract void LogoutRoom()
Exit the room.
Declared in ZegoExpressEngine.cs

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
public abstract void LogoutRoom(string roomID)
Exit the room of the specified room ID.
Declared in ZegoExpressEngine.cs

Parameters

NameTypeDescription
roomIDstringRoom 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.

SwitchRoom

SwitchRoom
public abstract void SwitchRoom(string fromRoomID,string toRoomID,ZegoRoomConfig config)
Switch the room with advanced room configurations.
Declared in ZegoExpressEngine.cs

Parameters

NameTypeDescription
fromRoomIDstringCurrent roomID.
toRoomIDstringThe next roomID.
configZegoRoomConfigAdvanced 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.

SetRoomExtraInfo

SetRoomExtraInfo
public abstract void SetRoomExtraInfo(string roomID,OnRoomSetRoomExtraInfoResult onRoomSetRoomExtraInfoResult,string key,string value)
Set room extra information.
Declared in ZegoExpressEngine.cs

Parameters

NameTypeDescription
roomIDstringRoom ID.
onRoomSetRoomExtraInfoResultOnRoomSetRoomExtraInfoResultCallback for setting room extra information.
keystringkey of the extra info.
valuestringvalue if the extra info.

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.

StartPublishingStream

StartPublishingStream
public abstract void StartPublishingStream(string streamID,ZegoPublishChannel channel)
Starts publishing a stream (for the specified channel). You can call this function to publish a second stream.
Declared in ZegoExpressEngine.cs

Parameters

NameTypeDescription
streamIDstringStream 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

StartPublishingStream
public abstract void StartPublishingStream(string streamID,ZegoPublisherConfig config,ZegoPublishChannel channel)
Starts publishing a stream. Support multi-room mode.
Declared in ZegoExpressEngine.cs

Parameters

NameTypeDescription
streamIDstringStream 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 '-', '_'.
configZegoPublisherConfigAdvanced 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.

StopPublishingStream

StopPublishingStream
public abstract void StopPublishingStream(ZegoPublishChannel channel)
Stops publishing a stream (for the specified channel).
Declared in ZegoExpressEngine.cs

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

SetStreamExtraInfo
public abstract void SetStreamExtraInfo(string extraInfo,OnPublisherSetStreamExtraInfoResult onPublisherSetStreamExtraInfoResult,ZegoPublishChannel channel)
Sets the extra information of the stream being published for the specified publish channel.
Declared in ZegoExpressEngine.cs

Parameters

NameTypeDescription
extraInfostringStream extra information, a string of up to 1024 characters.
onPublisherSetStreamExtraInfoResultOnPublisherSetStreamExtraInfoResultSet stream extra information execution result notification.
channelZegoPublishChannelPublish stream channel.

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
public abstract void StartPreview(ZegoCanvas canvas,ZegoPublishChannel channel)
Starts/Updates the local video preview (for the specified channel).
Declared in ZegoExpressEngine.cs

Parameters

NameTypeDescription
canvasZegoCanvasThe view used to display the preview image. If the view is set to null, 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.

StopPreview

StopPreview
public abstract void StopPreview(ZegoPublishChannel channel)
Stops the local preview (for the specified channel).
Declared in ZegoExpressEngine.cs

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
public abstract void SetVideoConfig(ZegoVideoConfig config,ZegoPublishChannel channel)
Sets up the video configurations (for the specified channel).
Declared in ZegoExpressEngine.cs

Parameters

NameTypeDescription
configZegoVideoConfigVideo 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
public abstract ZegoVideoConfig GetVideoConfig(ZegoPublishChannel channel)
Gets the current video configurations (for the specified channel).
Declared in ZegoExpressEngine.cs

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

SetVideoMirrorMode

SetVideoMirrorMode
public abstract void SetVideoMirrorMode(ZegoVideoMirrorMode mirrorMode,ZegoPublishChannel channel)
Sets the video mirroring mode (for the specified channel).
Declared in ZegoExpressEngine.cs

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.Not available for WebGL.

SetAppOrientation

SetAppOrientation
public abstract void SetAppOrientation(ZegoOrientation orientation,ZegoPublishChannel channel)
Sets the video orientation (for the specified channel).
Declared in ZegoExpressEngine.cs

Parameters

NameTypeDescription
orientationZegoOrientationVideo 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: Not available for WebGL.

SetAudioConfig

SetAudioConfig
public abstract void SetAudioConfig(ZegoAudioConfig config,ZegoPublishChannel channel)
Sets up the audio configurations for the specified publish channel.
Declared in ZegoExpressEngine.cs

Parameters

NameTypeDescription
configZegoAudioConfigAudio 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
public abstract ZegoAudioConfig GetAudioConfig()
Gets the current audio configurations.
Declared in ZegoExpressEngine.cs

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.

MutePublishStreamAudio

MutePublishStreamAudio
public abstract void MutePublishStreamAudio(bool mute,ZegoPublishChannel channel)
Stops or resumes sending the audio part of a stream for the specified channel.
Declared in ZegoExpressEngine.cs

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
public abstract void MutePublishStreamVideo(bool mute,ZegoPublishChannel channel)
Stops or resumes sending the video part of a stream for the specified channel.
Declared in ZegoExpressEngine.cs

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.

EnableTrafficControl

EnableTrafficControl
public abstract void EnableTrafficControl(bool enable,int property)
Enables or disables traffic control.
Declared in ZegoExpressEngine.cs

Parameters

NameTypeDescription
enableboolWhether to enable traffic control. The default is ture.
propertyintAdjustable 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.

SetMinVideoBitrateForTrafficControl

SetMinVideoBitrateForTrafficControl
public abstract void SetMinVideoBitrateForTrafficControl(int bitrate,ZegoTrafficControlMinVideoBitrateMode mode)
Set the minimum video bitrate threshold for traffic control.
Declared in ZegoExpressEngine.cs

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].

SetCaptureVolume

SetCaptureVolume
public abstract void SetCaptureVolume(int volume)
Sets the audio recording volume for stream publishing.
Declared in ZegoExpressEngine.cs

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
public abstract void SetAudioCaptureStereoMode(ZegoAudioCaptureStereoMode mode)
Set audio capture stereo mode.
Declared in ZegoExpressEngine.cs

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

AddPublishCdnUrl
public abstract void AddPublishCdnUrl(string streamID,OnPublisherUpdateCdnUrlResult onPublisherUpdateCdnUrlResult,string targetURL)
Adds a target CDN URL to which the stream will be relayed from ZEGO RTC server.
Declared in ZegoExpressEngine.cs

Parameters

NameTypeDescription
streamIDstringStream ID.
onPublisherUpdateCdnUrlResultOnPublisherUpdateCdnUrlResultThe execution result of update the relay CDN operation.
targetURLstringCDN relay address, supported address format is rtmp, rtmps.

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

RemovePublishCdnUrl
public abstract void RemovePublishCdnUrl(string streamID,OnPublisherUpdateCdnUrlResult onPublisherUpdateCdnUrlResult,string targetURL)
Deletes the specified CDN URL, which is used for relaying streams from ZEGO RTC server to CDN.
Declared in ZegoExpressEngine.cs

Parameters

NameTypeDescription
streamIDstringStream ID.
onPublisherUpdateCdnUrlResultOnPublisherUpdateCdnUrlResultThe execution result of update the relay CDN operation.
targetURLstringCDN relay address, supported address format rtmp.

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

EnablePublishDirectToCDN
public abstract void EnablePublishDirectToCDN(bool enable,ZegoCDNConfig config,ZegoPublishChannel channel)
Whether to directly push to CDN (without going through the ZEGO RTC server), for the specified channel.
Declared in ZegoExpressEngine.cs

Parameters

NameTypeDescription
enableboolWhether to enable direct publish CDN, true: enable direct publish CDN, false: disable direct publish CDN.
configZegoCDNConfigCDN configuration, if null, 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
  • Restrictions: Not available for WebGL.

SendSEI

SendSEI
public abstract void SendSEI(byte[] data,ZegoPublishChannel channel)
Sends Supplemental Enhancement Information to the specified publish channel.
Declared in ZegoExpressEngine.cs

Parameters

NameTypeDescription
databyte[]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.Not available for WebGL.

EnableHardwareEncoder

EnableHardwareEncoder
public abstract void EnableHardwareEncoder(bool enable)
Enables or disables hardware encoding.
Declared in ZegoExpressEngine.cs

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
public abstract 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.cs

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

StartPlayingStream

StartPlayingStream
public abstract void StartPlayingStream(string streamID,ZegoCanvas canvas,ZegoPlayerConfig config)
Starts playing a stream from ZEGO RTC server or from third-party CDN. Support multi-room mode.
Declared in ZegoExpressEngine.cs

Parameters

NameTypeDescription
streamIDstringStream ID, a string of up to 256 characters.
Caution:
Only support numbers, English characters and '-', '_'.
canvasZegoCanvasThe view used to display the play audio and video stream's image. When the view is set to [null], no video is displayed, only audio is played.
configZegoPlayerConfigAdvanced 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.

StopPlayingStream

StopPlayingStream
public abstract void StopPlayingStream(string streamID)
Stops playing a stream.
Declared in ZegoExpressEngine.cs

Parameters

NameTypeDescription
streamIDstringStream 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.

SetPlayVolume

SetPlayVolume
public abstract void SetPlayVolume(string streamID,int volume)
Sets the stream playback volume.
Declared in ZegoExpressEngine.cs

Parameters

NameTypeDescription
streamIDstringStream ID.
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: [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.

MutePlayStreamAudio

MutePlayStreamAudio
public abstract void MutePlayStreamAudio(string streamID,bool mute)
Whether the pull stream can receive the specified audio data.
Declared in ZegoExpressEngine.cs

Parameters

NameTypeDescription
streamIDstringStream ID.
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".

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

MutePlayStreamVideo
public abstract void MutePlayStreamVideo(string streamID,bool mute)
Whether the pull stream can receive the specified video data.
Declared in ZegoExpressEngine.cs

Parameters

NameTypeDescription
streamIDstringStream ID.
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.

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

EnableHardwareDecoder

EnableHardwareDecoder
public abstract void EnableHardwareDecoder(bool enable)
Enables or disables hardware decoding.
Declared in ZegoExpressEngine.cs

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
public abstract void EnableCheckPoc(bool enable)
Enables or disables frame order detection.
Declared in ZegoExpressEngine.cs

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.

StartMixerTask

StartMixerTask
public abstract void StartMixerTask(ZegoMixerTask task,OnMixerStartResult onMixerStartResult)
Starts a stream mixing task.
Declared in ZegoExpressEngine.cs

Parameters

NameTypeDescription
taskZegoMixerTaskMixing task object. Required: Yes.
onMixerStartResultOnMixerStartResultStart notification of mixing task results.Required: No. Caution: Passing [null] 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: Not available for WebGL.

StopMixerTask

StopMixerTask
public abstract void StopMixerTask(ZegoMixerTask task,OnMixerStopResult onMixerStopResult)
Stops a stream mixing task.
Declared in ZegoExpressEngine.cs

Parameters

NameTypeDescription
taskZegoMixerTaskMixing task object. Required: Yes.
onMixerStopResultOnMixerStopResultStop stream mixing task result callback notification.Required: No. Caution: Passing [null] 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: Not available for WebGL.

MuteMicrophone

MuteMicrophone
public abstract void MuteMicrophone(bool mute)
Mutes or unmutes the microphone.
Declared in ZegoExpressEngine.cs

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
public abstract bool IsMicrophoneMuted()
Checks whether the microphone is muted.
Declared in ZegoExpressEngine.cs

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
public abstract void MuteSpeaker(bool mute)
Mutes or unmutes the audio output speaker.
Declared in ZegoExpressEngine.cs

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
public abstract bool IsSpeakerMuted()
Checks whether the audio output speaker is muted.
Declared in ZegoExpressEngine.cs

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
public abstract ZegoDeviceInfo[] GetAudioDeviceList(ZegoAudioDeviceType deviceType)
Gets a list of audio devices.
Declared in ZegoExpressEngine.cs

Parameters

NameTypeDescription
deviceTypeZegoAudioDeviceTypeAudio device type

Details

Only for Windows / macOS / Linux

Return

Audo device List

UseAudioDevice

UseAudioDevice
public abstract void UseAudioDevice(ZegoAudioDeviceType deviceType,string deviceID)
Chooses to use the specified audio device.
Declared in ZegoExpressEngine.cs

Parameters

NameTypeDescription
deviceTypeZegoAudioDeviceTypeAudio device type
deviceIDstringID of a device obtained by [getAudioDeviceList]

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

EnableAudioCaptureDevice

EnableAudioCaptureDevice
public abstract void EnableAudioCaptureDevice(bool enable)
Enables or disables the audio capture device.
Declared in ZegoExpressEngine.cs

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.

EnableCamera

EnableCamera
public abstract void EnableCamera(bool enable,ZegoPublishChannel channel)
Turns on/off the camera (for the specified channel).
Declared in ZegoExpressEngine.cs

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.

UseFrontCamera

UseFrontCamera
public abstract void UseFrontCamera(bool enable,ZegoPublishChannel channel)
Switches to the front or the rear camera (for the specified channel).
Declared in ZegoExpressEngine.cs

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 is used to control the use of 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: Not available for WebGL.

UseVideoDevice

UseVideoDevice
public abstract void UseVideoDevice(string deviceID,ZegoPublishChannel channel)
Chooses to use the specified video device (for the specified channel).
Declared in ZegoExpressEngine.cs

Parameters

NameTypeDescription
deviceIDstringID of a device obtained by [getVideoDeviceList]
channelZegoPublishChannelPublishing stream channel

Details

Only for Windows / macOS / Linux / WebGL

GetVideoDeviceList

GetVideoDeviceList
public abstract ZegoDeviceInfo[] GetVideoDeviceList()
Gets a list of video devices.
Declared in ZegoExpressEngine.cs

Only for Windows / macOS / Linux

Video device List

StartSoundLevelMonitor

StartSoundLevelMonitor
public abstract void StartSoundLevelMonitor(uint millisecond)
Starts sound level monitoring. Support setting the listening interval.
Declared in ZegoExpressEngine.cs

Parameters

NameTypeDescription
milliseconduintMonitoring 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
  • Restrictions: Not available for WebGL.

StartSoundLevelMonitor

StartSoundLevelMonitor
public abstract void StartSoundLevelMonitor(ZegoSoundLevelConfig config)
Starts sound level monitoring. Support enable some advanced feature.
Declared in ZegoExpressEngine.cs

Parameters

NameTypeDescription
configZegoSoundLevelConfigConfiguration 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
public abstract void StopSoundLevelMonitor()
Stops sound level monitoring.
Declared in ZegoExpressEngine.cs

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
public abstract void StartAudioSpectrumMonitor(uint millisecond)
Starts audio spectrum monitoring. Support setting the listening interval.
Declared in ZegoExpressEngine.cs

Parameters

NameTypeDescription
milliseconduintMonitoring 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
  • Restrictions: Not available for WebGL.

StopAudioSpectrumMonitor

StopAudioSpectrumMonitor
public abstract void StopAudioSpectrumMonitor()
Stops audio spectrum monitoring.
Declared in ZegoExpressEngine.cs

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
public abstract void EnableHeadphoneMonitor(bool enable)
Enables or disables headphone monitoring.
Declared in ZegoExpressEngine.cs

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
public abstract void SetHeadphoneMonitorVolume(int volume)
Sets the headphone monitor volume.
Declared in ZegoExpressEngine.cs

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

EnableAEC

EnableAEC
public abstract void EnableAEC(bool enable)
Whether to enable acoustic echo cancellation (AEC).
Declared in ZegoExpressEngine.cs

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.

SetAECMode

SetAECMode
public abstract void SetAECMode(ZegoAECMode mode)
Sets the acoustic echo cancellation (AEC) mode.
Declared in ZegoExpressEngine.cs

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
public abstract void EnableAGC(bool enable)
Enables or disables automatic gain control (AGC).
Declared in ZegoExpressEngine.cs

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
public abstract void EnableANS(bool enable)
Enables or disables active noise suppression (ANS, aka ANC).
Declared in ZegoExpressEngine.cs

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
public abstract void EnableTransientANS(bool enable)
Enables or disables transient noise suppression.
Declared in ZegoExpressEngine.cs

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
public abstract void SetANSMode(ZegoANSMode mode)
Sets the automatic noise suppression (ANS) mode.
Declared in ZegoExpressEngine.cs

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.

SendBroadcastMessage

SendBroadcastMessage
public abstract void SendBroadcastMessage(string roomID,OnIMSendBroadcastMessageResult onIMSendBroadcastMessageResult,string message)
Sends a Broadcast Message.
Declared in ZegoExpressEngine.cs

Parameters

NameTypeDescription
roomIDstringRoom 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 '%'.
onIMSendBroadcastMessageResultOnIMSendBroadcastMessageResultSend a notification of the result of a broadcast message. Required: No. Caution: Passing [null] means not receiving callback notifications.
messagestringThe content of the message. Required: Yes. Value range: The length does not exceed 1024 bytes.

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 calling this interface from the client side is 2. For restrictions on the use of this function, please contact ZEGO technical support.Not available for WebGL.

SendBarrageMessage

SendBarrageMessage
public abstract void SendBarrageMessage(string roomID,OnIMSendBarrageMessageResult onIMSendBarrageMessageResult,string message)
Sends a Barrage Message (bullet screen) to all users in the same room, without guaranteeing the delivery.
Declared in ZegoExpressEngine.cs

Parameters

NameTypeDescription
roomIDstringRoom 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 '%'.
onIMSendBarrageMessageResultOnIMSendBarrageMessageResultSend barrage message result callback.Required: No. Caution: Passing [null] means not receiving callback notifications.
messagestringThe content of the message. Required: Yes. Value range: The length does not exceed 1024 bytes.

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.Not available for WebGL.

SendCustomCommand

SendCustomCommand
public abstract void SendCustomCommand(string roomID,string command,OnIMSendCustomCommandResult onIMSendCustomCommandResult,List<ZegoUser> toUserList)
Sends a Custom Command to the specified users in the same room.
Declared in ZegoExpressEngine.cs

Parameters

NameTypeDescription
roomIDstringRoom 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 '%'.
commandstringCustom 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.
onIMSendCustomCommandResultOnIMSendCustomCommandResultSend a notification of the signaling result. Required: No. Caution: Passing [null] means not receiving callback notifications.
toUserListList<ZegoUser>List of recipients of signaling. Required: Yes. Value range: user list or [null]. Caution: When it is [null], the SDK will send custom signaling back to all users in the room

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.Not available for WebGL.

CreateMediaPlayer

CreateMediaPlayer
public abstract ZegoMediaPlayer CreateMediaPlayer()
Creates a media player instance.
Declared in ZegoExpressEngine.cs

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 null.

Media player instance, null will be returned when the maximum number is exceeded.

DestroyMediaPlayer

DestroyMediaPlayer
public abstract void DestroyMediaPlayer(ZegoMediaPlayer mediaPlayer)
Destroys a media player instance.
Declared in ZegoExpressEngine.cs

Parameters

NameTypeDescription
mediaPlayerZegoMediaPlayerThe 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

StartRecordingCapturedData

StartRecordingCapturedData
public abstract void StartRecordingCapturedData(ZegoDataRecordConfig config,ZegoPublishChannel channel)
Starts to record and directly save the data to a file.
Declared in ZegoExpressEngine.cs

Parameters

NameTypeDescription
configZegoDataRecordConfigRecord 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: Not available for WebGL.

StopRecordingCapturedData

StopRecordingCapturedData
public abstract void StopRecordingCapturedData(ZegoPublishChannel channel)
Stops recording locally captured audio or video.
Declared in ZegoExpressEngine.cs

Parameters

NameTypeDescription
channelZegoPublishChannelPublishing stream channel.

Details

Stops recording locally captured audio or video.

  • When to call: After [startRecordingCapturedData].
  • Available since: 1.10.0
  • Restrictions: Not available for WebGL.

EnableCustomVideoRender

EnableCustomVideoRender
public abstract void EnableCustomVideoRender(bool enable,ZegoCustomVideoRenderConfig config)
Enables or disables custom video rendering.
Declared in ZegoExpressEngine.cs

Parameters

NameTypeDescription
enableboolenable or disable
configZegoCustomVideoRenderConfigcustom 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

EnableCustomVideoCapture

EnableCustomVideoCapture
public abstract void EnableCustomVideoCapture(bool enable,ZegoCustomVideoCaptureConfig config,ZegoPublishChannel channel)
Enables or disables custom video capture (for the specified channel).
Declared in ZegoExpressEngine.cs

Parameters

NameTypeDescription
enableboolenable or disable
configZegoCustomVideoCaptureConfigcustom 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
  • Restrictions: Not available for WebGL.

SendCustomVideoCaptureRawData

SendCustomVideoCaptureRawData
public abstract void SendCustomVideoCaptureRawData(byte[] data,uint dataLength,ZegoVideoFrameParam param,ulong referenceTimeMillisecond,ZegoPublishChannel channel)
Sends the video frames (Raw Data) produced by custom video capture to the SDK (for the specified channel).
Declared in ZegoExpressEngine.cs

Parameters

NameTypeDescription
databyte[]video frame data
dataLengthuintvideo frame data length
paramZegoVideoFrameParamvideo frame param
referenceTimeMillisecondulongvideo frame reference time, UNIX timestamp, in milliseconds.
channelZegoPublishChannelPublishing stream channel

Details

Sends customized raw video frame 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: This interface must be called with [enableCustomVideoCapture] passing the parameter type RAW_DATA.
  • Related APIs: [enableCustomVideoCapture], [setCustomVideoCaptureHandler].
  • Available since: 1.9.0
  • Restrictions: Not available for WebGL.

SendCustomVideoCaptureRawData

SendCustomVideoCaptureRawData
public abstract void SendCustomVideoCaptureRawData(IntPtr data,uint dataLength,ZegoVideoFrameParam param,ulong referenceTimeMillisecond,ZegoPublishChannel channel)
Sends the video frames (Raw Data) produced by custom video capture to the SDK (for the specified channel).
Declared in ZegoExpressEngine.cs

Parameters

NameTypeDescription
dataIntPtrvideo frame data
dataLengthuintvideo frame data length
paramZegoVideoFrameParamvideo frame param
referenceTimeMillisecondulongvideo frame reference time, UNIX timestamp, in milliseconds.
channelZegoPublishChannelPublishing stream channel

Details

Sends customized raw video frame 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: This interface must be called with [enableCustomVideoCapture] passing the parameter type RAW_DATA.
  • Related APIs: [enableCustomVideoCapture], [setCustomVideoCaptureHandler].
  • Available since: 1.9.0
  • Restrictions: Not available for WebGL.

EnableCustomVideoProcessing

EnableCustomVideoProcessing
public abstract void EnableCustomVideoProcessing(bool enable,ZegoCustomVideoProcessConfig config,ZegoPublishChannel channel)
Enables or disables custom video processing, and support specifying the publish channel.
Declared in ZegoExpressEngine.cs

Parameters

NameTypeDescription
enableboolenable or disable. Required: Yes.
configZegoCustomVideoProcessConfigcustom video processing configuration. Required: Yes.Caution: If null 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: Not available for WebGL.

StartAudioDataObserver

StartAudioDataObserver
public abstract void StartAudioDataObserver(uint observerBitMask,ZegoAudioFrameParam param)
Enable audio data observering.
Declared in ZegoExpressEngine.cs

Parameters

NameTypeDescription
observerBitMaskuintThe 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.
paramZegoAudioFrameParamparam 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
public abstract void StopAudioDataObserver()
Disable audio data observering.
Declared in ZegoExpressEngine.cs

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

EnableCustomAudioIO

EnableCustomAudioIO
public abstract void EnableCustomAudioIO(bool enable,ZegoCustomAudioConfig config,ZegoPublishChannel channel)
Enables the custom audio I/O function (for the specified channel), support PCM, AAC format data.
Declared in ZegoExpressEngine.cs

Parameters

NameTypeDescription
enableboolWhether to enable custom audio IO, default is false.
configZegoCustomAudioConfigCustom 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: Not available for WebGL.

SendCustomAudioCaptureAACData

SendCustomAudioCaptureAACData
public abstract void SendCustomAudioCaptureAACData(IntPtr data,uint dataLength,uint configLength,ulong referenceTimeMillisecond,uint samples,ZegoAudioFrameParam param,ZegoPublishChannel channel)
Sends AAC audio data produced by custom audio capture to the SDK (for the specified channel).
Declared in ZegoExpressEngine.cs

Parameters

NameTypeDescription
dataIntPtrAAC buffer data.
dataLengthuintThe total length of the buffer data.
configLengthuintThe length of AAC specific config (Note: The AAC encoded data length is 'encodedLength = dataLength - configLength').Value range: [0,64]
referenceTimeMillisecondulongThe UNIX timestamp of this AAC audio frame in millisecond.
samplesuintThe number of samples for this AAC audio frame.Value range: [480,512,1024,1960,2048].
paramZegoAudioFrameParamThe 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: Not available for WebGL.

SendCustomAudioCapturePCMData

SendCustomAudioCapturePCMData
public abstract void SendCustomAudioCapturePCMData(byte[] data,uint dataLength,ZegoAudioFrameParam param,ZegoPublishChannel channel)
Sends PCM audio data produced by custom audio capture to the SDK (for the specified channel).
Declared in ZegoExpressEngine.cs

Parameters

NameTypeDescription
databyte[]PCM buffer data.
dataLengthuintThe total length of the buffer data.
paramZegoAudioFrameParamThe 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

FetchCustomAudioRenderPCMData
public abstract void FetchCustomAudioRenderPCMData(ref byte[] data,uint dataLength,ZegoAudioFrameParam param)
Fetches PCM audio data of the remote stream from the SDK for custom audio rendering.
Declared in ZegoExpressEngine.cs

Parameters

NameTypeDescription
dataref byte[]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.
dataLengthuintThe length of the audio data to be fetch this time (dataLength = duration * sampleRate * channels * 2(16 bit depth i.e. 2 Btye)).
paramZegoAudioFrameParamSpecify 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.

CreateCopyrightedMusic

CreateCopyrightedMusic
public abstract ZegoCopyrightedMusic CreateCopyrightedMusic()
Creates a copyrighted music instance.
Declared in ZegoExpressEngine.cs

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
public abstract void DestroyCopyrightedMusic(ZegoCopyrightedMusic copyrightedMusic)
Destroys a copyrighted music instance.
Declared in ZegoExpressEngine.cs

Parameters

NameTypeDescription
copyrightedMusicZegoCopyrightedMusicThe 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

EnableBeautify

EnableBeautify
deprecated
public abstract void EnableBeautify(int featureBitmask,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.cs

Parameters

NameTypeDescription
featureBitmaskintBeauty 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
public abstract void SetBeautifyOption(ZegoBeautifyOption option,ZegoPublishChannel channel)
[Deprecated] Set beautify option. Deprecated since 2.16.0, please use the [setEffectsBeautyParam] function instead.
Declared in ZegoExpressEngine.cs

Parameters

NameTypeDescription
optionZegoBeautifyOptionBeautify 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.

Previous

Function Overview

Next

Interface

On this page

Back to top