Class
IZegoAudioEffectPlayerHandler
Declared in IZegoAudioEffectPlayerHandler.cs
Methods
OnAudioEffectPlayStateUpdate
public delegate void OnAudioEffectPlayStateUpdate(ZegoAudioEffectPlayer audioEffectPlayer,uint audioEffectID,ZegoAudioEffectPlayState state,int errorCode)IZegoAudioEffectPlayerHandler.csParameters
| Name | Type | Description |
|---|---|---|
| audioEffectPlayer | ZegoAudioEffectPlayer | Audio effect player instance that triggers this callback. |
| audioEffectID | uint | The ID of the audio effect resource that triggered this callback. |
| state | ZegoAudioEffectPlayState | The playback state of the audio effect. |
| errorCode | int | Error code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details. |
Details
This callback is triggered when the playback state of a audio effect of the audio effect player changes.
- Trigger: This callback is triggered when the playback status of the audio effect changes.
- Available since: 1.16.0
- Restrictions: None.
IZegoCopyrightedMusicHandler
Declared in IZegoCopyrightedMusicHandler.cs
Methods
OnDownloadProgressUpdate
public delegate void OnDownloadProgressUpdate(ZegoCopyrightedMusic copyrightedMusic,string resourceID,float progressRate)IZegoCopyrightedMusicHandler.cs| Name | Type | Description |
|---|---|---|
| copyrightedMusic | ZegoCopyrightedMusic | Copyrighted music instance that triggers this callback. |
| resourceID | string | The resource ID of the song or accompaniment that triggered this callback. |
| progressRate | float | download progress rate. |
OnCurrentPitchValueUpdate
public delegate void OnCurrentPitchValueUpdate(ZegoCopyrightedMusic copyrightedMusic,string resourceID,int currentDuration,int pitchValue)IZegoCopyrightedMusicHandler.cs| Name | Type | Description |
|---|---|---|
| copyrightedMusic | ZegoCopyrightedMusic | Copyrighted music instance that triggers this callback. |
| resourceID | string | The resource ID of the song or accompaniment that triggered this callback. |
| currentDuration | int | Current playback progress. |
| pitchValue | int | Real-time pitch accuracy or value. |
IZegoCustomVideoProcessHandler
Declared in IZegoCustomVideoProcessHandler.cs
Methods
OnCapturedUnprocessedRawData
public delegate void OnCapturedUnprocessedRawData(ref IntPtr data,ref uint dataLength,ZegoVideoFrameParam param,ulong referenceTimeMillisecond,ZegoPublishChannel channel)IZegoCustomVideoProcessHandler.csParameters
| Name | Type | Description |
|---|---|---|
| data | ref IntPtr | Raw video data. RGB format data storage location is data[0], YUV format data storage location is Y component:data[0], U component:data[1], V component:data[2]. |
| dataLength | ref uint | Raw video data length. RGB format data length storage location is dataLength[0], YUV format data storage location respectively Y component length:dataLength[0], U component length:dataLength[1], V component length:dataLength[2]. |
| param | ZegoVideoFrameParam | Video frame parameters. |
| referenceTimeMillisecond | ulong | video frame reference time, UNIX timestamp, or system startup timestamp, in milliseconds. |
| channel | ZegoPublishChannel | Publishing stream channel. |
Details
When the custom video pre-processing is turned on, after calling [setCustomVideoProcessHandler] to set the callback, the SDK receives the original video data and calls back to the developer. After the developer has processed the original image, he must call [sendCustomVideoProcessedRawData] to send the processed data back to the SDK, otherwise it will cause frame loss.
- Use cases: After the developer collects the video data by himself or obtains the video data collected by the SDK, if the basic beauty and watermark functions of the SDK cannot meet the needs of the developer (for example, the beauty effect cannot meet the expectations), the ZegoEffects SDK can be used to perform the video Some special processing, such as beautifying, adding pendants, etc., this process is the pre-processing of custom video. When to
- Trigger: When the custom video pre-processing is enabled, the SDK collects the original video data.
- Platform differences: Available for Window, Android platforms.
- Available since: 2.2.0
- Restrictions: This interface takes effect when [enableCustomVideoProcessing] is called to enable custom video pre-processing and the bufferType of config is passed in [ZegoVideoBufferTypeRawData].
OnCapturedUnprocessedCVPixelBuffer
public delegate void OnCapturedUnprocessedCVPixelBuffer(IntPtr buffer,ulong timestamp,ZegoPublishChannel channel)IZegoCustomVideoProcessHandler.csParameters
| Name | Type | Description |
|---|---|---|
| buffer | IntPtr | CVPixelBufferRef type data. |
| timestamp | ulong | video frame reference time, UNIX timestamp. |
| channel | ZegoPublishChannel | Publishing stream channel. |
Details
When the custom video pre-processing is turned on, after calling [setCustomVideoProcessHandler] to set the callback, the SDK receives the original video data and calls back to the developer. After the developer has processed the original image, he must call [sendCustomVideoProcessedCVPixelbuffer] to send the processed data back to the SDK, otherwise it will cause frame loss.
- Use cases: After the developer collects the video data by himself or obtains the video data collected by the SDK, if the basic beauty and watermark functions of the SDK cannot meet the needs of the developer (for example, the beauty effect cannot meet the expectations), the ZegoEffects SDK can be used to perform the video Some special processing, such as beautifying, adding pendants, etc., this process is the pre-processing of custom video. When to
- Trigger: When the custom video pre-processing is enabled, the SDK collects the original video data.
- Platform differences: It only takes effect on the iOS/macOS platform.
- Available since: 2.2.0
- Restrictions: This interface takes effect when [enableCustomVideoProcessing] is called to enable custom video pre-processing and the bufferType of config is passed in [ZegoVideoBufferTypeCVPixelBuffer] or [ZegoVideoBufferTypeNV12CVPixelBuffer].
OnCapturedUnprocessedTextureData
public delegate void OnCapturedUnprocessedTextureData(int textureID,int width,int height,ulong referenceTimeMillisecond,ZegoPublishChannel channel)IZegoCustomVideoProcessHandler.csParameters
| Name | Type | Description |
|---|---|---|
| textureID | int | Texture ID. |
| width | int | Texture width |
| height | int | Texture height |
| referenceTimeMillisecond | ulong | video frame reference time, UNIX timestamp, in milliseconds. |
| channel | ZegoPublishChannel | Publishing stream channel |
Details
When the custom video pre-processing is turned on, after calling [setCustomVideoProcessHandler] to set the callback, the SDK receives the original video data and calls back to the developer. After the developer has processed the original image, he must call [sendCustomVideoProcessedTextureData] to send the processed data back to the SDK, otherwise it will cause frame loss.
- Use cases: After the developer collects the video data by himself or obtains the video data collected by the SDK, if the basic beauty and watermark functions of the SDK cannot meet the needs of the developer (for example, the beauty effect cannot meet the expectations), the ZegoEffects SDK can be used to perform the video Some special processing, such as beautifying, adding pendants, etc., this process is the pre-processing of custom video. When to
- Trigger: When the custom video pre-processing is enabled, the SDK collects the original video data.
- Platform differences: It only takes effect on the Android platform.
- Available since: 2.2.0
- Restrictions: This interface takes effect when [enableCustomVideoProcessing] is called to enable custom video pre-processing and the bufferType of config is passed in [ZegoVideoBufferTypeGLTexture2D].
IZegoEventHandler
Declared in IZegoEventHandler.cs
Methods
OnDebugError
public delegate void OnDebugError(int errorCode,string funcName,string info)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| errorCode | int | Error code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details. |
| funcName | string | Function name. |
| info | string | Detailed 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.
OnApiCalledResult
public delegate void OnApiCalledResult(int errorCode,string funcName,string info)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| errorCode | int | Error code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details. |
| funcName | string | Function name. |
| info | string | Detailed error information. |
Details
When the monitoring is turned on through [setApiCalledCallback], the results of the execution of all methods will be called back through this callback.
- Trigger: When the developer calls the SDK method, the execution result of the method is called back.
- Caution: It is recommended to monitor and process this callback in the development and testing phases, and turn off the monitoring of this callback after going online.
- Available since: 2.3.0
- Restrictions: Not available for WebGL.
OnEngineStateUpdate
public delegate void OnEngineStateUpdate(ZegoEngineState state)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| state | ZegoEngineState | The 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: None.
OnRecvExperimentalAPI
public delegate void OnRecvExperimentalAPI(string content)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| content | string | Callback content in JSON string format. |
Details
Receive experimental API callbacks in JSON string format.
- Caution: Please use this feature with the help of ZEGO Technical Support.
- Available since: 2.7.0
- Restrictions: Not available for WebGL.
OnRoomStateUpdate
public delegate void OnRoomStateUpdate(string roomID,ZegoRoomState state,int errorCode,string extendedData)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| roomID | string | Room ID, a string of up to 128 bytes in length. |
| state | ZegoRoomState | Changed room state. |
| errorCode | int | Error code, For details, please refer to Common Error Codes. |
| extendedData | string | Extended 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:
- The developer will receive this notification when calling the [loginRoom], [logoutRoom], [switchRoom] functions.
- 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.
OnRoomStateChanged
public delegate void OnRoomStateChanged(string roomID,ZegoRoomStateChangedReason reason,int errorCode,string extendedData)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| roomID | string | Room ID, a string of up to 128 bytes in length. |
| reason | ZegoRoomStateChangedReason | Room state change reason. |
| errorCode | int | Error code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details. |
| extendedData | string | Extended 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: Users will receive this notification when they call room functions (refer to [Related APIs]). 2. This notification may also be received when the user device's network conditions change (SDK will automatically log in to the room again when the connection is disconnected, refer to https://doc-zh.zego.im/faq/reconnect ).
- 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: 2.18.0
- Restrictions: None.
OnRoomUserUpdate
public delegate void OnRoomUserUpdate(string roomID,ZegoUpdateType updateType,uint userCount,List<ZegoUser> userList)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| roomID | string | Room ID where the user is logged in, a string of up to 128 bytes in length. |
| updateType | ZegoUpdateType | Update type (add/delete). |
| userCount | uint | |
| userList | List<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:
- 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
updateTypebeing [ZegoUpdateTypeAdd], anduserListis the other users in the room at this time. - 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
updateTypebeing [ZegoUpdateTypeAdd]. - If other users log out of this room through the [logoutRoom] or [switchRoom] functions, the SDK will trigger a callback notification with
updateTypebeing [ZegoUpdateTypeDelete]. - 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
updateTypebeing [ZegoUpdateTypeDelete].
- 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
- 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
public delegate void OnRoomOnlineUserCountUpdate(string roomID,int count)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| roomID | string | Room ID where the user is logged in, a string of up to 128 bytes in length. |
| count | int | Count 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
public delegate void OnRoomStreamUpdate(string roomID,ZegoUpdateType updateType,List<ZegoStream> streamList,string extendedData)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| roomID | string | Room ID where the user is logged in, a string of up to 128 bytes in length. |
| updateType | ZegoUpdateType | Update type (add/delete). |
| streamList | List<ZegoStream> | Updated stream list. |
| extendedData | string | Extended 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:
- 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
updateTypebeing [ZegoUpdateTypeAdd], andstreamListis an existing stream list. - The user is already in the room. if another user adds a new push, the SDK will trigger a callback notification with
updateTypebeing [ZegoUpdateTypeAdd]. - The user is already in the room. If other users stop streaming, the SDK will trigger a callback notification with
updateTypebeing [ZegoUpdateTypeDelete]. - The user is already in the room. If other users leave the room, the SDK will trigger a callback notification with
updateTypebeing [ZegoUpdateTypeDelete].
- 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
- Available since: 1.1.0
- Restrictions: None.
OnRoomStreamExtraInfoUpdate
public delegate void OnRoomStreamExtraInfoUpdate(string roomID,List<ZegoStream> streamList)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| roomID | string | Room ID where the user is logged in, a string of up to 128 bytes in length. |
| streamList | List<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
public delegate void OnRoomExtraInfoUpdate(string roomID,List<ZegoRoomExtraInfo> roomExtraInfoList)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| roomID | string | Room ID where the user is logged in, a string of up to 128 bytes in length. |
| roomExtraInfoList | List<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.
OnRoomTokenWillExpire
public delegate void OnRoomTokenWillExpire(string roomID,int remainTimeInSecond)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| roomID | string | Room ID where the user is logged in, a string of up to 128 bytes in length. |
| remainTimeInSecond | int | The remaining time before the token expires. |
Details
The callback notification that the room Token authentication is about to expire, please use [renewToken] to update the room Token authentication.
- Use cases: In order to prevent illegal entry into the room, it is necessary to perform authentication control on login room, push streaming, etc., to improve security.
- When to call /Trigger: 30 seconds before the Token expires, the SDK will call [onRoomTokenWillExpire] to notify developer.
- Caution: The token contains important information such as the user's room permissions, publish stream permissions, and effective time, please refer to https://docs.zegocloud.com/article/11649.
- Related APIs: When the developer receives this callback, he can use [renewToken] to update the token authentication information.
- Available since: 2.8.0
- Restrictions: None.
OnPublisherStateUpdate
public delegate void OnPublisherStateUpdate(string streamID,ZegoPublisherState state,int errorCode,string extendedData)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| streamID | string | Stream ID. |
| state | ZegoPublisherState | State of publishing stream. |
| errorCode | int | The 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. |
| extendedData | string | Extended 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
public delegate void OnPublisherQualityUpdate(string streamID,ZegoPublishStreamQuality quality)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| streamID | string | Stream ID. |
| quality | ZegoPublishStreamQuality | Publishing 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
public delegate void OnPublisherCapturedAudioFirstFrame()IZegoEventHandler.csThis 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
- Restrictions: Not available for WebGL.
OnPublisherCapturedVideoFirstFrame
public delegate void OnPublisherCapturedVideoFirstFrame(ZegoPublishChannel channel)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| channel | ZegoPublishChannel | Publishing 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
- Restrictions: Not available for WebGL.
OnPublisherRenderVideoFirstFrame
public delegate void OnPublisherRenderVideoFirstFrame(ZegoPublishChannel channel)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| channel | ZegoPublishChannel | Publishing stream channel.If you only publish one audio and video stream, you can ignore this parameter. |
Details
this callback will be called after SDK rendered the first frame of video data captured. This interface is for preview rendering. The first frame callback is only available for external collection and internal preview. If it is not for SDK rendering, there is no such callback.
- Related callbacks: After the [startPublishingStream] function is called successfully, determine if the SDK actually collected audio data by the callback function [onPublisherCapturedAudioFirstFrame], determine if the SDK actually collected video data by the callback function [onPublisherCapturedVideoFirstFrame].
- Available since: 2.4.0
- Restrictions: Not available for WebGL.
OnPublisherVideoSizeChanged
public delegate void OnPublisherVideoSizeChanged(int width,int height,ZegoPublishChannel channel)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| width | int | Video capture resolution width. |
| height | int | Video capture resolution height. |
| channel | ZegoPublishChannel | Publishing 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
- Restrictions: Not available for WebGL.
OnPublisherRelayCDNStateUpdate
public delegate void OnPublisherRelayCDNStateUpdate(string streamID,List<ZegoStreamRelayCDNInfo> infoList)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| streamID | string | Stream ID. |
| infoList | List<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.
OnPublisherDummyCaptureImagePathError
public delegate void OnPublisherDummyCaptureImagePathError(int errorCode,string path,ZegoPublishChannel channel)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| errorCode | int | error code. |
| path | string | Image path. |
| channel | ZegoPublishChannel | Publishing stream channel.If you only publish one audio and video stream, you can ignore this parameter. |
Details
The notification for setting the path of the static image displayed when the camera is turned off is incorrect. When to trigger: If the path for the image is set using [setDummyCaptureImagePath], but the image cannot be obtained during streaming, this callback will be triggered.
- Caution: Please make sure that the image path is correct and has read permission before setting it.
- Available since: 3.9.0
- Restrictions: Not available for WebGL.
OnPlayerStateUpdate
public delegate void OnPlayerStateUpdate(string streamID,ZegoPlayerState state,int errorCode,string extendedData)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| streamID | string | stream ID. |
| state | ZegoPlayerState | State of playing stream. |
| errorCode | int | The 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. |
| extendedData | string | Extended 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
public delegate void OnPlayerQualityUpdate(string streamID,ZegoPlayStreamQuality quality)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| streamID | string | Stream ID. |
| quality | ZegoPlayStreamQuality | Playing 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
public delegate void OnPlayerMediaEvent(string streamID,ZegoPlayerMediaEvent mediaEvent)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| streamID | string | Stream ID. |
| mediaEvent | ZegoPlayerMediaEvent | Specific 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
public delegate void OnPlayerRecvAudioFirstFrame(string streamID)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| streamID | string | Stream 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
- Restrictions: Not available for WebGL.
OnPlayerRecvVideoFirstFrame
public delegate void OnPlayerRecvVideoFirstFrame(string streamID)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| streamID | string | Stream 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
- Restrictions: Not available for WebGL.
OnPlayerRenderVideoFirstFrame
public delegate void OnPlayerRenderVideoFirstFrame(string streamID)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| streamID | string | Stream 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
- Restrictions: Not available for WebGL.
OnPlayerRenderCameraVideoFirstFrame
public delegate void OnPlayerRenderCameraVideoFirstFrame(string streamID)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| streamID | string | Stream ID. |
Details
After calling the [startPlayingStream] function to pull the stream successfully, the SDK will receive this callback after pulling the stream and rendering the first frame of remote camera 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: After the remote [enableCamera] enables the camera, or after [mutePublishStreamVideo] is true and starts to send video data, the SDK will receive this callback after playing the stream and rendering the first frame of the remote camera video data.
- Caution: It is only applicable when the remote end uses the camera to push the stream. Only applicable to RTC publishing and playing streaming scenarios.
- Related callbacks: After a successful call to [startPlayingStream], the callback [onPlayerRecvVideoFirstFrame] determines whether the SDK has received the video data.
- Available since: 3.0.0
- Restrictions: Not available for WebGL.
OnPlayerVideoSizeChanged
public delegate void OnPlayerVideoSizeChanged(string streamID,int width,int height)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| streamID | string | Stream ID. |
| width | int | Video decoding resolution width. |
| height | int | Video 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: If the stream is only audio data, the callback will not be triggered.
- Available since: 1.1.0
- Restrictions: Not available for WebGL.
OnPlayerRecvSEI
public delegate void OnPlayerRecvSEI(string streamID,byte[] data)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| streamID | string | Stream ID. |
| data | byte[] | 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.
OnPlayerSyncRecvSEI
public delegate void OnPlayerSyncRecvSEI(string streamID,byte[] data)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| streamID | string | Stream ID. |
| data | byte[] | 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: 3.4.0
- Restrictions: Not available for WebGL.
OnPlayerStreamEvent
public delegate void OnPlayerStreamEvent(ZegoStreamEvent eventID,string streamID,string extraInfo)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| eventID | ZegoStreamEvent | Play stream event ID |
| streamID | string | Stream ID. |
| extraInfo | string | extra info. it is in JSON format. Included information includes "url" for address, "streamProtocol" for stream protocol, including rtmp, flv, avertp, hls, webrtc, etc. "netProtocol" for network protocol, including tcp, udp, quic, "resourceType" for resource type , including cdn, rtc, l3. |
Details
After start playing stream, this callback will return the current stream address, resource type and protocol-related information. When to trigger: Play and retry play events.
- Caution: None.
- Available since: 2.18.0
OnMixerRelayCDNStateUpdate
public delegate void OnMixerRelayCDNStateUpdate(string taskID,List<ZegoStreamRelayCDNInfo> infoList)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| taskID | string | The 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'~','!','@','$','%','^','&','*','(',')','_' ,'+','=','-','`',';',''',',','.','<','>',''. |
| infoList | List<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
public delegate void OnMixerSoundLevelUpdate(Dictionary<uint, float> soundLevels)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| soundLevels | Dictionary<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.
OnAutoMixerSoundLevelUpdate
public delegate void OnAutoMixerSoundLevelUpdate(Dictionary<string, float> soundLevels)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| soundLevels | Dictionary<string, float> | Sound level hash map, key is the streamID of every single stream in this mixer stream, value is the sound level value of that single stream, 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
According to this callback, user can obtain the sound level information of each stream pulled during auto stream mixing.
- Use cases: Often used in voice chat room scenarios.Users can use this callback to show which streamer is speaking when an audience pulls a mixed stream.
- Trigger: Call [startPlayingStream] function to pull the stream.
- Related APIs: Users can call [startAutoMixerTask] function to start an auto stream mixing task.Users can call [stopAutoMixerTask] function to stop an auto stream mixing task.
- Available since: 2.10.0
- Restrictions: Not available for WebGL.
OnAudioDeviceStateChanged
public delegate void OnAudioDeviceStateChanged(ZegoUpdateType updateType,ZegoAudioDeviceType deviceType,ZegoDeviceInfo deviceInfo)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| updateType | ZegoUpdateType | Update type (add/delete) |
| deviceType | ZegoAudioDeviceType | Audio device type |
| deviceInfo | ZegoDeviceInfo | Audio device information |
Details
By listening to this callback, users can update the sound collection or output using a specific device when necessary. When to trigger: This callback is triggered when an audio device is added or removed from the system.
- Platform differences: Only supports Windows and macOS.
- Available since: 1.1.0
- Restrictions: Not available for WebGL.
OnAudioDeviceVolumeChanged
public delegate void OnAudioDeviceVolumeChanged(ZegoAudioDeviceType deviceType,string deviceID,int volume)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| deviceType | ZegoAudioDeviceType | Audio device type |
| deviceID | string | Audio device ID |
| volume | int | audio device volume |
Details
Audio device volume change event callback. When to trigger: After calling the [startAudioDeviceVolumeMonitor] function to start the device volume monitor, and the volume of the monitored audio device changes.
- Platform differences: Only supports Windows and macOS.
- Available since: 1.1.0
- Restrictions: Not available for WebGL.
OnVideoDeviceStateChanged
public delegate void OnVideoDeviceStateChanged(ZegoUpdateType updateType,ZegoDeviceInfo deviceInfo)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| updateType | ZegoUpdateType | Update type (add/delete) |
| deviceInfo | ZegoDeviceInfo | Audio device information |
Details
By listening to this callback, users can update the video capture using a specific device when necessary. When to trigger: This callback is triggered when a video device is added or removed from the system.
- Platform differences: Only supports Windows and macOS.
- Available since: 1.1.0
- Restrictions: Not available for WebGL.
OnCapturedSoundLevelUpdate
public delegate void OnCapturedSoundLevelUpdate(float soundLevel)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| soundLevel | float | Locally 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
- Restrictions: Not available for WebGL.
OnCapturedSoundLevelInfoUpdate
public delegate void OnCapturedSoundLevelInfoUpdate(ZegoSoundLevelInfo * soundLevelInfo)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| soundLevelInfo | ZegoSoundLevelInfo * | Locally 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. 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] or [onRemoteSoundLevelInfoUpdate].
- Available since: 2.10.0
- Restrictions: Not available for WebGL.
OnRemoteSoundLevelUpdate
public delegate void OnRemoteSoundLevelUpdate(Dictionary<string, float> soundLevels)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| soundLevels | Dictionary<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.
OnRemoteSoundLevelInfoUpdate
public delegate void OnRemoteSoundLevelInfoUpdate(Dictionary<string, ZegoSoundLevelInfo> soundLevelInfos)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| soundLevelInfos | Dictionary<string, ZegoSoundLevelInfo> | 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: 2.10.0
- Restrictions: Not available for WebGL.
OnCapturedAudioSpectrumUpdate
public delegate void OnCapturedAudioSpectrumUpdate(float[] audioSpectrum)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| audioSpectrum | float[] | 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
public delegate void OnRemoteAudioSpectrumUpdate(Dictionary<string, float[]> audioSpectrums)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| audioSpectrums | Dictionary<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
public delegate void OnLocalDeviceExceptionOccurred(ZegoDeviceExceptionType exceptionType,ZegoDeviceType deviceType,string deviceID)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| exceptionType | ZegoDeviceExceptionType | The type of the device exception. |
| deviceType | ZegoDeviceType | The type of device where the exception occurred. |
| deviceID | string | Device 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
- Restrictions: Not available for WebGL.
OnRemoteCameraStateUpdate
public delegate void OnRemoteCameraStateUpdate(string streamID,ZegoRemoteDeviceState state)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| streamID | string | Stream ID. |
| state | ZegoRemoteDeviceState | Remote 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
- Restrictions: Not available for WebGL.
OnRemoteMicStateUpdate
public delegate void OnRemoteMicStateUpdate(string streamID,ZegoRemoteDeviceState state)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| streamID | string | Stream ID. |
| state | ZegoRemoteDeviceState | Remote 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
- Restrictions: Not available for WebGL.
OnRemoteSpeakerStateUpdate
public delegate void OnRemoteSpeakerStateUpdate(string streamID,ZegoRemoteDeviceState state)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| streamID | string | Stream ID. |
| state | ZegoRemoteDeviceState | Remote speaker 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 speaker 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 speaker device changes, such as switching the speaker, by monitoring this callback, you can get events related to the remote speaker.
- Caution: This callback will not be called back when the remote stream is play from the CDN.
- Available since: 1.1.0
- Restrictions: Not available for WebGL.
OnAudioRouteChange
public delegate void OnAudioRouteChange(ZegoAudioRoute audioRoute)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| audioRoute | ZegoAudioRoute | Current audio route. |
Details
Callback for device's audio route changed.
- Trigger: This callback will be called when there are changes in audio routing such as earphone plugging, speaker and receiver switching, etc.
- Platform differences: Only supports iOS and Android.
- Available since: 1.20.0
OnIMRecvBroadcastMessage
public delegate void OnIMRecvBroadcastMessage(string roomID,List<ZegoBroadcastMessageInfo> messageList)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| roomID | string | Room ID. Value range: The maximum length is 128 bytes. |
| messageList | List<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
public delegate void OnIMRecvBarrageMessage(string roomID,List<ZegoBarrageMessageInfo> messageList)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| roomID | string | Room ID. Value range: The maximum length is 128 bytes. |
| messageList | List<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
public delegate void OnIMRecvCustomCommand(string roomID,ZegoUser fromUser,string command)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| roomID | string | Room ID. Value range: The maximum length is 128 bytes. |
| fromUser | ZegoUser | Sender of the command. |
| command | string | Command 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: Not available for WebGL.
OnCapturedDataRecordStateUpdate
public delegate void OnCapturedDataRecordStateUpdate(ZegoDataRecordState state,int errorCode,ZegoDataRecordConfig config,ZegoPublishChannel channel)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| state | ZegoDataRecordState | File recording status. |
| errorCode | int | Error code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details. |
| config | ZegoDataRecordConfig | Record config. |
| channel | ZegoPublishChannel | Publishing 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: Not available for WebGL.
OnCapturedDataRecordProgressUpdate
public delegate void OnCapturedDataRecordProgressUpdate(ZegoDataRecordProgress progress,ZegoDataRecordConfig config,ZegoPublishChannel channel)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| progress | ZegoDataRecordProgress | File recording progress, which allows developers to hint at the UI, etc. |
| config | ZegoDataRecordConfig | Record config. |
| channel | ZegoPublishChannel | Publishing 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: Not available for WebGL.
OnNetworkQuality
public delegate void OnNetworkQuality(string userID,ZegoStreamQualityLevel upstreamQuality,ZegoStreamQualityLevel downstreamQuality)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| userID | string | User ID, empty means local user |
| upstreamQuality | ZegoStreamQualityLevel | Upstream network quality |
| downstreamQuality | ZegoStreamQualityLevel | Downstream network quality |
Details
The uplink and downlink network callbacks of the local and remote users, that would be called by default every two seconds for the local and each playing remote user's network quality. Versions 2.10.0 to 2.13.1:
- Developer must both publish and play streams before you receive your own network quality callback.
- When playing a stream, the publish end has a play stream and the publish end is in the room where it is located, then the user's network quality will be received. Versions 2.14.0 to 2.21.1:
- As long as you publish or play a stream, you will receive your own network quality callback.
- When you play a stream, the publish end is in the room where you are, and you will receive the user's network quality. Version 2.22.0 and above:
- Estimate the network conditions of the remote stream publishing user. If the remote stream publishing user loses one heartbeat, the network quality will be called back as unknown; if the remote stream publishing user's heartbeat loss reaches 3 Second, call back its network quality to die. Use case: When the developer wants to analyze the network condition on the link, or wants to know the network condition of local and remote users.
- Trigger: After publishing a stream by called [startPublishingStream] or playing a stream by called [startPlayingStream].
- Available since: 2.10.0
- Restrictions: Not available for WebGL. When to
OnNetworkTimeSynchronized
public delegate void OnNetworkTimeSynchronized()IZegoEventHandler.cs- Available since: 2.12.0 This callback is triggered when internal network time synchronization completes after a developer calls [createEngine].Not available for WebGL.
OnCustomVideoCaptureStart
public delegate void OnCustomVideoCaptureStart(ZegoPublishChannel channel)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| channel | ZegoPublishChannel | Publishing 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
- Restrictions: Not available for WebGL.
OnCustomVideoCaptureStop
public delegate void OnCustomVideoCaptureStop(ZegoPublishChannel channel)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| channel | ZegoPublishChannel | Publishing 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
- Restrictions: Not available for WebGL.
OnCapturedVideoFrameRawData
public delegate void OnCapturedVideoFrameRawData(IntPtr[] data,uint[] dataLength,ZegoVideoFrameParam param,ZegoVideoFlipMode flipMode,ZegoPublishChannel channel)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| data | IntPtr[] | Raw video frame data (eg: RGBA only needs to consider data[0], I420 needs to consider data[0,1,2]). |
| dataLength | uint[] | Data length (eg: RGBA only needs to consider dataLength[0], I420 needs to consider dataLength[0,1,2]). |
| param | ZegoVideoFrameParam | Video frame parameters. |
| flipMode | ZegoVideoFlipMode | video flip mode. |
| channel | ZegoPublishChannel | Publishing 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
public delegate void OnRemoteVideoFrameRawData(IntPtr[] data,uint[] dataLength,ZegoVideoFrameParam param,string streamID)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| data | IntPtr[] | Raw video frame data (eg: RGBA only needs to consider data[0], I420 needs to consider data[0,1,2]). |
| dataLength | uint[] | Data length (eg: RGBA only needs to consider dataLength[0], I420 needs to consider dataLength[0,1,2]). |
| param | ZegoVideoFrameParam | Video frame parameters. |
| streamID | string | Stream 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
public delegate void OnCapturedAudioData(IntPtr data,uint dataLength,ZegoAudioFrameParam param)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| data | IntPtr | Audio data in PCM format. |
| dataLength | uint | Length of the data. |
| param | ZegoAudioFrameParam | Parameters 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
public delegate void OnPlaybackAudioData(IntPtr data,uint dataLength,ZegoAudioFrameParam param)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| data | IntPtr | Audio data in PCM format. |
| dataLength | uint | Length of the data. |
| param | ZegoAudioFrameParam | Parameters 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
public delegate void OnMixedAudioData(IntPtr data,uint dataLength,ZegoAudioFrameParam param)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| data | IntPtr | Audio data in PCM format. |
| dataLength | uint | Length of the data. |
| param | ZegoAudioFrameParam | Parameters 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
public delegate void OnPlayerAudioData(IntPtr data,uint dataLength,ZegoAudioFrameParam param,string streamID)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| data | IntPtr | Audio data in PCM format. |
| dataLength | uint | Length of the data. |
| param | ZegoAudioFrameParam | Parameters of the audio frame. |
| streamID | string | Corresponding 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.
OnMobileScreenCaptureExceptionOccurred
public delegate void OnMobileScreenCaptureExceptionOccurred(ZegoScreenCaptureExceptionType exceptionType)IZegoEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| exceptionType | ZegoScreenCaptureExceptionType | Screen capture exception type. |
Details
The callback triggered when the mobile screen capture source exception occurred.
- Trigger: This callback is triggered when an exception occurs after the mobile screen capture started.
- Caution: The callback does not actually take effect until call [setEventHandler] to set.
- Available since: 3.6.0
- Restrictions: Only available on Android and iOS.
IZegoMediaPlayerHandler
Declared in IZegoMediaPlayerHandler.cs
Methods
OnMediaPlayerStateUpdate
public delegate void OnMediaPlayerStateUpdate(ZegoMediaPlayer mediaPlayer,ZegoMediaPlayerState state,int errorCode)IZegoMediaPlayerHandler.csParameters
| Name | Type | Description |
|---|---|---|
| mediaPlayer | ZegoMediaPlayer | Callback player object. |
| state | ZegoMediaPlayerState | Media player status. |
| errorCode | int | Error code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details. |
Details
MediaPlayer playback status callback.
- Trigger: The callback triggered when the state of the media player changes.
- Available since: 1.3.4
- Restrictions: None.
OnMediaPlayerNetworkEvent
public delegate void OnMediaPlayerNetworkEvent(ZegoMediaPlayer mediaPlayer,ZegoMediaPlayerNetworkEvent networkEvent)IZegoMediaPlayerHandler.csParameters
| Name | Type | Description |
|---|---|---|
| mediaPlayer | ZegoMediaPlayer | Callback player object. |
| networkEvent | ZegoMediaPlayerNetworkEvent | Network status event. |
Details
The callback triggered when the network status of the media player changes.
- Trigger: When the media player is playing network resources, this callback will be triggered when the status change of the cached data.
- Related APIs: [setNetWorkBufferThreshold].
- Available since: 1.3.4
- Restrictions: The callback will only be triggered when the network resource is played.Not available for WebGL.
OnMediaPlayerPlayingProgress
public delegate void OnMediaPlayerPlayingProgress(ZegoMediaPlayer mediaPlayer,ulong millisecond)IZegoMediaPlayerHandler.csParameters
| Name | Type | Description |
|---|---|---|
| mediaPlayer | ZegoMediaPlayer | Callback player object. |
| millisecond | ulong | Progress in milliseconds. |
Details
The callback triggered when the network status of the media player changes. Set the callback interval by calling [setProgressInterval]. When the callback interval is set to 0, the callback is stopped. The default callback interval is 1 second.
- Trigger: When the media player is playing network resources, this callback will be triggered when the status change of the cached data.
- Related APIs: [setProgressInterval].
- Available since: 1.3.4
- Restrictions: None.
OnMediaPlayerRenderingProgress
public delegate void OnMediaPlayerRenderingProgress(ZegoMediaPlayer mediaPlayer,ulong millisecond)IZegoMediaPlayerHandler.csParameters
| Name | Type | Description |
|---|---|---|
| mediaPlayer | ZegoMediaPlayer | Callback player object. |
| millisecond | ulong | Progress in milliseconds. |
Details
The callback to report the current rendering progress of the media player. Set the callback interval by calling [setProgressInterval]. When the callback interval is set to 0, the callback is stopped. The default callback interval is 1 second.
- Trigger: This callback will be triggered when the media player starts playing resources.
- Related APIs: [setProgressInterval].
- Available since: 3.8.0
- Restrictions: Not available for WebGL.
OnMediaPlayerRecvSEI
public delegate void OnMediaPlayerRecvSEI(ZegoMediaPlayer mediaPlayer,List<byte> data)IZegoMediaPlayerHandler.csParameters
| Name | Type | Description |
|---|---|---|
| mediaPlayer | ZegoMediaPlayer | Callback player object. |
| data | List<byte> | SEI content. |
Details
The callback triggered when the media player got media side info.
- Trigger: When the media player starts playing media files, the callback is triggered if the SEI is resolved to the media file.
- Caution: The callback does not actually take effect until call [setEventHandler] to set.
- Available since: 2.2.0
- Restrictions: Not available for WebGL.
OnMediaPlayerSoundLevelUpdate
public delegate void OnMediaPlayerSoundLevelUpdate(ZegoMediaPlayer mediaPlayer,float soundLevel)IZegoMediaPlayerHandler.csParameters
| Name | Type | Description |
|---|---|---|
| mediaPlayer | ZegoMediaPlayer | Callback player object. |
| soundLevel | float | Sound level value, value range: [0.0, 100.0] (This value only represents the range of the sound level value returned by the callback, not the precision.). |
Details
The callback of sound level update.
- Trigger: The callback frequency is specified by [EnableSoundLevelMonitor].
- Caution: The callback does not actually take effect until call [setEventHandler] to set.
- Related APIs: To monitor this callback, you need to enable it through [EnableSoundLevelMonitor].
- Available since: 2.15.0
- Restrictions: Not available for WebGL.
OnMediaPlayerFrequencySpectrumUpdate
public delegate void OnMediaPlayerFrequencySpectrumUpdate(ZegoMediaPlayer mediaPlayer,List<float> spectrumList)IZegoMediaPlayerHandler.csParameters
| Name | Type | Description |
|---|---|---|
| mediaPlayer | ZegoMediaPlayer | Callback player object. |
| spectrumList | List<float> | Locally captured frequency spectrum value list. Spectrum value range is [0-2^30]. |
Details
The callback of frequency spectrum update.
- Trigger: The callback frequency is specified by [EnableFrequencySpectrumMonitor].
- Caution: The callback does not actually take effect until call [setEventHandler] to set.
- Related APIs: To monitor this callback, you need to enable it through [EnableFrequencySpectrumMonitor].
- Available since: 2.15.0
- Restrictions: Not available for WebGL.
OnMediaPlayerLocalCache
public delegate void OnMediaPlayerLocalCache(ZegoMediaPlayer mediaPlayer,int errorCode,string resource,string cachedFile)IZegoMediaPlayerHandler.csParameters
| Name | Type | Description |
|---|---|---|
| mediaPlayer | ZegoMediaPlayer | Callback player object. |
| errorCode | int | Error code. |
| resource | string | Played resource |
| cachedFile | string | Cached file |
Details
The callback triggered when the media player caches http/https network resource locally.
- Trigger: This callback occurs after the media player caches http/https network resources.
- Caution: This callback will not take effect until the [enableLocalCache] API is called and the http/https network resources are played.
- Related APIs: Need to call the [enableLocalCache] interface.
- Available since: 3.12.0
- Restrictions: Not available for WebGL.
OnVideoFrame
public delegate void OnVideoFrame(ZegoMediaPlayer mediaPlayer,IntPtr[] data,uint[] dataLength,ZegoVideoFrameParam param,string extraInfo)IZegoMediaPlayerHandler.csParameters
| Name | Type | Description |
|---|---|---|
| mediaPlayer | ZegoMediaPlayer | Callback player object. |
| data | IntPtr[] | Raw data of video frames (eg: RGBA only needs to consider data[0], I420 needs to consider data[0,1,2]). |
| dataLength | uint[] | Data length (eg: RGBA only needs to consider dataLength[0], I420 needs to consider dataLength[0,1,2]). |
| param | ZegoVideoFrameParam | Video frame flip mode. |
| extraInfo | string | Video frame extra info. |
Details
The callback triggered when the media player throws out video frame data.
- Trigger: The callback is generated when the media player starts playing.
- Caution: The callback does not actually take effect until call [setVideoHandler] to set.
- Available since: 2.16.0
- Restrictions: When playing copyrighted music, this callback will be disabled by default. If necessary, please contact ZEGO technical support.
OnAudioFrame
public delegate void OnAudioFrame(ZegoMediaPlayer mediaPlayer,IntPtr data,uint dataLength,ZegoAudioFrameParam param)IZegoMediaPlayerHandler.csParameters
| Name | Type | Description |
|---|---|---|
| mediaPlayer | ZegoMediaPlayer | Callback player object. |
| data | IntPtr | Raw data of audio frames. |
| dataLength | uint | Data length. |
| param | ZegoAudioFrameParam | audio frame flip mode. |
Details
The callback triggered when the media player throws out audio frame data.
- Trigger: The callback is generated when the media player starts playing.
- Caution: The callback does not actually take effect until call [setAudioHandler] to set.
- Available since: 1.3.4
- Restrictions: When playing copyrighted music, this callback will be disabled by default. If necessary, please contact ZEGO technical support.
IZegoRangeAudioHandler
Declared in IZegoRangeAudioHandler.cs
Methods
OnRangeAudioMicrophoneStateUpdate
public delegate void OnRangeAudioMicrophoneStateUpdate(ZegoRangeAudio rangeAudio,ZegoRangeAudioMicrophoneState state,int errorCode)IZegoRangeAudioHandler.csParameters
| Name | Type | Description |
|---|---|---|
| rangeAudio | ZegoRangeAudio | Range audio instance that triggers this callback. |
| state | ZegoRangeAudioMicrophoneState | The use state of the range audio. |
| errorCode | int | Error code, please refer to the error codes document https://docs.zegocloud.com/en/5548.html for details. |
Details
The status change notification of the microphone, starting to send audio is an asynchronous process, and the state switching in the middle is called back through this function. When to
- Trigger: After the [enableMicrophone] function.
- Caution: 1. It must be monitored before the [enableMicrophone] function is called. 2. The callback is not triggered when the [enableMicrophone] is stopped normally, and the Off state is triggered only when the [enableMicrophone] is stopped abnormally.
- Available since: 2.11.0
IZegoRangeSceneEventHandler
Declared in IZegoRangeSceneEventHandler.cs
Methods
OnSceneStateUpdate
public delegate void OnSceneStateUpdate(ZegoRangeScene rangeScene,ZegoSceneState state,int errorCode)IZegoRangeSceneEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| rangeScene | ZegoRangeScene | Range scene instance that triggers this callback. |
| state | ZegoSceneState | Current scene state. |
| errorCode | int | Error code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details. |
Details
The callback triggered when the scene connection state changes. When to trigger: Scene connection state changes.
- Restrictions: Do not call the SDK interface in the callback thread.Not available for WebGL.
OnEnterView
public delegate void OnEnterView(ZegoRangeScene rangeScene,ZegoUser user,ZegoPosition position)IZegoRangeSceneEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| rangeScene | ZegoRangeScene | Range scene instance that triggers this callback. |
| user | ZegoUser | User object. |
| position | ZegoPosition | User position. |
Details
Callback notification when another user enters the current user's field of view. When to trigger: Another user enters the current user's field of view.
- Restrictions: Do not call the SDK interface in the callback thread.Not available for WebGL.
OnLeaveView
public delegate void OnLeaveView(ZegoRangeScene rangeScene,string userID)IZegoRangeSceneEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| rangeScene | ZegoRangeScene | Range scene instance that triggers this callback. |
| userID | string | User ID. |
Details
Callback notification when other users leave the current user's field of view. When to trigger: Other users leave the current user's field of view.
- Restrictions: Do not call the SDK interface in the callback thread.Not available for WebGL.
OnUserStatusUpdate
public delegate void OnUserStatusUpdate(ZegoRangeScene rangeScene,string userID,ZegoPosition position,uint channel,byte[] status)IZegoRangeSceneEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| rangeScene | ZegoRangeScene | Range scene instance that triggers this callback. |
| userID | string | User ID. |
| position | ZegoPosition | User's current position. |
| channel | uint | The channel to which the status belongs. |
| status | byte[] | Current status data. |
Details
User state update callback. When to trigger: User state update.
- Caution: This callback is a high-frequency callback, please do not perform time-consuming operations in this callback.
- Restrictions: Do not call the SDK interface in the callback thread.Not available for WebGL.
OnUserCommandUpdate
public delegate void OnUserCommandUpdate(ZegoRangeScene rangeScene,string userID,ZegoPosition position,uint channel,byte[] command)IZegoRangeSceneEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| rangeScene | ZegoRangeScene | Range scene instance that triggers this callback. |
| userID | string | User ID. |
| position | ZegoPosition | User's current position. |
| channel | uint | The channel to which the command belongs. |
| command | byte[] | Next command data. |
Details
User command update callback. When to trigger: User command update.
- Caution: This callback is a high-frequency callback, please do not perform time-consuming operations in this callback.
- Restrictions: Do not call the SDK interface in the callback thread.Not available for WebGL.
OnCustomCommandUpdate
public delegate void OnCustomCommandUpdate(ZegoRangeScene rangeScene,byte[] command)IZegoRangeSceneEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| rangeScene | ZegoRangeScene | Range scene instance that triggers this callback. |
| command | byte[] | Custom command. |
Details
Custom command update callback. When to trigger: Custom command update.
- Restrictions: Do not call the SDK interface in the callback thread.Not available for WebGL.
OnSceneTokenWillExpire
public delegate void OnSceneTokenWillExpire(ZegoRangeScene rangeScene,int remainTimeInSecond)IZegoRangeSceneEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| rangeScene | ZegoRangeScene | Range scene instance that triggers this callback. |
| remainTimeInSecond | int | The remaining time before the token expires. |
Details
The callback notification that the scene Token authentication is about to expire, please use [renewToken] to update the scene Token authentication.
- When to call /Trigger: 30 seconds before the Token expires, the SDK will call [onSceneTokenWillExpire] to notify developer.
- Related APIs: When the developer receives this callback, he can use [renewToken] to update the token authentication information.
- Available since: 3.1.0
- Restrictions: Do not call the SDK interface in the callback thread.Not available for WebGL.
IZegoRangeSceneStreamEventHandler
Declared in IZegoRangeSceneStreamEventHandler.cs
Methods
OnUserStreamStateUpdate
public delegate void OnUserStreamStateUpdate(ZegoRangeScene rangeScene,string userID,string streamID,ZegoStreamState state)IZegoRangeSceneStreamEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| rangeScene | ZegoRangeScene | Range scene instance that triggers this callback. |
| userID | string | User ID. |
| streamID | string | User's stream ID. |
| state | ZegoStreamState | The state of local user play stream. |
Details
The callback notification of local user plays other users' stream state change. When to trigger: The local user plays other users' stream state changes.
- Available since: 3.0.0
- Restrictions: Do not call the SDK interface in the callback thread.Not available for WebGL.
OnUserMicUpdate
public delegate void OnUserMicUpdate(ZegoRangeScene rangeScene,string userID,ZegoDeviceState state)IZegoRangeSceneStreamEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| rangeScene | ZegoRangeScene | Range scene instance that triggers this callback. |
| userID | string | User ID. |
| state | ZegoDeviceState | Device state. |
Details
User microphone state change callback. When to trigger: User microphone state change
- Restrictions: Do not call the SDK interface in the callback thread.Not available for WebGL.
OnUserCameraUpdate
public delegate void OnUserCameraUpdate(ZegoRangeScene rangeScene,string userID,ZegoDeviceState state)IZegoRangeSceneStreamEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| rangeScene | ZegoRangeScene | Range scene instance that triggers this callback. |
| userID | string | User ID. |
| state | ZegoDeviceState | Device state. |
Details
User camera state change callback. When to trigger: User camera state change.
- Restrictions: Do not call the SDK interface in the callback thread.Not available for WebGL.
OnUserSpeakerUpdate
public delegate void OnUserSpeakerUpdate(ZegoRangeScene rangeScene,string userID,ZegoDeviceState state)IZegoRangeSceneStreamEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| rangeScene | ZegoRangeScene | Range scene instance that triggers this callback. |
| userID | string | User ID. |
| state | ZegoDeviceState | Device state. |
Details
User speaker state change callback. When to trigger: User speaker state change.
- Restrictions: Do not call the SDK interface in the callback thread.Not available for WebGL.
IZegoRealTimeSequentialDataManagerHandler
Declared in IZegoRealTimeSequentialDataManagerHandler.cs
Methods
OnReceiveRealTimeSequentialData
public delegate void OnReceiveRealTimeSequentialData(ZegoRealTimeSequentialDataManager manager,IntPtr data,uint dataLength,string streamID)IZegoRealTimeSequentialDataManagerHandler.csParameters
| Name | Type | Description |
|---|---|---|
| manager | ZegoRealTimeSequentialDataManager | The real-time sequential data manager instance that triggers this callback. |
| data | IntPtr | The received real-time sequential data. |
| dataLength | uint | Data content length. |
| streamID | string | Subscribed stream ID |
Details
Through this callback, you can receive real-time sequential data from the current subscribing stream.
- Use cases: You need to listen to this callback when you need to receive real-time sequential data. When to trigger: After calling [startSubscribing] to successfully start the subscription, and when data is sent on the stream, this callback will be triggered.
- Caution: None.
- Available since: 2.14.0
- Restrictions: Not available for WebGL.
IZegoScreenCaptureSourceEventHandler
Declared in IZegoScreenCaptureSourceEventHandler.cs
Methods
OnAvailableFrame
public delegate void OnAvailableFrame(ZegoScreenCaptureSource source,System.IntPtr data,uint dataLength,ZegoVideoFrameParam param)IZegoScreenCaptureSourceEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| source | ZegoScreenCaptureSource | Callback screen capture source object. |
| data | System.IntPtr | The screen captures the data of the image frame (eg: RGBA only needs to consider data[0], I420 needs to consider data[0,1,2]). |
| dataLength | uint | Data length (eg: RGBA only needs to consider dataLength[0], I420 needs to consider dataLength[0,1,2]). |
| param | ZegoVideoFrameParam | Screen capture image frame parameters. |
Details
Callback for screen capture data.
- Trigger: This callback is fired after the screen starts capturing [startCapture].
- Caution: The callback does not actually take effect until call [setEventHandler] to set.
- Available since: 3.1.0
OnExceptionOccurred
public delegate void OnExceptionOccurred(ZegoScreenCaptureSource source,ZegoScreenCaptureSourceExceptionType exceptionType)IZegoScreenCaptureSourceEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| source | ZegoScreenCaptureSource | Callback screen capture source object. |
| exceptionType | ZegoScreenCaptureSourceExceptionType | Capture source exception type. |
Details
The callback triggered when a screen capture source exception occurred.
- Trigger: This callback is triggered when an exception occurs after the screen start capture.
- Caution: The callback does not actually take effect until call [setEventHandler] to set.
- Available since: 3.1.0
- Restrictions: Only available on Windows/macOS.
OnWindowStateChanged
public delegate void OnWindowStateChanged(ZegoScreenCaptureSource source,ZegoScreenCaptureWindowState windowState,ZegoRect windowRect)IZegoScreenCaptureSourceEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| source | ZegoScreenCaptureSource | Callback screen capture source object. |
| windowState | ZegoScreenCaptureWindowState | Capture window state. |
| windowRect | ZegoRect | Capture window rect. |
- Caution: The callback does not actually take effect until call [setEventHandler] to set.
- Available since: 3.4.0
- Restrictions: Only available on Windows/macOS.
OnRectChanged
public delegate void OnRectChanged(ZegoScreenCaptureSource source,ZegoRect captureRect)IZegoScreenCaptureSourceEventHandler.csParameters
| Name | Type | Description |
|---|---|---|
| source | ZegoScreenCaptureSource | Callback screen capture source object. |
| captureRect | ZegoRect | Capture source rect. |
- Caution: The callback does not actually take effect until call [setEventHandler] to set.
- Available since: 3.7.0
- Restrictions: Only available on Windows/macOS.
ZegoAudioEffectPlayer
Declared in ZegoAudioEffectPlayer.cs
Methods
Start
public abstract void Start(uint audioEffectID,string path,ZegoAudioEffectPlayConfig config)ZegoAudioEffectPlayer.csParameters
| Name | Type | Description |
|---|---|---|
| audioEffectID | uint | Description: ID for the audio effect. The SDK uses audioEffectID to control the playback of sound effects. The SDK does not force the user to pass in this parameter as a fixed value. It is best to ensure that each sound effect can have a unique ID. The recommended methods are static self-incrementing ID or the hash of the incoming sound effect file path. |
| path | string | The absolute path of the local resource. <br>Value range: "assets://"、"ipod-library://" and network url are not supported. Set path as null or "" if resource is loaded already using [loadResource]. |
| config | ZegoAudioEffectPlayConfig | Audio effect playback configuration. <br>Default value: Set NULL will only be played once, and will not be mixed into the publishing stream. |
Details
Start playing audio effect. The default is only played once and is not mixed into the publishing stream, if you want to change this please modify [config] param.
- Use cases: When you need to play short sound effects, such as applause, cheers, etc., you can use this interface to achieve, and further configure the number of plays through the [config] parameter, and mix the sound effects into the push stream.
- When to call: It can be called after [createAudioEffectPlayer].
- Available since: 1.16.0
- Restrictions: None.
Stop
public abstract void Stop(uint audioEffectID)ZegoAudioEffectPlayer.csParameters
| Name | Type | Description |
|---|---|---|
| audioEffectID | uint | ID for the audio effect. |
Details
Stop playing the specified audio effect [audioEffectID].
- When to call: The specified [audioEffectID] is [start].
- Available since: 1.16.0
- Restrictions: None.
Pause
public abstract void Pause(uint audioEffectID)ZegoAudioEffectPlayer.csParameters
| Name | Type | Description |
|---|---|---|
| audioEffectID | uint | ID for the audio effect. |
Details
Pause playing the specified audio effect [audioEffectID].
- When to call: The specified [audioEffectID] is [start].
- Available since: 1.16.0
- Restrictions: None.
Resume
public abstract void Resume(uint audioEffectID)ZegoAudioEffectPlayer.csParameters
| Name | Type | Description |
|---|---|---|
| audioEffectID | uint | ID for the audio effect. |
Details
Resume playing the specified audio effect [audioEffectID].
- When to call: The specified [audioEffectID] is [pause].
- Available since: 1.16.0
- Restrictions: None.
StopAll
public abstract void StopAll()ZegoAudioEffectPlayer.csStop playing all audio effect.
- When to call: Some audio effects are Playing.
- Available since: 1.16.0
- Restrictions: None.
PauseAll
public abstract void PauseAll()ZegoAudioEffectPlayer.csPause playing all audio effect.
- When to call: It can be called after [createAudioEffectPlayer].
- Available since: 1.16.0
- Restrictions: None.
ResumeAll
public abstract void ResumeAll()ZegoAudioEffectPlayer.csResume playing all audio effect.
- When to call: It can be called after [pauseAll].
- Available since: 1.16.0
- Restrictions: None.
SeekTo
public abstract void SeekTo(uint audioEffectID,ulong millisecond,OnAudioEffectPlayerSeekToCallback callback)ZegoAudioEffectPlayer.csParameters
| Name | Type | Description |
|---|---|---|
| audioEffectID | uint | ID for the audio effect. |
| millisecond | ulong | Point in time of specified playback progress. |
| callback | OnAudioEffectPlayerSeekToCallback | The result of seek. |
Details
Set the specified audio effect playback progress. Unit is millisecond.
- When to call: The specified [audioEffectID] is[start], and not finished.
- Available since: 1.16.0
- Restrictions: None.
SetVolume
public abstract void SetVolume(uint audioEffectID,int volume)ZegoAudioEffectPlayer.csParameters
| Name | Type | Description |
|---|---|---|
| audioEffectID | uint | ID for the audio effect. |
| volume | int | Volume. <br>Value range: The range is 0 ~ 200. <br>Default value: The default is 100. |
Details
Set volume for a single audio effect. Both the local play volume and the publish volume are set.
- When to call: The specified [audioEffectID] is [start].
- Available since: 1.16.0
- Restrictions: None.
SetVolumeAll
public abstract void SetVolumeAll(int volume)ZegoAudioEffectPlayer.csParameters
| Name | Type | Description |
|---|---|---|
| volume | int | Volume. <br>Value range: The range is 0 ~ 200. <br>Default value: The default is 100. |
Details
Set volume for all audio effect. Both the local play volume and the publish volume are set.
- When to call: It can be called after [createAudioEffectPlayer].
- Available since: 1.16.0
- Restrictions: None.
GetTotalDuration
public abstract ulong GetTotalDuration(uint audioEffectID)ZegoAudioEffectPlayer.csParameters
| Name | Type | Description |
|---|---|---|
| audioEffectID | uint | ID for the audio effect. |
Details
Get the total duration of the specified audio effect resource. Unit is millisecond.
- When to call: You should invoke this function after the audio effect resource already loaded, otherwise the return value is 0.
- Related APIs: [start], [loadResource].
- Available since: 1.16.0
- Restrictions: It can be called after [createAudioEffectPlayer].
Return
Unit is millisecond.
GetCurrentProgress
public abstract ulong GetCurrentProgress(uint audioEffectID)ZegoAudioEffectPlayer.csParameters
| Name | Type | Description |
|---|---|---|
| audioEffectID | uint | ID for the audio effect. |
Details
Get current playback progress of the specified audio effect. Unit is millisecond.
- When to call: You should invoke this function after the audio effect resource already loaded, otherwise the return value is 0.
- Related APIs: [start], [loadResource].
- Available since: 1.16.0
- Restrictions: None.
LoadResource
public abstract void LoadResource(uint audioEffectID,OnAudioEffectPlayerLoadResourceCallback onAudioEffectPlayerLoadResourceCallback,string path)ZegoAudioEffectPlayer.csParameters
| Name | Type | Description |
|---|---|---|
| audioEffectID | uint | ID for the audio effect. |
| onAudioEffectPlayerLoadResourceCallback | OnAudioEffectPlayerLoadResourceCallback | load audio effect resource result. |
| path | string | the absolute path of the audio effect resource and cannot be nil or "". <br>Value range: "assets://"、"ipod-library://" and network url are not supported. |
Details
Load audio effect resource.
- Use cases: In a scene where the same sound effect is played frequently, the SDK provides the function of preloading the sound effect file into the memory in order to optimize the performance of repeatedly reading and decoding the file.
- When to call: It can be called after [createAudioEffectPlayer].
- Available since: 1.16.0
- Restrictions: Preloading supports loading up to 15 sound effect files at the same time, and the duration of the sound effect files cannot exceed 30s, otherwise an error will be reported when loading.Not available for WebGL.
UnloadResource
public abstract void UnloadResource(uint audioEffectID)ZegoAudioEffectPlayer.csParameters
| Name | Type | Description |
|---|---|---|
| audioEffectID | uint | ID for the audio effect loaded. |
Details
Unload the specified audio effect resource.
- When to call: After the sound effects are used up, related resources can be released through this function; otherwise, the SDK will release the loaded resources when the AudioEffectPlayer instance is destroyed.
- Related APIs: [loadResource].
- Available since: 1.16.0
- Restrictions: Not available for WebGL.
UpdatePosition
public abstract void UpdatePosition(uint audioEffectID,float[] position)ZegoAudioEffectPlayer.csParameters
| Name | Type | Description |
|---|---|---|
| audioEffectID | uint | ID for the audio effect. |
| position | float[] | The unit vector of the front axis of its own coordinate system. The parameter is a float array with a length of 3. |
Details
Update the position of the audio effect player (audio source).
- Use cases: The audio effect player also needs to have 3D spatial sound.
- When to call: Listen to the [onAudioEffectPlayStateUpdate] callback, please call this interface after the player state is ZegoAudioEffectPlayState.Playing and before ZegoAudioEffectPlayState.NoPlay/PlayEnded.
- Available since: 3.6.0
- Restrictions: This interface needs to be used in conjunction with the RangeAudio/RangeScene module. This interface can only be called successfully after the RangeAudio/RangeScene module enables 3D sound effects.Not available for WebGL.
GetIndex
public abstract int GetIndex()ZegoAudioEffectPlayer.csGet audio effect player index.
- When to call: It can be called after [createAudioEffectPlayer].
- Available since: 1.16.0
- Restrictions: None.
Audio effect player index.
ZegoCopyrightedMusic
Declared in ZegoCopyrightedMusic.cs
Methods
InitCopyrightedMusic
public abstract void InitCopyrightedMusic(ZegoCopyrightedMusicConfig config,OnCopyrightedMusicInitCallback callback)ZegoCopyrightedMusic.csParameters
| Name | Type | Description |
|---|---|---|
| config | ZegoCopyrightedMusicConfig | the copyrighted music configuration. |
| callback | OnCopyrightedMusicInitCallback | init 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
public abstract ulong GetCacheSize()ZegoCopyrightedMusic.csWhen 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
public abstract void ClearCache()ZegoCopyrightedMusic.csWhen 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
public abstract void SendExtendedRequest(string command,string param,OnCopyrightedMusicSendExtendedRequestCallback callback)ZegoCopyrightedMusic.csParameters
| Name | Type | Description |
|---|---|---|
| command | string | request command, details about the commands supported. |
| param | string | request parameters, each request command has corresponding request parameters. |
| callback | OnCopyrightedMusicSendExtendedRequestCallback | send 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
public abstract void GetLrcLyric(string songID,ZegoCopyrightedMusicVendorID vendorID,OnCopyrightedMusicGetLrcLyricCallback callback)ZegoCopyrightedMusic.csParameters
| Name | Type | Description |
|---|---|---|
| songID | string | the ID of the song or accompaniment, the song and accompaniment of a song share the same ID. |
| vendorID | ZegoCopyrightedMusicVendorID | Copyright music resource song copyright provider. |
| callback | OnCopyrightedMusicGetLrcLyricCallback | get 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
GetLrcLyric
public abstract void GetLrcLyric(ZegoCopyrightedMusicGetLyricConfig config,OnCopyrightedMusicGetLrcLyricCallback callback)ZegoCopyrightedMusic.csParameters
| Name | Type | Description |
|---|---|---|
| config | ZegoCopyrightedMusicGetLyricConfig | The configuration of get lyric. |
| callback | OnCopyrightedMusicGetLrcLyricCallback | get lyrics result |
Details
Get lyrics in lrc format, support parsing lyrics line by line. Use case: Used to display lyrics line by line.
- When to call: After initializing the copyrighted music success [initCopyrightedMusic].
- Available since: 3.12.0
GetKrcLyricByToken
public abstract void GetKrcLyricByToken(string krcToken,OnCopyrightedMusicGetKrcLyricByTokenCallback callback)ZegoCopyrightedMusic.csParameters
| Name | Type | Description |
|---|---|---|
| krcToken | string | The krcToken obtained when calling [requestResource] for accompaniment or climax clips, or when obtaining shared resources through the [getSharedResource] interface. For more details, please refer to /online-ktv-ios/client-api/apis-to-obtain-songs-and-lyrics#2_2 |
| callback | OnCopyrightedMusicGetKrcLyricByTokenCallback | get lyrics result. |
Details
Get verbatim lyrics, support parsing lyrics word by word. Use case: Used to display lyrics word by word.
- When to call: After initializing the copyrighted music success [initCopyrightedMusic].
- Available since: 2.13.0
RequestResource
public abstract void RequestResource(ZegoCopyrightedMusicRequestConfig config,ZegoCopyrightedMusicResourceType type,OnCopyrightedMusicRequestResourceCallback callback)ZegoCopyrightedMusic.csParameters
| Name | Type | Description |
|---|---|---|
| config | ZegoCopyrightedMusicRequestConfig | The configuration of requesting music resource. |
| type | ZegoCopyrightedMusicResourceType | The resource type of music. |
| callback | OnCopyrightedMusicRequestResourceCallback | Callback of requesting music resource. |
Details
In addition to obtaining the basic information of the song (duration, song name, singer, etc.), and the most important resource id that can be used for local playback, there are also some related authentications information. Use case: Get copyrighted songs for local playback and sharing.
-
Related APIs: After a user in the room successfully calls this interface to request a music resource, other users in the room can call the [getsharedresource] interface to get the music resource for free once.
-
When to call: After initializing the copyrighted music [initCopyrightedMusic].
- Each resource has a unique resource ID.
- Every time this API is called, it will be billed once, please consult ZEGO business personnel for details.
- Each resource has a unique resource ID. The resources obtained by calling this API are time-sensitive, the valid duration is the minimum value between the SDK life cycle and 24-hour.
- Available since: 3.0.2
RequestResource
public abstract void RequestResource(ZegoCopyrightedMusicRequestConfigV2 config,OnCopyrightedMusicRequestResourceCallback callback)ZegoCopyrightedMusic.csParameters
| Name | Type | Description |
|---|---|---|
| config | ZegoCopyrightedMusicRequestConfigV2 | The configuration of requesting music resource. |
| callback | OnCopyrightedMusicRequestResourceCallback | Callback of requesting music resource. |
Details
In addition to obtaining the basic information of the song (duration, song name, singer, etc.), and the most important resource id that can be used for local playback, there are also some related authentications information. Use case: Get copyrighted songs for local playback and sharing.
-
Related APIs: After a user in the room successfully calls this interface to request a music resource, other users in the room can call the [getsharedresource] interface to get the music resource for free once.
-
When to call: After initializing the copyrighted music [initCopyrightedMusic].
- Each resource has a unique resource ID.
- Every time this API is called, it will be billed once, please consult ZEGO business personnel for details.
- Each resource has a unique resource ID. The resources obtained by calling this API are time-sensitive, the valid duration is the minimum value between the SDK life cycle and 24-hour.
- Available since: 3.12.0
GetSharedResource
public abstract void GetSharedResource(ZegoCopyrightedMusicGetSharedConfig config,ZegoCopyrightedMusicResourceType type,OnCopyrightedMusicGetSharedResourceCallback callback)ZegoCopyrightedMusic.csParameters
| Name | Type | Description |
|---|---|---|
| config | ZegoCopyrightedMusicGetSharedConfig | The configuration of getting shared music resource. |
| type | ZegoCopyrightedMusicResourceType | The resource type of music. |
| callback | OnCopyrightedMusicGetSharedResourceCallback | Callback of getting shared music resource. |
Details
In addition to obtaining the basic information of the song (duration, song name, singer, etc.), and the most important resource id that can be used for local playback, there are also some related authentications information. Use case: Get copyrighted songs for local playback.
- Related APIs: After a user in the room calls the [requestresource] interface to request a music resource successfully, other users in the room can call this interface to get the music resource for free once.
- When to call: After initializing the copyrighted music [initCopyrightedMusic]. Each resource has a unique resource ID. The resources obtained by calling this API are time-sensitive, the valid duration is the minimum value between the SDK life cycle and 24-hour.
- Available since: 3.0.2
GetSharedResource
public abstract void GetSharedResource(ZegoCopyrightedMusicGetSharedConfigV2 config,OnCopyrightedMusicGetSharedResourceCallback callback)ZegoCopyrightedMusic.csParameters
| Name | Type | Description |
|---|---|---|
| config | ZegoCopyrightedMusicGetSharedConfigV2 | The configuration of getting shared music resource. |
| callback | OnCopyrightedMusicGetSharedResourceCallback | Callback of getting shared music resource. |
Details
In addition to obtaining the basic information of the song (duration, song name, singer, etc.), and the most important resource id that can be used for local playback, there are also some related authentications information. Use case: Get copyrighted songs for local playback.
- Related APIs: After a user in the room calls the [requestresource] interface to request a music resource successfully, other users in the room can call this interface to get the music resource for free once.
- When to call: After initializing the copyrighted music [initCopyrightedMusic]. Each resource has a unique resource ID. The resources obtained by calling this API are time-sensitive, the valid duration is the minimum value between the SDK life cycle and 24-hour.
- Available since: 3.12.0
Download
public abstract void Download(string resourceID,OnCopyrightedMusicDownloadCallback callback)ZegoCopyrightedMusic.csParameters
| Name | Type | Description |
|---|---|---|
| resourceID | string | the resource ID corresponding to the song or accompaniment. |
| callback | OnCopyrightedMusicDownloadCallback | download song or accompaniment result. |
Details
Download music resource. It can only be played after downloading successfully. Use case: After obtaining the music resource authorization, use this interface to download the corresponding resources.
- When to call: After initializing the copyrighted music success [initCopyrightedMusic].
- Caution: Downloading copyrighted music resources is affected by the Internet.
- Available since: 2.13.0
CancelDownload
public abstract void CancelDownload(string resourceID)ZegoCopyrightedMusic.csParameters
| Name | Type | Description |
|---|---|---|
| resourceID | string | the resource ID corresponding to the song or accompaniment. |
Details
Cancel download of music resource. Use case: After starting to download music resources, use this interface to cancel the corresponding download task.
- When to call: After starting the download [download].
- Caution: When a valid resourceID is passed in, only unfinished download tasks will be cancelled. When empty is passed in, all unfinished download tasks will be canceled.
- Available since: 3.11.0
QueryCache
public abstract bool QueryCache(ZegoCopyrightedMusicQueryCacheConfig config)ZegoCopyrightedMusic.csParameters
| Name | Type | Description |
|---|---|---|
| config | ZegoCopyrightedMusicQueryCacheConfig | The configuration of querying cache. |
Details
Query the resource is existed or not, query the Yinsuda resource cache by default Use case: Can be used to check the resource's cache is existed or not
- When to call: After initializing the copyrighted music success [initCopyrightedMusic].
- Available since: 3.9.0
QueryCache
public abstract bool QueryCache(ZegoCopyrightedMusicQueryCacheConfigV2 config)ZegoCopyrightedMusic.csParameters
| Name | Type | Description |
|---|---|---|
| config | ZegoCopyrightedMusicQueryCacheConfigV2 | The configuration of querying cache. |
Details
Query the resource is existed or not, query the Yinsuda resource cache by default Use case: Can be used to check the resource's cache is existed or not
- When to call: After initializing the copyrighted music success [initCopyrightedMusic].
- Available since: 3.12.0
GetDuration
public abstract ulong GetDuration(string resourceID)ZegoCopyrightedMusic.csParameters
| Name | Type | Description |
|---|---|---|
| resourceID | string | the resource ID corresponding to the song or accompaniment. |
Details
Get the playing time of a song or accompaniment file. Use case: Can be used to display the playing time information of the song or accompaniment on the view.
- When to call: After initializing the copyrighted music success [initCopyrightedMusic].
- Available since: 2.13.0
SetScoringLevel
public abstract void SetScoringLevel(int level)ZegoCopyrightedMusic.csParameters
| Name | Type | Description |
|---|---|---|
| level | int | The difficulty level of scoring. The level ranges from 0 to 4. The scoring difficulty decreases from 0 to 4. |
Details
Users can set the scoring difficulty level through this function.
- When to call: After calling [initCopyrightedMusic] to initialize copyrighted music successfully, call [startScore] to start scoring.
- Default value: When this function is not called, the difficulty level of scoring is 4.
- Available since: 2.22.0
- Restrictions: This function does not support dynamic settings. After calling this function successfully, the next call to [startScore] will take effect.
StartScore
public abstract int StartScore(string resourceID,int pitchValueInterval)ZegoCopyrightedMusic.csParameters
| Name | Type | Description |
|---|---|---|
| resourceID | string | the resource ID corresponding to the accompaniment or accompaniment clip. |
| pitchValueInterval | int | the time interval of real-time pitch line callback, in milliseconds, the default is 50 milliseconds. |
Details
Start the scoring function.After starting scoring, the scoring result OnCurrentPitchValueUpdate callback will be received according to the set callback time interval. Use case: Can be used to display the singing score on the view.
- When to call: After obtaining verbatim lyrics and playing the accompaniment resources of copyrighted music.
- Available since: 2.15.0
- Restrictions: Only support use this api after [startPublishingStream].
PauseScore
public abstract int PauseScore(string resourceID)ZegoCopyrightedMusic.csParameters
| Name | Type | Description |
|---|---|---|
| resourceID | string | the resource ID corresponding to the accompaniment or accompaniment clip. |
Details
Pause ongoing scoring,will stop the [OnCurrentPitchValueUpdate] callback. Use case: You can call this interface to pause the scoring function while scoring.
- When to call: It can be called while grading.
- Available since: 2.15.0
ResumeScore
public abstract int ResumeScore(string resourceID)ZegoCopyrightedMusic.csParameters
| Name | Type | Description |
|---|---|---|
| resourceID | string | the resource ID corresponding to the accompaniment or accompaniment clip. |
Details
Resume currently paused scoring. Use case: When there is currently paused scoring, this interface can be called to resume the scoring function.
- When to call: It can be called when there is currently a paused scoring.
- Available since: 2.15.0
StopScore
public abstract int StopScore(string resourceID)ZegoCopyrightedMusic.csParameters
| Name | Type | Description |
|---|---|---|
| resourceID | string | the resource ID corresponding to the accompaniment or accompaniment clip. |
Details
End the current rating.The [OnCurrentPitchValueUpdate] callback will be stopped, but the average or total score can still be obtained normally. Use case: You can call this interface to end the scoring while scoring.
- When to call: It can be called while grading.
- Available since: 2.15.0
ResetScore
public abstract int ResetScore(string resourceID)ZegoCopyrightedMusic.csParameters
| Name | Type | Description |
|---|---|---|
| resourceID | string | the resource ID corresponding to the accompaniment or accompaniment clip. |
Details
Reset the scores that have already been performed,The [OnCurrentPitchValueUpdate] callback will be stopped and the average or total score will be 0. Use case: Often used in scenes where the same song is re-sung.
- When to call: It can be called after scoring has been performed.
- Available since: 2.15.0
GetPreviousScore
public abstract int GetPreviousScore(string resourceID)ZegoCopyrightedMusic.csParameters
| Name | Type | Description |
|---|---|---|
| resourceID | string | the resource ID corresponding to the accompaniment or accompaniment clip. |
Details
Get the score of the previous sentence. Use case: Can be used to display the score of each sentence on the view.
- When to call: It can be called after playing the copyright accompaniment or accompaniment clip and starting to score.
- Available since: 2.15.0
GetAverageScore
public abstract int GetAverageScore(string resourceID)ZegoCopyrightedMusic.csParameters
| Name | Type | Description |
|---|---|---|
| resourceID | string | the resource ID corresponding to the accompaniment or accompaniment clip. |
Details
Get the average score. Use case: Can be used to display the average score on the view.
- When to call: It can be called after playing the copyright accompaniment or accompaniment clip and starting to score.
- Available since: 2.15.0
GetTotalScore
public abstract int GetTotalScore(string resourceID)ZegoCopyrightedMusic.csParameters
| Name | Type | Description |
|---|---|---|
| resourceID | string | the resource ID corresponding to the accompaniment or accompaniment clip. |
Details
Get the total score. Use case: Can be used to display the total score on the view.
- When to call: It can be called after playing the copyright accompaniment or accompaniment clip and starting to score.
- Available since: 2.15.0
GetFullScore
public abstract int GetFullScore(string resourceID)ZegoCopyrightedMusic.csParameters
| Name | Type | Description |
|---|---|---|
| resourceID | string | the resource ID corresponding to the accompaniment or accompaniment clip. |
Details
Get the full score. Use case: Can be used to display the full score on the view.
- When to call: It can be called after playing the copyright accompaniment or accompaniment clip and starting to score.
- Available since: 3.0.2
GetStandardPitch
public abstract void GetStandardPitch(string resourceID,OnCopyrightedMusicGetStandardPitchCallback callback)ZegoCopyrightedMusic.csParameters
| Name | Type | Description |
|---|---|---|
| resourceID | string | the resource ID corresponding to the accompaniment or accompaniment clip. |
| callback | OnCopyrightedMusicGetStandardPitchCallback | get standard pitch data result. |
Details
Get standard pitch data. Use case: Can be used to display standard pitch lines on the view.
- Caution: Only accompaniment or climactic clip assets have pitch lines.
- Available since: 2.15.0
GetCurrentPitch
public abstract int GetCurrentPitch(string resourceID)ZegoCopyrightedMusic.csParameters
| Name | Type | Description |
|---|---|---|
| resourceID | string | the resource ID corresponding to the song or accompaniment. |
Details
Get real-time pitch data. Use case: Can be used to display real-time pitch lines on the view.
- When to call: It can be called after playing the copyright accompaniment or accompaniment clip and starting to score.
- Available since: 2.15.0
RequestSong
public abstract void RequestSong(ZegoCopyrightedMusicRequestConfig config,OnCopyrightedMusicRequestSongCallback callback)ZegoCopyrightedMusic.csParameters
| Name | Type | Description |
|---|---|---|
| config | ZegoCopyrightedMusicRequestConfig | request configuration. |
| callback | OnCopyrightedMusicRequestSongCallback | request 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
RequestAccompaniment
public abstract void RequestAccompaniment(ZegoCopyrightedMusicRequestConfig config,OnCopyrightedMusicRequestAccompanimentCallback callback)ZegoCopyrightedMusic.csParameters
| Name | Type | Description |
|---|---|---|
| config | ZegoCopyrightedMusicRequestConfig | request configuration. |
| callback | OnCopyrightedMusicRequestAccompanimentCallback | request 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
RequestAccompanimentClip
public abstract void RequestAccompanimentClip(ZegoCopyrightedMusicRequestConfig config,OnCopyrightedMusicRequestAccompanimentClipCallback callback)ZegoCopyrightedMusic.csParameters
| Name | Type | Description |
|---|---|---|
| config | ZegoCopyrightedMusicRequestConfig | request configuration. |
| callback | OnCopyrightedMusicRequestAccompanimentClipCallback | request accompaniment clip result. |
Details
You can get the accompaniment clip resources of the song corresponding to the songID, including resource_id, krc_token, share_token, etc. Supports accompaniment clips by pay-per-use. Use case: Get copyrighted accompaniment clip for local playback and sharing.
- When to call: After initializing the copyrighted music success [initCopyrightedMusic].
- Caution: This interface will trigger billing.
- Available since: 2.13.0
GetMusicByToken
public abstract void GetMusicByToken(string shareToken,OnCopyrightedMusicGetMusicByTokenCallback callback)ZegoCopyrightedMusic.csParameters
| Name | Type | Description |
|---|---|---|
| shareToken | string | access the corresponding authorization token for a song or accompaniment. |
| callback | OnCopyrightedMusicGetMusicByTokenCallback | get 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
GetLrcLyric
public abstract void GetLrcLyric(string songID,OnCopyrightedMusicGetLrcLyricCallback callback)ZegoCopyrightedMusic.csParameters
| Name | Type | Description |
|---|---|---|
| songID | string | the ID of the song or accompaniment, the song and accompaniment of a song share the same ID. |
| callback | OnCopyrightedMusicGetLrcLyricCallback | get 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
QueryCache
public abstract bool QueryCache(string songID,ZegoCopyrightedMusicType type)ZegoCopyrightedMusic.csParameters
| Name | Type | Description |
|---|---|---|
| songID | string | the ID of the song or accompaniment, the song and accompaniment of a song share the same ID. |
| type | ZegoCopyrightedMusicType | the song resource type. |
Details
Query the resource is existed or not. Use case: Can be used to check the resource's cache is existed or not
- When to call: After initializing the copyrighted music success [initCopyrightedMusic].
- Available since: 2.13.0
QueryCache
public abstract bool QueryCache(string songID,ZegoCopyrightedMusicType type,ZegoCopyrightedMusicVendorID vendorID)ZegoCopyrightedMusic.csParameters
| Name | Type | Description |
|---|---|---|
| songID | string | the ID of the song or accompaniment, the song and accompaniment of a song share the same ID. |
| type | ZegoCopyrightedMusicType | the song resource type. |
| vendorID | ZegoCopyrightedMusicVendorID | Copyright music resource song copyright provider. |
Details
Query the resource is existed or not, query the Yinsuda resource cache by default Use case: Can be used to check the resource's cache is existed or not
- When to call: After initializing the copyrighted music success [initCopyrightedMusic].
- Available since: 3.2.1
ZegoExpressEngine
Declared in ZegoExpressEngine.cs
Methods
CreateEngine
public static ZegoExpressEngine CreateEngine(ZegoEngineProfile profile)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| profile | ZegoEngineProfile | The basic configuration information is used to create the engine. |
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
public static void DestroyEngine(IZegoDestroyCompletionCallback onDestroyCompletion)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| onDestroyCompletion | IZegoDestroyCompletionCallback | Notification 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
public static ZegoExpressEngine GetEngine()ZegoExpressEngine.csIf 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
public static void SetEngineConfig(ZegoEngineConfig config)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| config | ZegoEngineConfig | Advanced engine configuration |
Details
Used to enable advanced functions.
- When to call: Different configurations have different call timing requirements. For details, please consult ZEGO technical support.
- Available since: 1.1.0
- Restrictions: None.
SetLogConfig
public static void SetLogConfig(ZegoLogConfig config)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| config | ZegoLogConfig | log configuration. |
Details
If you need to customize the log file size and path, please call this function to complete the configuration.
- When to call: It must be set before calling [createEngine] to take effect. If it is set after [createEngine], it will take effect at the next [createEngine] after [destroyEngine].
- Caution: Once this interface is called, the method of setting log size and path via [setEngineConfig] will be invalid.Therefore, it is not recommended to use [setEngineConfig] to set the log size and path.
- Available since: 2.3.0
- Restrictions: Not available for WebGL.
SetLocalProxyConfig
public static void SetLocalProxyConfig(List<ZegoProxyInfo> proxyList,bool enable)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| proxyList | List<ZegoProxyInfo> | proxy info. |
| enable | bool | enable proxy or not. |
Details
If you need to use the local proxy feature, please call this function to complete the configuration.
- When to call: Must be set before calling [createEngine] to take effect, otherwise it will fail.
- Caution: None.
- Available since: 3.1.0
- Restrictions: After [createEngine], can not change the proxy.Not available for WebGL.
SetCloudProxyConfig
public static void SetCloudProxyConfig(List<ZegoProxyInfo> proxyList,string token,bool enable)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| proxyList | List<ZegoProxyInfo> | proxy info. |
| token | string | token. if use appsign auth, ignore. |
| enable | bool | enable proxy or not. |
Details
If you need to use the cloud proxy feature, please call this function to complete the configuration.
- When to call: Must be set before calling [createEngine] to take effect, otherwise it will fail.
- Caution: None.
- Available since: 3.1.0
- Restrictions: After [createEngine], can not change the proxy.Not available for WebGL
SetRoomMode
public static void SetRoomMode(ZegoRoomMode mode)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| mode | ZegoRoomMode | Room 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
public static string GetVersion()ZegoExpressEngine.csIf 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.
IsFeatureSupported
public static bool IsFeatureSupported(ZegoFeatureType featureType)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| featureType | ZegoFeatureType | Type of feature to query. |
Details
Since the SDK supports feature trimming, some features may be trimmed; you can use this function to quickly determine whether the current SDK supports the specified features, such as querying whether the media player feature is supported.
- When to call: Any time.
- Available since: 2.22.0
- Restrictions: Not available for WebGL.
Return
Whether the specified feature is supported. true: supported; false: not supported.
SubmitLog
public static void SubmitLog()ZegoExpressEngine.csBy 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
public static ZegoExpressEngine CreateEngine(uint appID,string appSign,bool isTestEnv,ZegoScenario scenario)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| appID | uint | Application ID issued by ZEGO for developers, please apply from the ZEGO Admin Console https://console.zegocloud.com The value ranges from 0 to 4294967295. |
| appSign | string | Application signature for each AppID, please apply from the ZEGO Admin Console. Application signature is a 64 character string. Each character has a range of '0' ~ '9', 'a' ~ 'z'. AppSign 2.17.0 and later allows null or no transmission. If the token is passed empty or not passed, the token must be entered in the [ZegoRoomConfig] parameter for authentication when the [loginRoom] interface is called to login to the room. |
| isTestEnv | bool | [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. |
| scenario | ZegoScenario | The room scenario. the SDK will optimize the audio and video configuration for the specified scenario to achieve the best effect in this scenario. After specifying the scenario, you can call other APIs to adjusting the audio and video configuration. Differences between scenarios and how to choose a suitable scenario, please refer to https://docs.zegocloud.com/article/14940 |
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.
Return
Engine singleton instance.
SetRoomScenario
public abstract void SetRoomScenario(ZegoScenario scenario)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| scenario | ZegoScenario | Room scenario. |
Details
You can set the scenario of the room, and the SDK will adopt different optimization strategies for different scenarios in order to obtain better effects; this function does exactly the same thing as the [scenario] parameter in the [profile] configuration of [createEngine].
- Use cases: This function is suitable for apps in various audio and video business scenarios, such as 1v1 video call (or voice call) scenario and live show scenario; this function can be used to switch scenarios without destroying the engine through [destroyEngine].
- When to call: Must be set before calling [loginRoom] AND after calling [createEngine].
- Caution: 1. Users in the same room are recommended to use the same room scenario for best results. 2. Setting the scenario will affect the audio and video bit rate, frame rate, resolution, codec id, audio device mode, audio route type, traffic control, 3A, ear return and other audio and video configurations. If you have special needs, you can call various other APIs to set the above configuration after calling this API. 3. Calling this function will override the scenario specified on [createEngine] or the scenario set by the last call to this function. 4. Calling this function will overwrite the audio and video related configuration you set through APIs such as [setVideoConfig], [setAudioConfig], so it is recommended to set the scenario first and then adjust the audio and video configuration through other APIs.
- Available since: 3.0.0
- Restrictions: Once you log in to the room, you are no longer allowed to modify the room scenario. If you need to modify the scenario, you need to log out of the room first. If you log in to multiple rooms, you need to log out of all rooms before you can modify it.
UploadLog
public abstract void UploadLog()ZegoExpressEngine.csBy 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
public abstract void EnableDebugAssistant(bool enable)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| enable | bool | Whether 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.
CallExperimentalAPI
public abstract string CallExperimentalAPI(string param)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| param | string | Parameters in the format of a JSON string, please consult ZEGO technical support for details. |
Details
ZEGO provides some technical previews or special customization functions in RTC business through this API. If you need to get the use of the function or the details, please consult ZEGO technical support.
- When to call: After [createEngine].
- Available since: 2.7.0
- Restrictions: Not available for WebGL.
Return
Returns an argument in the format of a JSON string, please consult ZEGO technical support for details.
CheckSystemRequirements
public abstract void CheckSystemRequirements(OnCheckSystemRequirementsResult callback,string checkType,int checkLevel)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| callback | OnCheckSystemRequirementsResult | Detection result. |
| checkType | string | Specify to check the capabilities that a browser can support, such as: webRTC, VP8, etc. This parameter is not passed by default to check all supported capabilities. |
| checkLevel | int | Available values 0 and 1. For the level of detection coding format, 0 means fast detection with high accuracy; 1 means accurate detection with long time consuming and higher accuracy. |
Details
Support capability detection interface. Use case: functions in audio and video are only supported by newer versions of mainstream browsers, and can be detected through this interface.
- When to call: After initialization, it is called before creating the stream.
- Restrictions: Only supported on the web.
LoginRoom
public abstract void LoginRoom(string roomID,ZegoUser user,ZegoRoomConfig config)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| roomID | string | Room ID, a string of less 128 bytes in length. Caution: 1. room ID is defined by yourself. 2. Only support numbers, English characters and '~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', '=', '-', '`', ';', '’', ',', '.', '<', '>', ''. 3. If you need to communicate with the Web SDK, please do not use '%'. |
| user | ZegoUser | User object instance, configure userID, userName. Note that the userID needs to be globally unique with the same appID, otherwise the user who logs in later will kick out the user who logged in first. |
| config | ZegoRoomConfig | Advanced room configuration. |
Details
If the room does not exist, [loginRoom] creates and logs in the room. SDK uses the 'room' to organize users. After users log in to a room, they can use interface such as push stream [startPublishingStream], pull stream [startPlayingStream], send and receive broadcast messages [sendBroadcastMessage], etc. To prevent the app from being impersonated by a malicious user, you can add authentication before logging in to the room, that is, the [token] parameter in the ZegoRoomConfig object passed in by the [config] parameter.
- Use cases: In the same room, users can conduct live broadcast, audio and video calls, etc.
- When to call /Trigger: This interface is called after [createEngine] initializes the SDK.
- Caution: 1. Apps that use different appIDs cannot intercommunication with each other. 2. SDK supports startPlayingStream audio and video streams from different rooms under the same appID, that is, startPlayingStream audio and video streams across rooms. Since ZegoExpressEngine's room related callback notifications are based on the same room, when developers want to startPlayingStream streams across rooms, developers need to maintain related messages and signaling notifications by themselves. 3. It is strongly recommended that userID corresponds to the user ID of the business APP, that is, a userID and a real user are fixed and unique, and should not be passed to the SDK in a random userID. Because the unique and fixed userID allows ZEGO technicians to quickly locate online problems. 4. After the first login failure due to network reasons or the room is disconnected, the default time of SDK reconnection is 20min.
- Privacy reminder: Please do not fill in sensitive user information in this interface, including but not limited to mobile phone number, ID number, passport number, real name, etc.
- Related callbacks: 1. When the user starts to log in to the room, the room is successfully logged in, or the room fails to log in, the [onRoomStateChanged] (Not supported before 2.18.0, please use [onRoomStateUpdate]) callback will be triggered to notify the developer of the status of the current user connected to the room. 2. Different users who log in to the same room can get room related notifications in the same room (eg [onRoomUserUpdate], [onRoomStreamUpdate], etc.), and users in one room cannot receive room signaling notifications in another room. 3. If the network is temporarily interrupted due to network quality reasons, the SDK will automatically reconnect internally. You can get the current connection status of the local room by listening to the [onRoomStateChanged] (Not supported before 2.18.0, please use [onRoomStateUpdate]) callback method, and other users in the same room will receive [onRoomUserUpdate] callback notification. 4. Messages sent in one room (e.g. [setStreamExtraInfo], [sendBroadcastMessage], [sendBarrageMessage], [sendCustomCommand], etc.) cannot be received callback ((eg [onRoomStreamExtraInfoUpdate], [onIMRecvBroadcastMessage], [onIMRecvBarrageMessage], [onIMRecvCustomCommand], etc) in other rooms. Currently, SDK does not provide the ability to send messages across rooms. Developers can integrate the SDK of third-party IM to achieve.
- Related APIs: 1. Users can call [logoutRoom] to log out. In the case that a user has successfully logged in and has not logged out, if the login interface is called again, the console will report an error and print the error code 1002001. 2. SDK supports multi-room login, please call [setRoomMode] function to select multi-room mode before engine initialization, and then call [loginRoom] to log in to multi-room. 3. Calling [destroyEngine] will also automatically log out.
- Available since: 1.1.0
- Restrictions: For restrictions on the use of this function, please refer to https://docs.zegocloud.com/article/7611 or contact ZEGO technical support.
LoginRoom
public abstract void LoginRoom(string roomID,ZegoUser user,ZegoRoomConfig config,OnRoomLoginResult callback)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| roomID | string | Room ID, a string of less 128 bytes in length. Caution: 1. room ID is defined by yourself. 2. Only support numbers, English characters and '~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', '=', '-', '`', ';', '’', ',', '.', '<', '>', ''. 3. If you need to communicate with the Web SDK, please do not use '%'. |
| user | ZegoUser | User object instance, configure userID, userName. Note that the userID needs to be globally unique with the same appID, otherwise the user who logs in later will kick out the user who logged in first. |
| config | ZegoRoomConfig | Advanced room configuration. |
| callback | OnRoomLoginResult | The callback of this login result, if you need detailed room status, please pay attention to the [onRoomStateChanged] callback. Required: No. Default value: null.Caution: If the connection is retried multiple times due to network problems, the retry status will not be thrown by this callback. |
Details
If the room does not exist, [loginRoom] creates and logs in the room. SDK uses the 'room' to organize users. After users log in to a room, they can use interface such as push stream [startPublishingStream], pull stream [startPlayingStream], send and receive broadcast messages [sendBroadcastMessage], etc. To prevent the app from being impersonated by a malicious user, you can add authentication before logging in to the room, that is, the [token] parameter in the ZegoRoomConfig object passed in by the [config] parameter.
- Use cases: In the same room, users can conduct live broadcast, audio and video calls, etc.
- When to call /Trigger: This interface is called after [createEngine] initializes the SDK.
- Caution: 1. Apps that use different appIDs cannot intercommunication with each other. 2. SDK supports startPlayingStream audio and video streams from different rooms under the same appID, that is, startPlayingStream audio and video streams across rooms. Since ZegoExpressEngine's room related callback notifications are based on the same room, when developers want to startPlayingStream streams across rooms, developers need to maintain related messages and signaling notifications by themselves. 3. It is strongly recommended that userID corresponds to the user ID of the business APP, that is, a userID and a real user are fixed and unique, and should not be passed to the SDK in a random userID. Because the unique and fixed userID allows ZEGO technicians to quickly locate online problems. 4. After the first login failure due to network reasons or the room is disconnected, the default time of SDK reconnection is 20min.
- Privacy reminder: Please do not fill in sensitive user information in this interface, including but not limited to mobile phone number, ID number, passport number, real name, etc.
- Related callbacks: 1. When the user starts to log in to the room, the room is successfully logged in, or the room fails to log in, the [onRoomStateChanged] (Not supported before 2.18.0, please use [onRoomStateUpdate]) callback will be triggered to notify the developer of the status of the current user connected to the room. 2. Different users who log in to the same room can get room related notifications in the same room (eg [onRoomUserUpdate], [onRoomStreamUpdate], etc.), and users in one room cannot receive room signaling notifications in another room. 3. If the network is temporarily interrupted due to network quality reasons, the SDK will automatically reconnect internally. You can get the current connection status of the local room by listening to the [onRoomStateChanged] (Not supported before 2.18.0, please use [onRoomStateUpdate]) callback method, and other users in the same room will receive [onRoomUserUpdate] callback notification. 4. Messages sent in one room (e.g. [setStreamExtraInfo], [sendBroadcastMessage], [sendBarrageMessage], [sendCustomCommand], etc.) cannot be received callback ((eg [onRoomStreamExtraInfoUpdate], [onIMRecvBroadcastMessage], [onIMRecvBarrageMessage], [onIMRecvCustomCommand], etc) in other rooms. Currently, SDK does not provide the ability to send messages across rooms. Developers can integrate the SDK of third-party IM to achieve.
- Related APIs: 1. Users can call [logoutRoom] to log out. In the case that a user has successfully logged in and has not logged out, if the login interface is called again, the console will report an error and print the error code 1002001. 2. SDK supports multi-room login, please call [setRoomMode] function to select multi-room mode before engine initialization, and then call [loginRoom] to log in to multi-room. 3. Calling [destroyEngine] will also automatically log out.
- Available since: 2.18.0
- Restrictions: For restrictions on the use of this function, please refer to https://docs.zegocloud.com/article/7611 or contact ZEGO technical support.
LogoutRoom
public abstract void LogoutRoom(OnRoomLogoutResult callback)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| callback | OnRoomLogoutResult | The callback of this logout room result, if you need detailed room status, please pay attention to the [onRoomStateChanged] callback. Required: No. Default value: null. |
Details
This API will log out the current user has logged in the room, if user logs in more than one room, all the rooms will be logged out.
- Use cases: In the same room, users can conduct live broadcast, audio and video calls, etc.
- When to call /Trigger: After successfully logging in to the room, if the room is no longer used, the user can call the function [logoutRoom].
- Caution: 1. Exiting the room will stop all publishing and playing streams for user, and inner audio and video engine will stop, and then SDK will auto stop local preview UI. If you want to keep the preview ability when switching rooms, please use the [switchRoom] method. 2. If the user is not logged in to the room, calling this function will also return success.
- Related callbacks: After calling this function, you will receive [onRoomStateChanged] (Not supported before 2.18.0, please use [onRoomStateUpdate]) callback notification successfully exits the room, while other users in the same room will receive the [onRoomUserUpdate] callback notification(On the premise of enabling isUserStatusNotify configuration).
- Related APIs: Users can use [loginRoom], [switchRoom] functions to log in or switch rooms.
- Available since: 2.9.0
- Restrictions: None.
LogoutRoom
public abstract void LogoutRoom(string roomID,OnRoomLogoutResult callback)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| roomID | string | Room ID, a string of up to 128 bytes in length. Caution: 1. Only support numbers, English characters and '~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', '=', '-', '`', ';', '’', ',', '.', '<', '>', ''. 2. If you need to communicate with the Web SDK, please do not use '%'. |
| callback | OnRoomLogoutResult | The callback of this logout room result, if you need detailed room status, please pay attention to the [onRoomStateChanged] callback. Required: No. Default value: null. |
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
public abstract void SwitchRoom(string fromRoomID,string toRoomID,ZegoRoomConfig config)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| fromRoomID | string | Current roomID. |
| toRoomID | string | The next roomID. |
| config | ZegoRoomConfig | Advanced room configuration. |
Details
Using this interface allows users to quickly switch from one room to another room.
- Use cases: if you need to quickly switch to the next room, you can call this function.
- When to call /Trigger: After successfully login room.
- Caution: 1. When this function is called, all streams currently publishing or playing will stop (but the local preview will not stop). 2. To prevent the app from being impersonated by a malicious user, you can add authentication before logging in to the room, that is, the [token] parameter in the ZegoRoomConfig object passed in by the [config] parameter. This parameter configuration affects the room to be switched over. 3. Multi-room mode is supported in version 3.5.0 (use the function [setRoomMode] to set ZegoRoomMode to ZEGO_ROOM_MODE_MULTI_ROOM). 4. If a Token is passed in for login when logging into the room [loginRoom], the [switchroom] interface must be used with the config parameter and the corresponding Token value passed in when switching rooms.
- Privacy reminder: Please do not fill in sensitive user information in this interface, including but not limited to mobile phone number, ID number, passport number, real name, etc.
- Related callbacks: When the user call the [switchRoom] function, the [onRoomStateChanged] (Not supported before 2.18.0, please use [onRoomStateUpdate]) callback will be triggered to notify the developer of the status of the current user connected to the room.
- Related APIs: Users can use the [logoutRoom] function to log out of the room.
- Available since: 1.15.0
- Restrictions: None.
RenewToken
public abstract void RenewToken(string roomID,string token)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| roomID | string | Room ID. |
| token | string | The token that needs to be renew. |
Details
After the developer receives [onRoomTokenWillExpire], they can use this API to update the token to ensure that the subsequent RTC functions are normal.
- Use cases: Used when the token is about to expire.
- When to call /Trigger: After the developer receives [onRoomTokenWillExpire].
- Caution: The token contains important information such as the user's room permissions, publish stream permissions, and effective time, please refer to https://docs.zegocloud.com/article/11649.
- Related callbacks: None.
- Related APIs: None.
- Available since: 2.8.0
- Restrictions: None.
SetRoomExtraInfo
public abstract void SetRoomExtraInfo(string roomID,OnRoomSetRoomExtraInfoResult onRoomSetRoomExtraInfoResult,string key,string value)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| roomID | string | Room ID. |
| onRoomSetRoomExtraInfoResult | OnRoomSetRoomExtraInfoResult | Callback for setting room extra information. |
| key | string | key of the extra info. |
| value | string | value 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.
- Available since: 1.13.0
- Restrictions: For restrictions on the use of this function, please refer to https://docs.zegocloud.com/article/7611 or contact ZEGO technical support.
StartPublishingStream
public abstract void StartPublishingStream(string streamID,ZegoPublishChannel channel)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| streamID | string | Stream ID, a string of up to 256 characters. Caution: 1. Stream ID is defined by you. 2. needs to be globally unique within the entire AppID. If in the same AppID, different users publish each stream and the stream ID is the same, which will cause the user to publish the stream failure. You cannot include URL keywords, otherwise publishing stream and playing stream will fails. 3. Only support numbers, English characters and '-', '_'. |
| channel | ZegoPublishChannel | Publish 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
public abstract void StartPublishingStream(string streamID,ZegoPublisherConfig config,ZegoPublishChannel channel)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| streamID | string | Stream ID, a string of up to 256 characters. Caution: 1. Stream ID is defined by you. 2. needs to be globally unique within the entire AppID. If in the same AppID, different users publish each stream and the stream ID is the same, which will cause the user to publish the stream failure. You cannot include URL keywords, otherwise publishing stream and playing stream will fails. 3. Only support numbers, English characters and '-', '_'. |
| config | ZegoPublisherConfig | Advanced publish configuration. |
| channel | ZegoPublishChannel | Publish stream channel. |
Details
Users push their local audio and video streams to the ZEGO RTC server or CDN, and other users in the same room can pull the audio and video streams to watch through the streamID or CDN pull stream address.
- Use cases: It can be used to publish streams in real-time connecting wheat, live broadcast and other scenarios.
- When to call: After [loginRoom].
- Caution: 1. Before start to publish the stream, the user can choose to call [setVideoConfig] to set the relevant video parameters, and call [startPreview] to preview the video. 2. Other users in the same room can get the streamID by monitoring the [onRoomStreamUpdate] event callback after the local user publishing stream successfully. 3. In the case of poor network quality, user publish may be interrupted, and the SDK will attempt to reconnect. You can learn about the current state and error information of the stream published by monitoring the [onPublisherStateUpdate] event. 4. To call [SetRoomMode] function to select multiple rooms, the room ID must be specified explicitly.
- Available since: 1.1.0
- Restrictions: None.
StartPublishingStreamInScene
public abstract void StartPublishingStreamInScene(string streamID,ZegoPublishChannel channel,ZegoScenePublisherConfig config)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| streamID | string | Stream ID, a string of up to 256 characters. Caution: 1. Stream ID is defined by you. 2. needs to be globally unique within the entire AppID. If in the same AppID, different users publish each stream and the stream ID is the same, which will cause the user to publish the stream failure. You cannot include URL keywords, otherwise publishing stream and playing stream will fails. 3. Only support numbers, English characters and '-', '_'. |
| channel | ZegoPublishChannel | Publish stream channel. |
| config | ZegoScenePublisherConfig | Advanced scene publish configuration. |
Details
Users push their local audio and video streams to the ZEGO RTC server.
- Use cases: Starts publishing a stream in RangeScene scene.
- When to call: After [loginScene].
- Caution: None.
- Available since: 3.0.0
- Restrictions: Not available for WebGL.
StopPublishingStream
public abstract void StopPublishingStream(ZegoPublishChannel channel)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| channel | ZegoPublishChannel | Publish 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
public abstract void SetStreamExtraInfo(string extraInfo,OnPublisherSetStreamExtraInfoResult onPublisherSetStreamExtraInfoResult,ZegoPublishChannel channel)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| extraInfo | string | Stream extra information, a string of up to 1024 characters. |
| onPublisherSetStreamExtraInfoResult | OnPublisherSetStreamExtraInfoResult | Set stream extra information execution result notification. |
| channel | ZegoPublishChannel | Publish 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
public abstract void StartPreview(ZegoPublishChannel channel)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| channel | ZegoPublishChannel | Publish 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
public abstract void StopPreview(ZegoPublishChannel channel)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| channel | ZegoPublishChannel | Publish 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
public abstract void SetVideoConfig(ZegoVideoConfig config,ZegoPublishChannel channel)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| config | ZegoVideoConfig | Video configuration, the SDK provides a common setting combination of resolution, frame rate and bit rate, they also can be customized. |
| channel | ZegoPublishChannel | Publish 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
public abstract ZegoVideoConfig GetVideoConfig(ZegoPublishChannel channel)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| channel | ZegoPublishChannel | Publish stream channel |
Details
This function can be used to get the specified publish channel's current video frame rate, bit rate, video capture resolution, and video encoding output resolution.
Return
Video configuration object
SetPublishDualStreamConfig
public abstract void SetPublishDualStreamConfig(List<ZegoPublishDualStreamConfig> configList,ZegoPublishChannel channel)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| configList | List<ZegoPublishDualStreamConfig> | config info. |
| channel | ZegoPublishChannel | ZegoPublishChannel. |
Details
Set the stream config.
- When to call: This must take effect when the codecID specified in the call to [ZegoExpressEngine > setVideoConfig] is ZegoVideoCodecIDH264DualStream after [createEngine] is called.
- Caution: Width, height, resolution and bitrate are all greater than zero to take effect.
- Available since: 3.7.0
- Restrictions: To take effect, the parameters of flow and small flow must be specified at the same time. The resolution ratio of flow and small flow must be the same. For example, both are 4:3 .
SetVideoMirrorMode
public abstract void SetVideoMirrorMode(ZegoVideoMirrorMode mirrorMode,ZegoPublishChannel channel)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| mirrorMode | ZegoVideoMirrorMode | Mirror mode for previewing or publishing the stream. |
| channel | ZegoPublishChannel | Publish 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
public abstract void SetAppOrientation(ZegoOrientation orientation,ZegoPublishChannel channel)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| orientation | ZegoOrientation | Video orientation. |
| channel | ZegoPublishChannel | Publish 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
public abstract void SetAudioConfig(ZegoAudioConfig config,ZegoPublishChannel channel)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| config | ZegoAudioConfig | Audio config. |
| channel | ZegoPublishChannel | Publish 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
public abstract ZegoAudioConfig GetAudioConfig(ZegoPublishChannel channel)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| channel | ZegoPublishChannel | Publish stream channel. |
Details
You can get the current audio codec, bit rate, and audio channel through this function.
- When to call: After the engine is created [createEngine].
- Related APIs: [setAudioConfig].
- Available since: 1.8.0
- Restrictions: None.
Return
Audio config.
TakePublishStreamSnapshot
public abstract void TakePublishStreamSnapshot(OnPublisherTakeSnapshotResult callback,ZegoPublishChannel channel)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| callback | OnPublisherTakeSnapshotResult | Results of take publish stream snapshot. |
| channel | ZegoPublishChannel | Publish stream channel. |
Details
Take a snapshot of the publishing stream.
- When to call: Called this function after calling [startPublishingStream] or [startPreview].
- Caution: The resolution of the snapshot is the encoding resolution set in [setVideoConfig]. If you need to change it to capture resolution, please call [setCapturePipelineScaleMode] to change the capture pipeline scale mode to [Post].
- Related callbacks: The screenshot result will be called back through [ZegoPublisherTakeSnapshotCallback].
- Related APIs: [takePlayStreamSnapshot].
- Available since: 1.17.0
- Restrictions: Not available for WebGL.
MutePublishStreamAudio
public abstract void MutePublishStreamAudio(bool mute,ZegoPublishChannel channel)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| mute | bool | Whether to stop sending audio streams, true means not to send audio stream, and false means sending audio stream. The default is false. |
| channel | ZegoPublishChannel | Publish 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
Mutestatus change notification by monitoring [onRemoteMicStateUpdate] callbacks. - Related APIs: [mutePublishStreamVideo].
- Available since: 1.1.0
- Restrictions: None.
MutePublishStreamVideo
public abstract void MutePublishStreamVideo(bool mute,ZegoPublishChannel channel)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| mute | bool | Whether to stop sending video streams, true means not to send video stream, and false means sending video stream. The default is false. |
| channel | ZegoPublishChannel | Publish 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
Mutestatus change notification by monitoring [onRemoteCameraStateUpdate] callbacks. - Related APIs: [mutePublishStreamAudio].
- Available since: 1.1.0
- Restrictions: None.
SetStreamAlignmentProperty
public abstract void SetStreamAlignmentProperty(int alignment,ZegoPublishChannel channel)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| alignment | int | Whether to enable the stream mixing precision alignment function. |
| channel | ZegoPublishChannel | Publish stream channel |
Details
Use this interface to enable stream alignment, the SDK will attach network time information to the stream when publishing it for accurate stream alignment. Use case: Generally used in scenarios such as KTV where stream alignment is required.
- When to call: After the engine is created [createEngine].
- Caution: If you need to align each stream through network time when playing multiple streams or mixed streams, you need to call [startPublishingStream] to publish the stream and [forceSynchronousNetworkTime] in [ZegoPublisherConfig] is 1 to enable network time synchronization.
- Related APIs: [startMixerTask], [startAutoMixerTask]
- Available since: 2.11.0.
- Restrictions: Not available for WebGL.
EnableTrafficControl
public abstract void EnableTrafficControl(bool enable,int property)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| enable | bool | Whether to enable traffic control. The default is ture. |
| property | int | Adjustable 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.Not available for WebGL.
SetMinVideoBitrateForTrafficControl
public abstract void SetMinVideoBitrateForTrafficControl(int bitrate,ZegoTrafficControlMinVideoBitrateMode mode,ZegoPublishChannel channel)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| bitrate | int | Minimum video bitrate (kbps). |
| mode | ZegoTrafficControlMinVideoBitrateMode | Video sending mode below the minimum bitrate. |
| channel | ZegoPublishChannel | Publish stream channel. |
Details
Set the control strategy when the video bitrate reaches the lowest threshold during flow control. When the bitrate is lower than the minimum threshold, you can choose not to send video data or send it at a very low frame bitrate.
- Default value: There is no control effect of the lowest threshold of video bitrate.
- When to call: After the engine is created [createEngine], Called before [startPublishingStream] can take effect.
- Related APIs: [enableTrafficControl].
- Available since: 1.1.0
- Restrictions: The traffic control must be turned on [enableTrafficControl].Not available for WebGL.
SetMinVideoFpsForTrafficControl
public abstract void SetMinVideoFpsForTrafficControl(int fps,ZegoPublishChannel channel)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| fps | int | The minimum video frame rate threshold for traffic control(fps). |
| channel | ZegoPublishChannel | Publish stream channel. |
Details
When enabling traffic control [enableTrafficControl], and its parameter [property] includes the attribute AdaptiveFPS, the minimum frame rate of the video will not be lower than the value set by the [setMinVideoFpsForTrafficControl] interface. A value of 0 indicates no limit.
- Default value: There is no control effect of the lowest threshold of video frame rate.
- When to call: The call takes effect after the engine [createEngine] is created.
- Related APIs: [enableTrafficControl].
- Caution: If you need to cancel the limit of the setting value, you can set it to 0.
- Available since: 2.17.0
- Restrictions: The traffic control must be turned on [enableTrafficControl]. And its parameter [property] must contain AdaptiveFPS, Please refer to [ZegoTrafficControlProperty] for details.Not available for WebGL.
SetMinVideoResolutionForTrafficControl
public abstract void SetMinVideoResolutionForTrafficControl(int width,int height,ZegoPublishChannel channel)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| width | int | The flow controls the width of the lowest video resolution. |
| height | int | The flow controls the height of the lowest video resolution. |
| channel | ZegoPublishChannel | Publish stream channel. |
Details
When enabling traffic control [enableTrafficControl], and its parameter [property] includes the attribute AdaptiveResolution, the minimum resolution of the video will not be lower than the value set by the [setMinVideoResolutionForTrafficControl] interface. A value of 0 indicates no limit.
- Default value: There is no control effect of the lowest threshold of video resolution.
- When to call: The call takes effect after the engine [createEngine] is created.
- Related APIs: [enableTrafficControl].
- Caution: If you need to cancel the limit of the setting value, you can set width and height to 0.
- Available since: 2.17.0
- Restrictions: The traffic control must be turned on [enableTrafficControl]. And its parameter [property] must contain AdaptiveResolution, Please refer to [ZegoTrafficControlProperty] for details.Not available for WebGL.
SetTrafficControlFocusOn
public abstract void SetTrafficControlFocusOn(ZegoTrafficControlFocusOnMode mode,ZegoPublishChannel channel)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| mode | ZegoTrafficControlFocusOnMode | When LOCAL_ONLY is selected, only the local network status is concerned. When choosing REMOTE, also take into account the remote network. |
| channel | ZegoPublishChannel | Publish stream channel. |
Details
Use this interface to control whether to start traffic control due to poor remote network conditions.
- Default value: Default is disable.
- When to call: After the engine is created [createEngine], Called before [startPublishingStream] can take effect.
- Related APIs: [enableTrafficControl.
- Available since: 2.4.0
- Restrictions: The traffic control must be turned on [enableTrafficControl].Not available for WebGL.
SetCaptureVolume
public abstract void SetCaptureVolume(int volume)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| volume | int | The 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
public abstract void SetAudioCaptureStereoMode(ZegoAudioCaptureStereoMode mode)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| mode | ZegoAudioCaptureStereoMode | Audio 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); 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.Not available for WebGL.
AddPublishCdnUrl
public abstract void AddPublishCdnUrl(string streamID,OnPublisherUpdateCdnUrlResult onPublisherUpdateCdnUrlResult,string targetURL)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| streamID | string | Stream ID. |
| onPublisherUpdateCdnUrlResult | OnPublisherUpdateCdnUrlResult | The execution result of update the relay CDN operation. |
| targetURL | string | CDN 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
public abstract void RemovePublishCdnUrl(string streamID,OnPublisherUpdateCdnUrlResult onPublisherUpdateCdnUrlResult,string targetURL)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| streamID | string | Stream ID. |
| onPublisherUpdateCdnUrlResult | OnPublisherUpdateCdnUrlResult | The execution result of update the relay CDN operation. |
| targetURL | string | CDN 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
public abstract void EnablePublishDirectToCDN(bool enable,ZegoCDNConfig config,ZegoPublishChannel channel)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| enable | bool | Whether to enable direct publish CDN, true: enable direct publish CDN, false: disable direct publish CDN. |
| config | ZegoCDNConfig | CDN configuration, if null, use Zego's background default configuration. |
| channel | ZegoPublishChannel | Publish 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.
SetSEIConfig
public abstract void SetSEIConfig(ZegoSEIConfig config)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| config | ZegoSEIConfig | SEI configuration. The SEI defined by ZEGO is used by default. |
Details
By default, the SDK wraps the data with ZEGO's self-defined SEI type, which is not specified by the SEI standard. When the developer needs to use a third-party decoder to decode the SEI, the correct SEI will not be decoded and the [setSEIConfig] interface needs to be called to change the type of the SEI sent by the SDK to UserUnregister type.
- Use cases: This function needs to be executed when the developer uses a third-party decoder to decode the SEI.
- When to call: After creating the engine [createEngine], before starting to push the stream [startPublishingStream].
- Available since: 3.21.0
- Restrictions: Supported on WebGL for the time being only available. The web-side push-pull stream does not enable the send-receive SEI capability by default. SetSEIConfig is required to enable the send-receive SEI before the push-receive stream is initialized.
SendSEI
public abstract void SendSEI(byte[] data,ZegoPublishChannel channel)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| data | byte[] | SEI data. |
| channel | ZegoPublishChannel | Publish 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
public abstract void EnableHardwareEncoder(bool enable)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| enable | bool | Whether 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
- Restrictions: Not available for WebGL.
SetCapturePipelineScaleMode
public abstract void SetCapturePipelineScaleMode(ZegoCapturePipelineScaleMode mode)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| mode | ZegoCapturePipelineScaleMode | The 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
- Restrictions: Not available for WebGL.
SetDummyCaptureImagePath
public abstract void SetDummyCaptureImagePath(string filePath,ZegoPublishChannel channel)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| filePath | string | Picture file path |
| channel | ZegoPublishChannel | Publish channel. |
Details
Set the path of the static picture would be published when enableCamera(false) is called, it would start to publish static pictures, and when enableCamera(true) is called, it would end publishing static pictures. Use case: The developer wants to display a static picture when the camera is closed. For example, when the anchor exits the background, the camera would be actively closed. At this time, the audience side needs to display the image of the anchor temporarily leaving.
- When to call: After the engine is initialized, call this API to configure the parameters before closing the camera.
- Caution: 1. The static picture cannot be seen in the local preview. 2. External filters, mirroring, watermarks, and snapshots are all invalid. 3. If the picture aspect ratio is inconsistent with the set code aspect ratio, it will be cropped according to the code aspect ratio.
- Platform differences: 1. Windows: Fill in the location of the picture directly, such as "D://dir//image.jpg". 2. iOS: If it is a full path, add the prefix "file:", such as @"file:/var/image.png"; If it is a assets picture path, add the prefix "asset:", such as @"asset". 3. Android: If it is a full path, add the prefix "file:", such as "file:/sdcard/image.png"; If it is a assets directory path, add the prefix "asset:", such as "asset.png". 4. Flutter: If it is a absolute path, add the prefix "file:", such as "file:/sdcard/image.png"; If it is a assets resources directory path, add the prefix "flutter-asset://", such as "flutter-asset://assets/watermark.png".
- Restrictions: 1. Supported picture types are JPEG/JPG, PNG, BMP, HEIF. 2. The function is only for SDK video capture and does not take effect for custom video capture. 3. Not supported that the filePath is a network link. 4. Not available for WebGL. 5. To publish the audio stream, you must call this interface again and set the image path to empty to avoid video billing.
SetLowlightEnhancement
public abstract void SetLowlightEnhancement(ZegoLowlightEnhancementMode mode,ZegoPublishChannel channel)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| mode | ZegoLowlightEnhancementMode | Low light enhancement mode. |
| channel | ZegoPublishChannel | Publish stream channel. |
Details
According to the set low-light enhancement mode, the brightness of the image captured by the camera is enhanced, which is compatible with the beauty function. Users can watch the effect while previewing and toggle the low-light enhancement mode in real time.
- Use cases: The environment on the streaming end is dark, or the frame rate set by the camera is high, which causes the picture to be dark, and the subject cannot be displayed or recognized normally.
- Default value: Off.
- When to call: After creating the engine [createEngine].
- Available since: 2.21.0
- Restrictions: Not available for WebGL.
SetVideoSource
public abstract int SetVideoSource(ZegoVideoSourceType source,ZegoPublishChannel channel)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| source | ZegoVideoSourceType | Video capture source. |
| channel | ZegoPublishChannel | Publish stream channel. |
Details
Set video capture source for switching between different video capture sources.
- Use cases: Typically used in educational scenarios that require switching between different video capture sources.
- When to call: After the engine is created [createEngine].
- Caution: 1. Main push channel ZegoPublishChannel.Main does not support using ZegoVideoSourceType.Player and ZegoVideoSourceType.MainPublishChannel video source type.
- When using ZegoVideoSourceType.Player and ZegoVideoSourceType.MainPublishChannel video source type in aux publish channel ZegoPublishChannel.Aux, must ensure that physical device works on main publish channel ZegoPublishChannel.Main.
- Preemptive video sources are not allowed to be used on multiple channels at the same time, such as ZegoVideoSourceType.Camera and ZegoVideoSourceType.ScreenCapture.
- The other publish channel can copy the main publish channel only when the main publish channel uses internal video capture. A maximum of one copy is supported.
- When using ZegoVideoSourceType.Player video source type, please ensure that the ZegoMediaPlayer instance is created successfully.
- Available since: 3.1.0
- Restrictions: None.
SetVideoSource
public abstract int SetVideoSource(ZegoVideoSourceType source,uint instanceID,ZegoPublishChannel channel)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| source | ZegoVideoSourceType | Video capture source. |
| instanceID | uint | Video capture source instance id. |
| channel | ZegoPublishChannel | Publish stream channel. |
Details
Set video capture source for switching between different video capture sources.
- Use cases: Typically used in educational scenarios that require switching between different video capture sources.
- When to call: After the engine is created [createEngine].
- Caution: 1. Main push channel ZegoPublishChannel.Main does not support using ZegoVideoSourceType.Player and ZegoVideoSourceType.MainPublishChannel video source type.
- When using ZegoVideoSourceType.Player and ZegoVideoSourceType.MainPublishChannel video source type in aux publish channel ZegoPublishChannel.Aux, must ensure that physical device works on main publish channel ZegoPublishChannel.Main.
- Preemptive video sources are not allowed to be used on multiple channels at the same time, such as ZegoVideoSourceType.Camera and ZegoVideoSourceType.ScreenCapture.
- The other publish channel can copy the main publish channel only when the main publish channel uses internal video capture. A maximum of one copy is supported.
- When using ZegoVideoSourceType.Player video source type, please ensure that the ZegoMediaPlayer instance is created successfully.
- Available since: 3.1.0
- Restrictions: None.
SetAudioSource
public abstract int SetAudioSource(ZegoAudioSourceType source,ZegoPublishChannel channel)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| source | ZegoAudioSourceType | Audio capture source. |
| channel | ZegoPublishChannel | Publish stream channel. |
Details
Set audio capture source for switching between different audio capture sources.
- Use cases: Typically used in educational scenarios that require switching between different audio capture sources.
- When to call: After the engine is created [createEngine].
- Caution: 1. Main push channel ZegoPublishChannel.Main does not support using ZegoAudioSourceType.MediaPlayer and ZegoAudioSourceType.MainPublishChannel audio source type.
- When using ZegoAudioSourceType.MediaPlayer and ZegoAudioSourceType.MainPublishChannel audio source type in aux publish channel ZegoPublishChannel.Aux, must ensure that physical device works on main publish channel ZegoPublishChannel.Main.
- Preemptive audio sources are not allowed to be used on multiple channels at the same time, such as ZegoAudioSourceType.Microphone.
- When using ZegoAudioSourceType.MediaPlayer audio source type, please ensure that the ZegoMediaPlayer instance is created successfully.
- Available since: 3.1.0
SetAudioSource
public abstract int SetAudioSource(ZegoAudioSourceType source,ZegoAudioSourceMixConfig config)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| source | ZegoAudioSourceType | Audio capture source. |
| config | ZegoAudioSourceMixConfig | Audio capture source mix config. |
Details
Set audio capture source for switching between different audio capture sources.
- Use cases: Typically used in educational scenarios that require switching between different audio capture sources.
- When to call: After the engine is created [createEngine].
- Caution: 1. Act on the main publish channel ZegoPublishChannel.Main.
- Main push channel ZegoPublishChannel.Main does not support using ZegoAudioSourceType.MediaPlayer and ZegoAudioSourceType.MainPublishChannel audio source type.
- Available since: 3.1.0
- Restrictions: None.
StartPlayingStream
public abstract void StartPlayingStream(string streamID,ZegoPlayerConfig config)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| streamID | string | Stream ID, a string of up to 256 characters. Caution: Only support numbers, English characters and '-', '_'. |
| config | ZegoPlayerConfig | Advanced player configuration Room [roomID] in [ZegoPlayerConfig] is the login roomID. |
Details
Play audio and video streams from the ZEGO RTC server or CDN.
- Use cases: In real-time or live broadcast scenarios, developers can listen to the [onRoomStreamUpdate] event callback to obtain the new stream information in the room where they are located, and call this interface to pass in streamID for play streams.
- When to call: After [loginRoom].
- Caution: 1. The developer can update the player canvas by calling this function again (the streamID must be the same). 2. After the first play stream failure due to network reasons or the play stream is interrupted, the default time for SDK reconnection is 20min. 3. In the case of poor network quality, user play may be interrupted, the SDK will try to reconnect, and the current play status and error information can be obtained by listening to the [onPlayerStateUpdate] event. please refer to https://docs.zegocloud.com/faq/reconnect. 4. Playing the stream ID that does not exist, the SDK continues to try to play after calling this function. After the stream ID is successfully published, the audio and video stream can be actually played.
- Available since: 1.1.0
- Restrictions: None.
StartPlayingStreamInScene
public abstract void StartPlayingStreamInScene(string streamID,ZegoScenePlayerConfig config)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| streamID | string | Stream ID, a string of up to 256 characters. Caution: Only support numbers, English characters and '-', '_'. |
| config | ZegoScenePlayerConfig | Advanced scene player configuration. |
Details
Play audio and video streams from the ZEGO RTC server or CDN.
- Use cases: When using RangeScene, users can use this function to customize play the streaming.
- When to call: After [loginScene].
- Caution:
- After the first play stream failure due to network reasons or the play stream is interrupted, the default time for SDK reconnection is 20min.
- 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.
- Playing the stream ID that does not exist, the SDK continues to try to play after calling this function. After the stream ID is successfully published, the audio and video stream can be actually played.
- Available since: 3.3.0
- Restrictions: Not available for WebGL.
StopPlayingStream
public abstract void StopPlayingStream(string streamID)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| streamID | string | Stream ID. |
Details
Play audio and video streams from the ZEGO RTC server.
- Use cases: In the real-time scenario, developers can listen to the [onRoomStreamUpdate] event callback to obtain the delete stream information in the room where they are located, and call this interface to pass in streamID for stop play streams.
- When to call: After [loginRoom].
- Caution: 1. When stopped, the attributes set for this stream previously, such as [setPlayVolume], [mutePlayStreamAudio], [mutePlayStreamVideo], etc., will be invalid and need to be reset when playing the the stream next time.
- 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.
TakePlayStreamSnapshot
public abstract void TakePlayStreamSnapshot(string streamID,OnPlayerTakeSnapshotResult callback)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| streamID | string | Stream ID to be snapshot. |
| callback | OnPlayerTakeSnapshotResult | Results of take play stream snapshot. |
Details
Take a screenshot of the specified stream ID.
- When to call: after called [startPlayingStream].
- Related callbacks: [onPlayerTakeSnapshotResult] Screenshot data callback.
- Available since: 1.17.0
- Restrictions: Not available for WebGL.
SetPlayVolume
public abstract void SetPlayVolume(string streamID,int volume)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| streamID | string | Stream ID. |
| volume | int | Volume 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: Not available for WebGL.
SetAllPlayStreamVolume
public abstract void SetAllPlayStreamVolume(int volume)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| volume | int | Volume percentage. The value ranges from 0 to 200, and the default value is 100. |
Details
Set the sound size of the stream, the local user can control the playback volume of the audio stream.
- When to call: after called [startPlayingStream].
- Related APIs: [setPlayVolume] Set the specified streaming volume.
- Caution: Set the specified streaming volume and [setAllPlayStreamVolume] interface to override each other, and the last call takes effect.
- Available since: 2.3.0
- Restrictions: Not available for WebGL.
SetPlayStreamVideoType
public abstract void SetPlayStreamVideoType(string streamID,ZegoVideoStreamType streamType)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| streamID | string | Stream ID. |
| streamType | ZegoVideoStreamType | Video stream type. |
Details
When the publish stream sets the codecID to SVC through [setVideoConfig], the puller can dynamically set and select different stream types (small resolution is one-half of the standard layer).
- Use cases: In general, when the network is weak or the rendered UI window is small, you can choose to pull videos with small resolutions to save bandwidth.
- When to call: before or after called [startPlayingStream].
- Available since: 2.3.0
- Restrictions: Not available for WebGL.
SetPlayStreamBufferIntervalRange
public abstract void SetPlayStreamBufferIntervalRange(string streamID,uint minBufferInterval,uint maxBufferInterval)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| streamID | string | Stream ID. |
| minBufferInterval | uint | The lower limit of the buffer adaptation interval, in milliseconds. The default value is 0ms. |
| maxBufferInterval | uint | The upper limit of the buffer adaptation interval, in milliseconds. The default value is 4000ms. |
Details
Set the range of adaptive adjustment of the internal buffer of the sdk when streaming is 0-4000ms.
- Use cases: Generally, in the case of a poor network environment, adjusting and increasing the playback buffer of the pull stream will significantly reduce the audio and video freezes, but will increase the delay.
- When to call: after called [createEngine].
- Caution: When the upper limit of the cache interval set by the developer exceeds 4000ms, the value will be 4000ms. When the upper limit of the cache interval set by the developer is less than the lower limit of the cache interval, the upper limit will be automatically set as the lower limit.
- Available since: 2.1.0
- Restrictions: Not available for WebGL.
SetPlayStreamFocusOn
public abstract void SetPlayStreamFocusOn(string streamID)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| streamID | string | Stream ID. |
Details
Set the weight of the streaming priority.
- Use cases: This interface can be used when developers need to prioritize the quality of a stream in business. For example: in class scene, if students pull multiple streams, you can set high priority for teacher stream.
- When to call: after called [startPlayingStream].
- Caution: By default, all streams have the same weight. Only one stream can be set with high priority, whichever is set last. After the flow is stopped, the initial state is automatically restored, and all flows have the same weight.When the local network is not good, while ensuring the focus flow, other stalls may be caused more.
- Available since: 1.1.0
- Restrictions: Not available for WebGL.
MutePlayStreamAudio
public abstract void MutePlayStreamAudio(string streamID,bool mute)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| streamID | string | Stream ID. |
| mute | bool | Whether 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:
- When used together with [muteAllPlayAudioStreams], they can override each other's configurations.
- When used together with [muteAllPlayStreamAudio], this function only works when the [muteAllPlayStreamAudio] function is set to
false. - 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
falseat 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 thestreamID; calling the [mutePlayStreamAudio(false, streamID)] function allows the local user to receive all audio data.
- Available since: 1.1.0
MutePlayStreamVideo
public abstract void MutePlayStreamVideo(string streamID,bool mute)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| streamID | string | Stream ID. |
| mute | bool | Whether 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:
- When used together with [muteAllPlayVideoStreams], they can override each other's configurations.
- When used together with [muteAllPlayStreamAudio], this function only works when the [muteAllPlayStreamVideo] function is set to
false. - 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.
- 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
falseat 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 thestreamID; call the [mutePlayStreamVideo(false, streamID)] function, the local user can receive all the video data.
- Available since: 1.1.0
MuteAllPlayStreamAudio
public abstract void MuteAllPlayStreamAudio(bool mute)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| mute | bool | Whether it is possible to receive audio data from all remote users when streaming, "true" means prohibition, "false" means receiving, and the default value is "false". |
Details
In the process of real-time audio and video interaction, local users can use this function to control whether to receive audio data from all remote users when pulling streams (including the audio streams pushed by users who have newly joined the room after calling this function). By default, users can receive audio data pushed by all remote users after joining the room. When the developer does not receive the audio receipt, the hardware and network overhead can be reduced.
- Use cases: Call this function when developers need to quickly close and restore remote audio. Compared to re-flow, it can greatly reduce the time and improve the interactive experience.
- When to call: This function can be called after calling [createEngine].
- Related APIs: You can call the [mutePlayStreamAudio] function to control whether to receive a single piece of audio data. When the two functions [muteAllPlayStreamAudio] and [mutePlayStreamAudio] are set to
falseat the same time, the local user can receive the audio data of the remote user when the stream is pulled: 1. When the [muteAllPlayStreamAudio(true)] function is called, it takes effect globally, that is, local users will be prohibited from receiving audio data from all remote users. At this time, the [mutePlayStreamAudio] function will not take effect no matter if the [mutePlayStreamAudio] function is called before or after [muteAllPlayStreamAudio]. 2. When the [muteAllPlayStreamAudio(false)] function is called, the local user can receive the audio data of all remote users. At this time, the [mutePlayStreamAudio] function can be used to control whether to receive a single audio data. Calling the [mutePlayStreamAudio(true, streamID)] function allows the local user to receive audio data other than thestreamID; calling the [mutePlayStreamAudio(false, streamID)] function allows the local user to receive all audio data.
- Available since: 2.4.0
- Restrictions: Not available for WebGL.
MuteAllPlayAudioStreams
public abstract void MuteAllPlayAudioStreams(bool mute)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| mute | bool | Whether it is possible to receive audio data from all remote users when streaming, "true" means prohibition, "false" means receiving, and the default value is "false". |
Details
In the process of real-time audio and video interaction, local users can use this function to control whether to receive audio data from all remote users when pulling streams (including the audio streams pushed by users who have newly joined the room after calling this function). By default, users can receive audio data pushed by all remote users after joining the room. When the developer does not receive the audio receipt, the hardware and network overhead can be reduced.
- Use cases: Call this function when developers need to quickly close and restore remote audio. Compared to re-flow, it can greatly reduce the time and improve the interactive experience.
- When to call: This function can be called after calling [createEngine].
- Caution: This function cannot be used together with [muteAllPlayStreamAudio] throughout the SDK lifecycle.
- Related APIs: You can call the [mutePlayStreamAudio] function to control whether to receive a single piece of audio data. When the two functions [muteAllPlayStreamAudio] and [mutePlayStreamAudio] are set to
falseat the same time, the local user can receive the audio data of the remote user when the stream is pulled: 1. When the [muteAllPlayStreamAudio(true)] function is called, it takes effect globally, that is, local users will be prohibited from receiving audio data from all remote users. At this time, the [mutePlayStreamAudio] function will not take effect no matter if the [mutePlayStreamAudio] function is called before or after [muteAllPlayStreamAudio]. 2. When the [muteAllPlayStreamAudio(false)] function is called, the local user can receive the audio data of all remote users. At this time, the [mutePlayStreamAudio] function can be used to control whether to receive a single audio data. Calling the [mutePlayStreamAudio(true, streamID)] function allows the local user to receive audio data other than thestreamID; calling the [mutePlayStreamAudio(false, streamID)] function allows the local user to receive all audio data.
- Available since: 3.10.0
MuteAllPlayStreamVideo
public abstract void MuteAllPlayStreamVideo(bool mute)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| mute | bool | Whether it is possible to receive all remote users' video data when streaming, "true" means prohibition, "false" means receiving, and the default value is "false". |
Details
In the process of real-time video and video interaction, local users can use this function to control whether to receive all remote users' video data when pulling the stream (including the video stream pushed by the new user who joins the room after calling this function). By default, users can receive video data pushed by all remote users after joining the room. When the developer does not receive the video data, the hardware and network overhead can be reduced.
- Use cases: This function can be called when developers need to quickly close and resume watching remote video. Compared to re-flow, it can greatly reduce the time and improve the interactive experience.
- When to call: This function can be called after calling [createEngine].
- Caution: When you mute the video stream, the view remains at the last frame by default, if you need to clear the last frame, please contact ZEGO technical support.
- Related APIs: You can call the [mutePlayStreamVideo] function to control whether to receive a single piece of video data. When the two functions [muteAllPlayStreamVideo] and [mutePlayStreamVideo] are set to
falseat the same time, the local user can receive the video data of the remote user when the stream is pulled: 1. When the [muteAllPlayStreamVideo(true)] function is called, it will take effect globally, that is, the local user will be prohibited from receiving all remote users' video data. At this time, the [mutePlayStreamVideo] function will not take effect whether it is called before or after [muteAllPlayStreamVideo]. 2. When the [muteAllPlayStreamVideo(false)] function is called, the local user can receive the video data of all remote users. At this time, the [mutePlayStreamVideo] function can be used to control whether to receive a single video data. Call the [mutePlayStreamVideo(true, streamID)] function, the local user can receive other video data other than thestreamID; call the [mutePlayStreamVideo(false, streamID)] function, the local user can receive all the video data.
- Available since: 2.4.0
- Restrictions: Not available for WebGL.
MuteAllPlayVideoStreams
public abstract void MuteAllPlayVideoStreams(bool mute)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| mute | bool | Whether it is possible to receive all remote users' video data when streaming, "true" means prohibition, "false" means receiving, and the default value is "false". |
Details
In the process of real-time video and video interaction, local users can use this function to control whether to receive all remote users' video data when pulling the stream (including the video stream pushed by the new user who joins the room after calling this function). By default, users can receive video data pushed by all remote users after joining the room. When the developer does not receive the video data, the hardware and network overhead can be reduced.
- Use cases: This function can be called when developers need to quickly close and resume watching remote video. Compared to re-flow, it can greatly reduce the time and improve the interactive experience.
- When to call: This function can be called after calling [createEngine].
- Caution:
- This function cannot be used together with [muteAllPlayStreamVideo] throughout the SDK lifecycle.
- When you mute the video stream, the view remains at the last frame by default, if you need to clear the last frame, please contact ZEGO technical support.
- Related APIs: You can call the [mutePlayStreamVideo] function to control whether to receive a single piece of video data.
- Available since: 3.10.0
EnableHardwareDecoder
public abstract void EnableHardwareDecoder(bool enable)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| enable | bool | Whether 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: Not available for WebGL.
EnableCheckPoc
public abstract void EnableCheckPoc(bool enable)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| enable | bool | Whether 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: Not available for WebGL.
SetPlayStreamsAlignmentProperty
public abstract void SetPlayStreamsAlignmentProperty(ZegoStreamAlignmentMode mode)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| mode | ZegoStreamAlignmentMode | Setting the stream alignment mode. |
Details
When playing at the streaming end, control whether the playing RTC stream needs to be accurately aligned. If necessary, all the streams that contain precise alignment parameters will be aligned; if not, all streams are not aligned. Use case: It is often used in scenes that require to play multiple streams alignment such as KTV to ensure that users can switch between singing anchors, ordinary Maishangyu chat anchors, and Maixia audiences at any time during use.
- Default value: If this interface is not called, the default is not aligned.
- When to call: Called after [createEngine]. Call the interface repeatedly, and the latest setting is valid.
- Related APIs: Set the precise alignment parameter of the stream channel [setStreamAlignmentProperty].
- Available since: 2.14.0
UpdatePlayingCanvas
public abstract int UpdatePlayingCanvas(string streamID,bool enable)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| streamID | string | Stream ID, a string of up to 256 characters. Caution: Only support numbers, English characters and '-', '_'. |
| enable | bool | Used to control whether to display the playing stream video. When the value is set to [false], no video is displayed, only audio is played. |
Details
This interface will update playing view. Use case: The user can call this function to update canvas display video.
- When to call: After receiving a successful playing stream from the [onPlayerStateUpdate] or [onUserStreamStateUpdate] callback.
- Caution: None.
- Restrictions: Not available for WebGL.
Return
Error code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details.
StartMixerTask
public abstract void StartMixerTask(ZegoMixerTask task,OnMixerStartResult onMixerStartResult)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| task | ZegoMixerTask | Mixing task object. Required: Yes. |
| onMixerStartResult | OnMixerStartResult | Start 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
public abstract void StopMixerTask(ZegoMixerTask task,OnMixerStopResult onMixerStopResult)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| task | ZegoMixerTask | Mixing task object. Required: Yes. |
| onMixerStopResult | OnMixerStopResult | Stop 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.
StartAutoMixerTask
public abstract void StartAutoMixerTask(ZegoAutoMixerTask task,OnMixerStartResult callback)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| task | ZegoAutoMixerTask | Auto mix stream task object |
| callback | OnMixerStartResult | Start auto mix stream task result callback notification |
Details
Local users can use this function to start an auto stream mixing task, all streams in a room wil be mixed. Currently, only audio streams can be mixed. When auto stream mixing is enabled, the audio of all streams in the room is automatically mixed, and any further pushed streams in the room are automatically mixed into the final output stream.
- Use cases: Often used in voice chat room scenarios.
- When to call: After the engine is created, user can call this function to enable auto stream mixing in the target room if the target room has already been created
- Caution: Before starting the next auto stream mixing task in the same room, call [stopAutoMixerTask] function to end the last auto stream mixing task. Otherwise, when one anchor has started the next auto stream mixing task and other anchors have started the next auto stream mixing task, the audience still pulls the output stream of the first auto stream mixing task. If the user does not end the current auto stream mixing task, the task will automatically end after the room does not exist or the input streams do not exist for 90 seconds.
- Related callbacks: Users can obtain the execution result of the function through [ZegoMixerStartCallback] callback.Users can get automatic mixed flow information through [onAutoMixerSoundLevelUpdate] callback.
- Related APIs: Users can call [stopAutoMixerTask] function to stop an auto stream mixing task.
- Available since: 2.10.0
- Restrictions: Please refer to https://docs.zegocloud.com/article/7611 or contact ZEGO technical support.Not available for WebGL.
StopAutoMixerTask
public abstract void StopAutoMixerTask(ZegoAutoMixerTask task,OnMixerStopResult callback)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| task | ZegoAutoMixerTask | Auto mix stream task object |
| callback | OnMixerStopResult | Stop auto mix stream task result callback notification |
Details
Local users can use this function to stop an auto stream mixing task.
- Use cases: Often used in voice chat room scenarios.
- When to call: Call this function after [startAutoMixerTask] function is called to start an auto stream mixing task.
- Caution: Before calling [startAutoMixerTask] function to start the next auto stream mixing task in the same room, call this function to end the last auto stream mixing task. Otherwise, when one anchor has started the next auto stream mixing task and other anchors have started the next auto stream mixing task, the audience still pulls the output stream of the first auto stream mixing task. If the user does not end the current auto stream mixing task, the task will automatically end after the room does not exist or the input streams do not exist for 90 seconds.
- Related callbacks: Users can obtain the execution result of the function through [ZegoMixerStopCallback] callback.
- Related APIs: Users can call [startAutoMixerTask] function to start an auto stream mixing task.
- Available since: 2.10.0
- Restrictions: Not available for WebGL.
MuteMicrophone
public abstract void MuteMicrophone(bool mute)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| mute | bool | Whether 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
public abstract bool IsMicrophoneMuted()ZegoExpressEngine.csUsed 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
public abstract void MuteSpeaker(bool mute)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| mute | bool | Whether 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: Not available for WebGL.
IsSpeakerMuted
public abstract bool IsSpeakerMuted()ZegoExpressEngine.csUsed 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: Not available for WebGL.
Whether the speaker is muted; true: the speaker is muted; false: the speaker is enable (not muted).
GetAudioDeviceList
public abstract ZegoDeviceInfo[] GetAudioDeviceList(ZegoAudioDeviceType deviceType)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| deviceType | ZegoAudioDeviceType | Audio device type |
Details
Only for Windows / macOS / Linux, not available for WebGL
Return
Audo device List
GetAudioDeviceList
public abstract void GetAudioDeviceList(ZegoAudioDeviceType deviceType,OnGetAudioDeviceListResult callback)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| deviceType | ZegoAudioDeviceType | Audio device type |
| callback | OnGetAudioDeviceListResult | The callback of audio device list. |
Details
Only for Windows / macOS / Linux / WebGL
GetDefaultAudioDeviceID
public abstract string GetDefaultAudioDeviceID(ZegoAudioDeviceType deviceType)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| deviceType | ZegoAudioDeviceType | Audio device type |
Details
Only for Windows / macOS / Linux, not available for WebGL.
Return
Default Audio device ID
UseAudioDevice
public abstract void UseAudioDevice(ZegoAudioDeviceType deviceType,string deviceID)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| deviceType | ZegoAudioDeviceType | Audio device type |
| deviceID | string | ID of a device obtained by [getAudioDeviceList] |
Details
Chooses to use the specified audio device.
- When to call: After creating the engine [createEngine] and before call [startPublishingStream] or [startPlayingStream].
- Available since: 1.1.0
- Restrictions: Only supports Windows / macOS / Linux / WebGL
GetAudioDeviceVolume
public abstract int GetAudioDeviceVolume(ZegoAudioDeviceType deviceType,string deviceID)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| deviceType | ZegoAudioDeviceType | Audio device type |
| deviceID | string | ID of a device obtained by [getAudioDeviceList] |
Details
Get volume for the specified audio device. Only for Windows / macOS / Linux, not available for WebGL.
Return
Device volume
SetAudioDeviceVolume
public abstract void SetAudioDeviceVolume(ZegoAudioDeviceType deviceType,string deviceID,int volume)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| deviceType | ZegoAudioDeviceType | Audio device type |
| deviceID | string | ID of a device obtained by [getAudioDeviceList] |
| volume | int | Device volume |
Details
The direct operating system device may fail due to system restrictions. Please use [setCaptureVolume] and [setPlayVolume] first to adjust the volume of publish and play streams. Only for Windows / macOS / Linux, not available for WebGL.
SetSpeakerVolumeInAPP
public abstract void SetSpeakerVolumeInAPP(string deviceID,int volume)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| deviceID | string | ID of a device obtained by [getAudioDeviceList]. |
| volume | int | Device volume. |
Details
Set the volume of the speaker in the App.
- Use cases: You need to adjust only the playback volume of the app, and do not adjust the playback volume of the system.
- When to call: After creating the engine [createEngine].
- Caution: This interface triggers startup switchover of the device. You are advised not to invoke this interface frequently to avoid unnecessary overhead and hardware problems. This interface may cause the volume mode to switch between call and media. If the media volume is inconsistent with the call volume, the volume may change.
- Available since: 3.3.0
- Restrictions: Only for Windows. Not available for WebGL.
GetSpeakerVolumeInAPP
public abstract int GetSpeakerVolumeInAPP(string deviceID)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| deviceID | string | ID of a device obtained by [getAudioDeviceList]. |
Details
Get the volume of the speaker in the App, only support Windows.
- When to call: After creating the engine [createEngine].
- Related APIs: Set the volume of the speaker in the App [setSpeakerVolumeInAPP].
- Available since: 3.3.0.
- Restrictions: Only for Windows. Not available for WebGL.
Return
Device volume.
StartAudioDeviceVolumeMonitor
public abstract void StartAudioDeviceVolumeMonitor(ZegoAudioDeviceType deviceType,string deviceID)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| deviceType | ZegoAudioDeviceType | Audio device type |
| deviceID | string | ID of a device obtained by [getAudioDeviceList] |
Details
Starts the audio device volume monitor. When the volume of the device changes, the changed volume will be called back via [onAudioDeviceVolumeChanged].
- Caution: Currently, only one audio output device and one audio input device are supported to be monitored at the same time. When this API is called multiple times and the same device type is set, the device ID set to this API during the last call will be overwritten.
- When to call: After creating the engine via [createEngine].
- Platform differences: Only supports Windows and macOS.
- Related APIs: When you no longer need to monitor the device volume, please call [stopAudioDeviceVolumeMonitor] to stop monitoring.
- Available since: 1.1.0
- Restrictions: Not available for WebGL.
StopAudioDeviceVolumeMonitor
public abstract void StopAudioDeviceVolumeMonitor(ZegoAudioDeviceType deviceType,string deviceID)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| deviceType | ZegoAudioDeviceType | Audio device type |
| deviceID | string | ID of a device obtained by [getAudioDeviceList] |
Details
Stops the audio device volume monitor.
- When to call: After creating the engine via [createEngine], and when you no longer need to monitor the device volume.
- Platform differences: Only supports Windows and macOS.
- Available since: 1.1.0
- Restrictions: Not available for WebGL.
MuteAudioDevice
public abstract void MuteAudioDevice(ZegoAudioDeviceType deviceType,string deviceID,bool mute)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| deviceType | ZegoAudioDeviceType | Audio device type |
| deviceID | string | ID of a device obtained by [getAudioDeviceList] |
| mute | bool | Whether to mute the audio device; true means to mute the audio device; false means to unmute the audio device. |
Details
Only for Windows / macOS / Linux. Not available for WebGL.
SetAudioDeviceMode
public abstract void SetAudioDeviceMode(ZegoAudioDeviceMode deviceMode)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| deviceMode | ZegoAudioDeviceMode | Audio device mode |
Details
Select audio equipment mode according to the need of the scene (only supported by Android and iOS).
- Use cases: In the case of KTV, the General mode must be used, but in the language room, the Communication2 or Communication3 mode is required in order to avoid the sound of third-party music being collected. For details on how to set the audio device mode, see https://doc-zh.zego.im/faq/AudioDeviceMod?product=ExpressVideo&platform=macos
- When to call: After creating the engine [createEngine].
- Caution: This interface triggers startup switchover of the device. You are advised not to invoke this interface frequently to avoid unnecessary overhead and hardware problems. This interface may cause the volume mode to switch between call and media. If the media volume is inconsistent with the call volume, the volume may change.
- Available since: 2.22.0
IsAudioDeviceMuted
public abstract bool IsAudioDeviceMuted(ZegoAudioDeviceType deviceType,string deviceID)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| deviceType | ZegoAudioDeviceType | Audio device type |
| deviceID | string | ID of a device obtained by [getAudioDeviceList] |
Details
Only for Windows / macOS / Linux. Not available for WebGL..
Return
Whether the audio device is muted; true means the audio device is muted; false means the audio device is not muted.
EnableAudioCaptureDevice
public abstract void EnableAudioCaptureDevice(bool enable)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| enable | bool | Whether 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, there is no audio data.
- 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: Not available for WebGL.
GetAudioRouteType
public abstract ZegoAudioRoute GetAudioRouteType()ZegoExpressEngine.csAudio routing refers to the audio output device that an app uses to play audio, and common audio routes are: speakers, handsets, headphones, Bluetooth devices, and so on.
- When to call: After creating the engine [createEngine].
- Related APIs: Set audio route to speaker [setAudioRouteToSpeaker].
- Available since: 1.1.0
- Restrictions: Not available for WebGL.
SetAudioRouteToSpeaker
public abstract void SetAudioRouteToSpeaker(bool defaultToSpeaker)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| defaultToSpeaker | bool | Whether to use the built-in speaker to play sound, true: use the built-in speaker to play sound, false: use the highest priority audio output device scheduled by the current system to play sound |
Details
Whether to use the speaker to play audio, when you choose not to use the built-in speaker to play the sound, the SDK will select the audio output device with the highest current priority to play the sound according to the system schedule, and common audio routes are: handsets, headphones, Bluetooth devices, and so on.
- When to call: After creating the engine [createEngine].
- Related APIs: Get the current audio route [getAudioRouteType].
- Available since: 1.1.0
- Restrictions: Not available for WebGL.
EnableCamera
public abstract void EnableCamera(bool enable,ZegoPublishChannel channel)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| enable | bool | Whether to turn on the camera, true: turn on camera, false: turn off camera |
| channel | ZegoPublishChannel | Publishing 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
truewhich 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
public abstract void UseFrontCamera(bool enable,ZegoPublishChannel channel)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| enable | bool | [ZegoVideoSourceTypeCamera] if or not use front camera, true: use the front camera, false: use the the rear camera. |
| channel | ZegoPublishChannel | Publishing 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
truewhich 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.
EnableCameraAdaptiveFPS
public abstract void EnableCameraAdaptiveFPS(bool enable,int minFPS,int maxFPS,ZegoPublishChannel channel)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| enable | bool | Whether to enable camera adaptive frame rate. true means on, false means off.Off by default. |
| minFPS | int | Desired minimum frame rate, 15 recommended. Unit: fps. |
| maxFPS | int | Desired minimum frame rate, 25 recommended. Unit: fps. |
| channel | ZegoPublishChannel | Publishing stream channel. |
Details
After enabling, the SDK matches the capture frame rate range supported by the camera according to the set frame rate range, and dynamically adjusts the capture frame rate of the camera according to the ambient brightness within this range to improve the screen brightness when the set frame rate is too high.
- Use cases: The frame rate set by the user on the streaming end is too high, and the ambient lighting is low, so the subject cannot be displayed or recognized normally. For example, live broadcast scenes with high exposure requirements.
- When to call: After creating the engine [createEngine], before the camera starts.
- Caution: Takes When calling [setVideoConfig] to set the frame rate lower than the expected minimum frame rate, the frame rate value set by [setVideoConfig] will be used. Due to the different hardware and algorithm strategies of different mobile phone manufacturers, the effect of this interface is different on different models or on the front and rear cameras of the same model.
- Related APIs: Through [setVideoConfig], you can set the camera capture frame rate and the encoder encoding frame rate.
- Available since: 2.20.0
- Restrictions: Not available for WebGL.
UseVideoDevice
public abstract void UseVideoDevice(string deviceID,ZegoPublishChannel channel)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| deviceID | string | ID of a device obtained by [getVideoDeviceList] |
| channel | ZegoPublishChannel | Publishing stream channel |
Details
Only for Windows / macOS / Linux / WebGL
GetVideoDeviceList
public abstract ZegoDeviceInfo[] GetVideoDeviceList()ZegoExpressEngine.csOnly for Windows / macOS / Linux, not available for WebGL
Video device List
GetVideoDeviceList
public abstract void GetVideoDeviceList(OnGetVideoDeviceListResult callback)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| callback | OnGetVideoDeviceListResult | The callback of video device list. |
Details
Only for Windows / macOS / Linux / WebGL
GetDefaultVideoDeviceID
public abstract string GetDefaultVideoDeviceID()ZegoExpressEngine.csOnly for Windows / macOS / Linux. Not available for WebGL.
Default video device ID
StartSoundLevelMonitor
public abstract void StartSoundLevelMonitor(uint millisecond)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| millisecond | uint | Monitoring 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
public abstract void StartSoundLevelMonitor(ZegoSoundLevelConfig config)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| config | ZegoSoundLevelConfig | Configuration for starts the sound level monitor. |
Details
After starting monitoring, you can receive local audio sound level via [onCapturedSoundLevelUpdate] callback, and receive remote audio sound level via [onRemoteSoundLevelUpdate] callback. Before entering the room, you can call [startPreview] with this function and combine it with [onCapturedSoundLevelUpdate] callback to determine whether the audio device is working properly.
- Use cases: During the publishing and playing process, determine who is talking on the wheat and do a UI presentation.
- When to call: After the engine is created [createEngine].
- Caution: 1. [onCapturedSoundLevelUpdate] and [onRemoteSoundLevelUpdate] callback notification period is the value set by the parameter. 2. After the sound monitoring is started, even if the local audio capture is not started, [onCapturedSoundLevelUpdate] will have a callback, and the sound level is 0.
- Available since: 2.10.0
- Restrictions: Not available for WebGL.
StopSoundLevelMonitor
public abstract void StopSoundLevelMonitor()ZegoExpressEngine.csAfter 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
- Restrictions: Not available for WebGL.
StartAudioSpectrumMonitor
public abstract void StartAudioSpectrumMonitor(uint millisecond)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| millisecond | uint | Monitoring 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
public abstract void StopAudioSpectrumMonitor()ZegoExpressEngine.csAfter 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
- Restrictions: Not available for WebGL.
EnableHeadphoneMonitor
public abstract void EnableHeadphoneMonitor(bool enable)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| enable | bool | Whether 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
- Restrictions: Not available for WebGL.
SetHeadphoneMonitorVolume
public abstract void SetHeadphoneMonitorVolume(int volume)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| volume | int | headphone 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
- Restrictions: Not available for WebGL.
EnableMixSystemPlayout
public abstract void EnableMixSystemPlayout(bool enable)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| enable | bool | Whether to mix system playout. |
Details
Enable sound card capture to mix sounds played by the system into the publishing stream, such as sounds played by the browser, sounds played by the third-party player, etc.
- Default value: Default is disable.
- When to call: Called this function after calling [startPublishingStream] or [startPreview].
- Caution: The system sound card sound does not include streaming sound, media player sound and sound effect player sound.
- Related APIs: [setMixSystemPlayoutVolume] function can set system audio capture volume.
- Platform differences: Only supports Windows and macOS.
- Available since: 1.9.0
- Restrictions: Not available for WebGL.
SetMixSystemPlayoutVolume
public abstract void SetMixSystemPlayoutVolume(int volume)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| volume | int | the volume. Valid range [0, 200], default is 100. |
Details
set system audio capture volume.
- Use cases: User needs to adjust the volume which system playout mix to stream publishing.
- When to call /Trigger: Called this function after calling [startPublishingStream] or [startPreview].
- Related APIs: [enableMixSystemPlayout] enable or disable mix system playout.
- Platform differences: Only supports Windows and macOS.
- Available since: 2.4.0
- Restrictions: None.
GetCurrentAudioDevice
public abstract ZegoDeviceInfo GetCurrentAudioDevice(ZegoAudioDeviceType deviceType)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| deviceType | ZegoAudioDeviceType | Audio device type.Required. |
Details
Get the audio device information currently in use.
- Use cases: Used for scenes that need to manually switch between multiple audio devices.
- When to call: Called this function after calling [startPublishingStream] or [startPreview].
- Related APIs: The default audio device ID can be obtained through [getDefaultAudioDeviceID].
- Available since: 2.12.0
- Restrictions: Only supports Windows and macOS. Not available for WebGL.
Return
Audio device information.
EnableAEC
public abstract void EnableAEC(bool enable)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| enable | bool | Whether 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: Not available for WebGL.
EnableHeadphoneAEC
public abstract void EnableHeadphoneAEC(bool enable)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| enable | bool | Whether to enable, true: enable, false: disable |
Details
When [enableAEC] is used to turn on echo cancellation, it is only turned on when the speaker is used for mobile terminal equipment. Call this function if you need to turn echo cancellation on or off when using the headset. Use case: It is common when the mobile device is connected to a external sound card as the audio output source. In order to eliminate the echo in this case, you need to call this function to turn on the echo cancellation.
- Default value: Android is off by default and iOS is on by default.
- When to call: It needs to be called after [createEngine], before [startPublishingStream], [startPlayingStream], [startPreview], [createMediaPlayer], [createAudioEffectPlayer] and [createRealTimeSequentialDataManager].
- Caution: Turning on echo cancellation will increase the ear return delay. On the iOS platform, the SDK cannot distinguish between the headset and the external sound card. If you use this function to turn off the system echo cancellation when using the headset, the sound played by the external sound card will be collected when the user accesses the external sound card.
- Related APIs: When the headset is not used, you can set whether the SDK turns on echo cancellation through [enableAEC].
- Platform differences: Only supports iOS and Android.
- Available since: 1.1.0
- Restrictions: None.
SetAECMode
public abstract void SetAECMode(ZegoAECMode mode)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| mode | ZegoAECMode | Echo 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.Not available for WebGL.
EnableAGC
public abstract void EnableAGC(bool enable)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| enable | bool | Whether 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] and before [startPublishingStream], [startPlayingStream], [startPreview], [createMediaPlayer], [createAudioEffectPlayer] and [createRealTimeSequentialDataManager]. that the Mac needs to be called after [startPreview] and before [startPublishingStream].
- 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: Not available for WebGL.
EnableANS
public abstract void EnableANS(bool enable)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| enable | bool | Whether 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: Not available for WebGL.
EnableTransientANS
public abstract void EnableTransientANS(bool enable)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| enable | bool | Whether 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: Not available for WebGL.
SetANSMode
public abstract void SetANSMode(ZegoANSMode mode)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| mode | ZegoANSMode | Audio 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 echo cancellation 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.Not available for WebGL.
StartEffectsEnv
public abstract void StartEffectsEnv()ZegoExpressEngine.csEnable the Effects beauty environment. The SDK uses the specified video frame data type for transmission. The Windows platform only supports video frame raw data, the Apple platform only supports CVPixelBuffer, and the Android platform only supports texture2d.
- Use cases: It is often used in scenes such as video calls and live broadcasts.
- Default value: When this function is not called, the beauty environment is not activated by default.
- When to call: Must be called before calling [startPreview], [startPublishingStream]. If you need to modify the configuration, please call [logoutRoom] to log out of the room first, otherwise it will not take effect.
- Related APIs: [enableEffectsBeauty] switch beauty, [setEffectsBeautyParam] set beauty parameters.
- Caution: This beauty function is the basic function. If it does not meet the expectations of the developer, you can use the custom video pre-processing function [enableCustomVideoProcessing] or the custom video capture function [enableCustomVideoCapture] docking and constructing the AI Effects SDK [ZegoEffects] /ai-effects-android-java/overview/overview for best results.
- Available since: 2.16.0
- Restrictions: This function only supports Android system 5.0 and above, Android SDK version 21 and above. Not available for WebGL.
StopEffectsEnv
public abstract void StopEffectsEnv()ZegoExpressEngine.csDisable the Effects beauty environment.
- Use cases: It is often used in scenes such as video calls and live broadcasts.
- When to call: Must be called before calling [startPreview], [startPublishingStream]. If you need to modify the configuration, please call [logoutRoom] to log out of the room first, otherwise it will not take effect.
- Related APIs: [enableEffectsBeauty] switch beauty, [setEffectsBeautyParam] set beauty parameters.
- Caution: This beauty function is the basic function. If it does not meet the expectations of the developer, you can use the custom video pre-processing function [enableCustomVideoProcessing] or the custom video capture function [enableCustomVideoCapture] docking and constructing the AI Effects SDK [ZegoEffects] for best results.
- Available since: 2.16.0
- Restrictions: This function only supports Android system 5.0 and above, Android SDK version 21 and above. Not available for WebGL.
EnableEffectsBeauty
public abstract void EnableEffectsBeauty(bool enable)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| enable | bool | Whether to enable the beauty effect, true is enabled; false is disabled, and the default is false. |
Details
Support basic beauty functions, including whiten, rosy, smooth, and sharpen.
- Use cases: It is often used in scenes such as video calls and live broadcasts.
- When to call: You must call [startEffectsEnv] to enable the beauty environment before calling this function.
- Default value: When this function is not called, the beauty effect is not enabled by default.
- Related APIs: You can call the [setBeautifyOption] function to adjust the beauty parameters.
- Caution: This beauty function is the basic function. If it does not meet the expectations of the developer, you can use the custom video pre-processing function [enableCustomVideoProcessing] or the custom video capture function [enableCustomVideoCapture] docking and constructing the AI Effects SDK [ZegoEffects] for best results.
- Available since: 2.16.0
- Restrictions: If this function is used on the Android platform, it only supports 5.0 and above, SDK version 21 and above. Not available for WebGL.
SetEffectsBeautyParam
public abstract void SetEffectsBeautyParam(ZegoEffectsBeautyParam param)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| param | ZegoEffectsBeautyParam | Beauty option param. |
Details
Set the beauty parameters, including whiten, rosy, smooth, and sharpen.
- Use cases: It is often used in scenes such as video calls and live broadcasts.
- When to call: You must call [startEffectsEnv] to enable the beauty environment before calling this function.
- Related APIs: You can call [enableEffectsBeauty] to turn on or off the beauty function.
- Available since: 2.16.0
- Restrictions: This function only supports Android system 5.0 and above, Android SDK version 21 and above. Not available for WebGL.
SetAudioEqualizerGain
public abstract void SetAudioEqualizerGain(int bandIndex,float bandGain)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| bandIndex | int | Band frequency index, the value range is [0, 9], corresponding to 10 frequency bands, and the center frequencies are [31, 62, 125, 250, 500, 1K, 2K, 4K, 8K, 16K] Hz. |
| bandGain | float | Band gain for the index, the value range is [-15, 15]. Default value is 0, if all gain values in all frequency bands are 0, EQ function will be disabled. |
Details
Call this function to set the sound equalizer adjust the tone.
- Use cases: Often used in voice chatroom, KTV.
- When to call: It needs to be called after [createEngine].
- Available since: 1.12.0
- Restrictions: Not available for WebGL.
SetVoiceChangerPreset
public abstract void SetVoiceChangerPreset(ZegoVoiceChangerPreset preset)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| preset | ZegoVoiceChangerPreset | The voice changer preset enumeration. |
Details
Call this function to use preset voice changer effect.
- Use cases: Often used in live broadcasting, voice chatroom and KTV.
- When to call: It needs to be called after [createEngine].
- Related APIs: If you need advanced voice changer effect, please use [setVoiceChangerParam]. The effect of using this function together with [setReverbPreset] may be different from what is expected. If you need to use it at the same time, it is recommended to enable the voice changer first, and then enable the reverb. Using ANDROID/ETHEREAL preset voice changer effect will modify reverberation or reverberation echo parameters. Calling [setVoiceChangerParam], [setReverbAdvancedParam], [setReverbEchoParam] may affect the voice changer effect after use these preset voice changer effect. If you need advanced reverb/echo/electronic effects/voice changer effect, please use [setReverbAdvancedParam], [setReverbEchoParam], [setElectronicEffects], [setVoiceChangerParam] together.
- Available since: 1.17.0
- Restrictions: Not available for WebGL.
SetVoiceChangerParam
public abstract void SetVoiceChangerParam(ZegoVoiceChangerParam param)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| param | ZegoVoiceChangerParam | Voice changer parameters. |
Details
Call this function to set custom voice changer effect.
- Use cases: Often used in live broadcasting, voice chatroom and KTV.
- When to call: It needs to be called after [createEngine].
- Related APIs: [setVoiceChangerPreset] provide a set of preset voice changer effects. If you need advanced reverb/echo/voice changer effect, please use [setReverbAdvancedParam], [setReverbEchoParam], [setVoiceChangerParam] together.
- Available since: 1.10.0
- Restrictions: Not available for WebGL.
SetReverbPreset
public abstract void SetReverbPreset(ZegoReverbPreset preset)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| preset | ZegoReverbPreset | The reverberation preset enumeration. |
Details
Call this function to set preset reverb effect.
- Use cases: Often used in live broadcasting, voice chatroom and KTV.
- When to call: It needs to be called after [createEngine]. Support call this function to change preset reverb effect during publishing stream.
- Related APIs: If you need advanced reverb effect, please use [setReverbAdvancedParam]. The effect of using this function together with [setVoiceChangerPreset] may be different from what is expected. If you need to use it at the same time, it is recommended to enable the voice changer first, and then enable the reverb. If you need advanced reverb/echo/voice changer effect, please use [setReverbAdvancedParam], [setReverbEchoParam], [setVoiceChangerParam] together.
- Available since: 1.17.0
- Restrictions: Not available for WebGL.
SetReverbAdvancedParam
public abstract void SetReverbAdvancedParam(ZegoReverbAdvancedParam param)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| param | ZegoReverbAdvancedParam | Reverb advanced parameter. |
Details
Call this function to set preset reverb effect.
- Use cases: Often used in live broadcasting, voice chatroom and KTV.
- When to call: It needs to be called after [createEngine].
- Caution: Different values dynamically set during publishing stream will take effect. When all parameters are set to 0, the reverberation is turned off.
- Related APIs: [setReverbPreset] provide a set of preset reverb effects. If you need advanced reverb/echo/voice changer effect, please use [setReverbAdvancedParam], [setReverbEchoParam], [setVoiceChangerParam] together.
- Available since: 1.10.0
- Restrictions: Not available for WebGL.
SetReverbEchoParam
public abstract void SetReverbEchoParam(ZegoReverbEchoParam param)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| param | ZegoReverbEchoParam | The reverberation echo parameter. |
Details
Call this function to set reverb echo effect. This function can be used with voice changer and reverb to achieve a variety of custom sound effects.
- Use cases: Often used in live broadcasting, voice chatroom and KTV.
- When to call: It needs to be called after [createEngine].
- Related APIs: If you need advanced reverb/echo/voice changer effect, please use [setReverbAdvancedParam], [setReverbEchoParam], [setVoiceChangerParam] together.
- Available since: 1.17.0
- Restrictions: Not available for WebGL.
EnableVirtualStereo
public abstract void EnableVirtualStereo(bool enable,int angle)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| enable | bool | true to turn on the virtual stereo, false to turn off the virtual stereo. |
| angle | int | The angle of the sound source in virtual stereo in the range of -1 ~ 360, with 90 being directly in front, 0 / 180 / 270 corresponding to the rightmost and leftmost respectively. In particular, when set to -1, it is all round virtual stereo effects. |
Details
Call this function to enable / disable the virtual stereo effect when publishing stream.
- Use cases: Often used in live broadcasting, voice chatroom and KTV.
- When to call: It needs to be called after [createEngine].
- Caution: You need to set up a dual channel with [setAudioConfig] for the virtual stereo to take effect.
- Available since: 1.10.0; Starting from 2.15.0, the angle parameter supports setting -1 to present a all round virtual stereo effect.
- Restrictions: Not available for WebGL.
EnablePlayStreamVirtualStereo
public abstract void EnablePlayStreamVirtualStereo(bool enable,int angle,string streamID)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| enable | bool | true to turn on the virtual stereo, false to turn off the virtual stereo. |
| angle | int | The angle of the sound source in virtual stereo in the range of 0 ~ 360, with 90 being directly in front, 0 / 180 / 270 corresponding to the rightmost and leftmost respectively. |
| streamID | string | Stream ID. |
Details
Call this function to enable/disable the virtual stereo effect when playing stream.
- Use cases: Often used in live broadcasting, voice chatroom and KTV.
- When to call: It needs to be called after [createEngine].
- Caution: It can dynamically switch and set angle parameters before and after playing stream. After stopping playing stream, it will automatically reset and disable.
- Available since: 2.8.0
- Restrictions: Not available for WebGL.
SetElectronicEffects
public abstract void SetElectronicEffects(bool enable,ZegoElectronicEffectsMode mode,int tonal)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| enable | bool | true to turn on the electronic sound effect, false to turn off the electronic sound effect. |
| mode | ZegoElectronicEffectsMode | Mode of Electronic Effects reference. |
| tonal | int | The starting pitch of an electric tone in a given mode, representing 12 semitones in one octave of the sound, in the range [0, 11]. |
Details
Call this function to turn on or off the electronic sound effect.
- Use cases: Often used in live broadcasting, voice chatroom and sung unaccompanied scenes.
- Default value: When this function is not called, the electronic sound effect is not enabled by default.
- When to call: It needs to be called after [createEngine].
- Caution: When the mode parameter is Harmonic Minor, the tonal parameter does not take effect.
- Related APIs: Common electronic sound effect configurations can be set via [setVoiceChangerPreset].
- Available since: 2.13.0
- Restrictions: Not available for WebGL.
EnableColorEnhancement
public abstract void EnableColorEnhancement(bool enable,ZegoColorEnhancementParams param,ZegoPublishChannel channel)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| enable | bool | Whether to enable, true: enable, false: disable |
| param | ZegoColorEnhancementParams | Color enhancement parameters. |
| channel | ZegoPublishChannel | Publish stream channel. |
Details
Call this function to enable or disable color enhancement.
- Use cases: Commonly used in video calling, live streaming, and similar scenarios.
- Default value: When this function is not called, color enhancement is not enabled by default.
- When to call: It needs to be called after [createEngine].
- Available since: 3.11.0
CreateRealTimeSequentialDataManager
public abstract ZegoRealTimeSequentialDataManager CreateRealTimeSequentialDataManager(string roomID)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| roomID | string | Fill in the room ID that has been logged in, and all related stuff will be do in this room. |
Details
Create a manager object for sending/receiving real-time signaling.
- Use cases: You can use this function when you need to use real-time signaling to implement services such as cloud games and remote desktops.
- When to call: After logging in to a room.
- Caution: None.
- Restrictions: Only one corresponding manager object can be created for each room ID of [loginRoom], that is, only one object can be created in single room mode, and multiple objects can be created in multi-room mode.Not available for WebGL.
Return
The real-time sequential data manager instance, null will be returned when the maximum number is exceeded.
DestroyRealTimeSequentialDataManager
public abstract void DestroyRealTimeSequentialDataManager(ZegoRealTimeSequentialDataManager manager)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| manager | ZegoRealTimeSequentialDataManager | The real time sequential data manager instance to be destroyed. |
Details
Destroy the [ZegoRealTimeSequentialDataManager] instance object.
- Use cases: When you no longer need to use the real-time signaling function, you can use this function to destroy the instance object created by the [createRealTimeSequentialDataManager] function
- When to call: When you need to the real-time signaling manager object needs to be destroyed
- Caution: None.
- Restrictions: After destroy the instance, you need to release the [ZegoRealTimeSequentialDataManager] instance object you hold by yourself, and don’t call the function of this instance object after the destruction.Not available for WebGL.
SendBroadcastMessage
public abstract void SendBroadcastMessage(string roomID,OnIMSendBroadcastMessageResult onIMSendBroadcastMessageResult,string message)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| roomID | string | Room ID, a string of less 128 bytes in length. Caution: 1. room ID is defined by yourself. 2. Only support numbers, English characters and '~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', '=', '-', '`', ';', '’', ',', '.', '<', '>', ''. 3. If you need to communicate with the Web SDK, please do not use '%'. |
| onIMSendBroadcastMessageResult | OnIMSendBroadcastMessageResult | Send a notification of the result of a broadcast message. Required: No. Caution: Passing [null] means not receiving callback notifications. |
| message | string | The 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
public abstract void SendBarrageMessage(string roomID,OnIMSendBarrageMessageResult onIMSendBarrageMessageResult,string message)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| roomID | string | Room ID, a string of less 128 bytes in length. Caution: 1. room ID is defined by yourself. 2. Only support numbers, English characters and '~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', '=', '-', '`', ';', '’', ',', '.', '<', '>', ''. 3. If you need to communicate with the Web SDK, please do not use '%'. |
| onIMSendBarrageMessageResult | OnIMSendBarrageMessageResult | Send barrage message result callback.Required: No. Caution: Passing [null] means not receiving callback notifications. |
| message | string | The 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
public abstract void SendCustomCommand(string roomID,string command,OnIMSendCustomCommandResult onIMSendCustomCommandResult,List<ZegoUser> toUserList)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| roomID | string | Room ID, a string of less 128 bytes in length. Caution: 1. room ID is defined by yourself. 2. Only support numbers, English characters and '~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', '=', '-', '`', ';', '’', ',', '.', '<', '>', ''. 3. If you need to communicate with the Web SDK, please do not use '%'. |
| command | string | Custom command content. Required: Yes. Value range: The maximum length is 1024 bytes. Caution: To protect privacy, please do not fill in sensitive user information in this interface, including but not limited to mobile phone number, ID number, passport number, real name, etc. |
| onIMSendCustomCommandResult | OnIMSendCustomCommandResult | Send a notification of the signaling result. Required: No. Caution: Passing [null] means not receiving callback notifications. |
| toUserList | List<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
public abstract ZegoMediaPlayer CreateMediaPlayer()ZegoExpressEngine.csCreates 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
public abstract void DestroyMediaPlayer(ZegoMediaPlayer mediaPlayer)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| mediaPlayer | ZegoMediaPlayer | The media player instance object to be destroyed. |
Details
Destroys a media player instance.
- Related APIs: User can call [createMediaPlayer] function to create a media player instance.
- Available since: 2.1.0
CreateAudioEffectPlayer
public abstract ZegoAudioEffectPlayer CreateAudioEffectPlayer()ZegoExpressEngine.csCreates a audio effect player instance.
- Use cases: When you need to play short sound effects, such as applause, cheers, etc., you can use audioEffectPlayer to achieve.
- When to call: It can be called after [createEngine].
- Related APIs: [destroyAudioEffectPlayer].
- Available since: 1.16.0
- Restrictions: Currently, a maximum of 1 instances can be created, after which it will return null.Not available for WebGL.
audio effect player instance, null will be returned when the maximum number is exceeded.
DestroyAudioEffectPlayer
public abstract void DestroyAudioEffectPlayer(ZegoAudioEffectPlayer audioEffectPlayer)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| audioEffectPlayer | ZegoAudioEffectPlayer | The audio effect player instance object to be destroyed. |
Details
Destroys the specified audio effect player instance.
- When to call: It can be called after [createAudioEffectPlayer].
- Related APIs: [createAudioEffectPlayer].
- Available since: 1.16.0
- Restrictions: Not available for WebGL.
StartRecordingCapturedData
public abstract void StartRecordingCapturedData(ZegoDataRecordConfig config,ZegoPublishChannel channel)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| config | ZegoDataRecordConfig | Record config. |
| channel | ZegoPublishChannel | Publishing 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
public abstract void StopRecordingCapturedData(ZegoPublishChannel channel)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| channel | ZegoPublishChannel | Publishing 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.
GetNetworkTimeInfo
public abstract ZegoNetworkTimeInfo GetNetworkTimeInfo()ZegoExpressEngine.csObtain synchronization network time(NTP), including timestamp and maximum deviation.
- Use cases: When performing multi-terminal synchronization behaviors, network time synchronization is required.
- When to call: It needs to be called after [createEngine].
- Available since: 2.9.0
- Restrictions: Not available for WebGL.
StartDumpData
public abstract void StartDumpData(ZegoDumpDataConfig config)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| config | ZegoDumpDataConfig | Dump data config. |
Details
Dump audio, video data.
- Use cases: This is a debugging tool. When there is a problem with audio/video capturing, 3A processing, or other environment processing during publish, you can dump the audio data and upload it to the ZEGO server for further analysis.
- When to call: It needs to be called after [createEngine].
- Caution: It will trigger the [onStartDumpData] callback when data dumping starts. The video dump auto-stops after 30 seconds to prevent excessive storage usage, triggering the [onStopDumpData] callback.
- Related APIs: Call [stopDumpData] to stop dumping data.
- Available since: 3.10.0
- Restrictions: Only support Android and iOS to dump video.
StopDumpData
public abstract void StopDumpData()ZegoExpressEngine.csStop dumping data.
- Use cases: This is a debugging tool. When there is a problem with audio capturing, 3A processing, or other environment processing during publish, you can dump the audio data and upload it to the ZEGO server for further analysis.
- When to call: It needs to be called after [startDumpData].
- Caution: It will trigger the [onUploadDumpData] callback.
- Available since: 3.10.0
- Restrictions: None.
EnableCustomVideoRender
public abstract void EnableCustomVideoRender(bool enable,ZegoCustomVideoRenderConfig config)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| enable | bool | enable or disable |
| config | ZegoCustomVideoRenderConfig | custom video render config |
Details
When enable is true,video custom rendering is enabled; if the value of false, video custom rendering is disabled.
Use case: Use beauty features or apps that use a cross-platform UI framework (for example, Qt requires a complex hierarchical UI to achieve high-experience interaction) or game engine (e.g. Unity, Unreal Engine, Cocos)
- Default value: Custom video rendering is turned off by default when this function is not called.
- When to call: After [createEngine], and before calling [startPreview], [startPublishingStream], [startPlayingStream], [createRealTimeSequentialDataManager]. The configuration can only be modified after the engine is stopped, that is, after [logoutRoom] is called.
- Caution: Custom video rendering can be used in conjunction with custom video capture, but when both are enabled, the local capture frame callback for custom video rendering will no longer be called back, you should directly use the captured video frame from the custom video capture source.
- Related callbacks: Call [setCustomVideoRenderHandler] to set the callback to get video frame data. [onCapturedVideoFrameRawData] local preview video frame data callback, [onRemoteVideoFrameRawData] remote playing stream video frame data callback.
- Available since: 1.9.0
EnableCustomVideoCapture
public abstract void EnableCustomVideoCapture(bool enable,ZegoCustomVideoCaptureConfig config,ZegoPublishChannel channel)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| enable | bool | enable or disable |
| config | ZegoCustomVideoCaptureConfig | custom video capture config |
| channel | ZegoPublishChannel | publish 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
public abstract void SendCustomVideoCaptureRawData(byte[] data,uint dataLength,ZegoVideoFrameParam param,ulong referenceTimeMillisecond,ZegoPublishChannel channel)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| data | byte[] | video frame data |
| dataLength | uint | video frame data length |
| param | ZegoVideoFrameParam | video frame param |
| referenceTimeMillisecond | ulong | video frame reference time, UNIX timestamp, in milliseconds. |
| channel | ZegoPublishChannel | Publishing 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
public abstract void SendCustomVideoCaptureRawData(IntPtr data,uint dataLength,ZegoVideoFrameParam param,ulong referenceTimeMillisecond,ZegoPublishChannel channel)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| data | IntPtr | video frame data |
| dataLength | uint | video frame data length |
| param | ZegoVideoFrameParam | video frame param |
| referenceTimeMillisecond | ulong | video frame reference time, UNIX timestamp, in milliseconds. |
| channel | ZegoPublishChannel | Publishing 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
public abstract void EnableCustomVideoProcessing(bool enable,ZegoCustomVideoProcessConfig config,ZegoPublishChannel channel)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| enable | bool | enable or disable. Required: Yes. |
| config | ZegoCustomVideoProcessConfig | custom video processing configuration. Required: Yes.Caution: If null is passed, the platform default value is used. |
| channel | ZegoPublishChannel | Publishing 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.
SendCustomVideoProcessedRawData
public abstract void SendCustomVideoProcessedRawData(ref IntPtr data,ref uint dataLength,ZegoVideoFrameParam param,ulong referenceTimeMillisecond,ZegoPublishChannel channel)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| data | ref IntPtr | Raw video data. RGB format data storage location is data[0], YUV format data storage location is Y component:data[0], U component:data[1], V component:data[2]. |
| dataLength | ref uint | Raw video data length. RGB format data length storage location is dataLength[0], YUV format data storage location respectively Y component length:dataLength[0], U component length:dataLength[1], V component length:dataLength[2]. |
| param | ZegoVideoFrameParam | video frame param. |
| referenceTimeMillisecond | ulong | video frame reference time, UNIX timestamp, in milliseconds. |
| channel | ZegoPublishChannel | Publishing stream channel.Required: No.Default value: Main publish channel. |
Details
When the developer opens the custom pre-processing, by calling [setCustomVideoProcessHandler], you can set the custom video pre-processing callback to obtain the original video data.
- Use cases: After the developer collects the video data by himself or obtains the video data collected by the SDK, if the basic beauty and watermark functions of the SDK cannot meet the needs of the developer (for example, the beauty effect cannot meet the expectations), the ZegoEffects SDK can be used to perform the video Some special processing, such as beautifying, adding pendants, etc., this process is the pre-processing of custom video.
- When to call: Must be called in the [onCapturedUnprocessedCVPixelbuffer] callback.
- Platform differences: Only valid on Windows platform.
- Available since: 2.4.0
- Restrictions: None.
SendCustomVideoProcessedCVPixelBuffer
public abstract void SendCustomVideoProcessedCVPixelBuffer(IntPtr buffer,ulong timestamp,ZegoPublishChannel channel)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| buffer | IntPtr | CVPixelBuffer type video frame data to be sent to the SDK. |
| timestamp | ulong | Timestamp of this video frame. |
| channel | ZegoPublishChannel | Publishing stream channel. |
Details
When the custom video pre-processing is turned on, the [CVPixelBuffer] format video data after the custom video pre-processing is sent to the SDK, and other channels are supported.
- Use cases: After the developer collects the video data by himself or obtains the video data collected by the SDK, if the basic beauty and watermark functions of the SDK cannot meet the needs of the developer (for example, the beauty effect cannot meet the expectations), the ZegoEffects SDK can be used to perform the video Some special processing, such as beautifying, adding pendants, etc., this process is the pre-processing of custom video.
- When to call: Must be called in the [onCapturedUnprocessedCVPixelbuffer] callback.
- Platform differences: Only valid on Windows platform.
- Available since: 2.2.0 (iOS native), 2.4.0 (macOS C++).
- Restrictions: This interface takes effect when [enableCustomVideoProcessing] is called to enable custom video pre-processing and the bufferType of config is passed in [ZegoVideoBufferTypeCVPixelBuffer] or [ZegoVideoBufferTypeNV12CVPixelBuffer].
SendCustomVideoProcessedTextureData
public abstract void SendCustomVideoProcessedTextureData(int textureID,int width,int height,ulong referenceTimeMillisecond,ZegoPublishChannel channel)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| textureID | int | texture ID. |
| width | int | Texture width. |
| height | int | Texture height. |
| referenceTimeMillisecond | ulong | video frame reference time, UNIX timestamp, in milliseconds. |
| channel | ZegoPublishChannel | Publishing stream channel. |
Details
When the custom video pre-processing is turned on, the [Texture] format video data after the custom video pre-processing is sent to the SDK, and other channels are supported.
- Use cases: After the developer collects the video data by himself or obtains the video data collected by the SDK, if the basic beauty and watermark functions of the SDK cannot meet the needs of the developer (for example, the beauty effect cannot meet the expectations), the ZegoEffects SDK can be used to perform the video Some special processing, such as beautifying, adding pendants, etc., this process is the pre-processing of custom video.
- When to call: Must be called in the [onCapturedUnprocessedTextureData] callback.
- Platform differences: Only valid on Android platform.
- Available since: 2.2.0
- Restrictions: This interface takes effect when [enableCustomVideoProcessing] is called to enable custom video pre-processing and the bufferType of config is passed in [ZegoVideoBufferTypeGLTexture2D].
StartAudioDataObserver
public abstract void StartAudioDataObserver(uint observerBitMask,ZegoAudioFrameParam param)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| observerBitMask | uint | The 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. |
| param | ZegoAudioFrameParam | param of audio frame. |
Details
When custom audio processing is turned on, use this function to turn on audio data callback monitoring.
- Use cases: When develop need to monitor the original audio.
- When to call: After creating the engine.
- Caution: This api will start the media engine and occupy the microphone device.
- Available since: 1.1.0
- Restrictions: Audio monitoring is triggered only after this function has been called and the callback has been set by calling [setAudioDataHandler]. If you want to enable the [onPlayerAudioData] callback, you must also be in the pull stream, and the incoming sampling rate of the [startAudioDataObserver] function is not supported at 8000Hz, 22050Hz, and 24000Hz.Not available for WebGL.
StopAudioDataObserver
public abstract void StopAudioDataObserver()ZegoExpressEngine.csDisable 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
public abstract void EnableCustomAudioIO(bool enable,ZegoCustomAudioConfig config,ZegoPublishChannel channel)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| enable | bool | Whether to enable custom audio IO, default is false. |
| config | ZegoCustomAudioConfig | Custom audio IO config. |
| channel | ZegoPublishChannel | Specify 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
public abstract void SendCustomAudioCaptureAACData(IntPtr data,uint dataLength,uint configLength,ulong referenceTimeMillisecond,uint samples,ZegoAudioFrameParam param,ZegoPublishChannel channel)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| data | IntPtr | AAC buffer data. |
| dataLength | uint | The total length of the buffer data. |
| configLength | uint | The length of AAC specific config (Note: The AAC encoded data length is 'encodedLength = dataLength - configLength').Value range: [0,64] |
| referenceTimeMillisecond | ulong | The UNIX timestamp of this AAC audio frame in millisecond. |
| samples | uint | The number of samples for this AAC audio frame.Value range: [480,512,1024,1960,2048]. |
| param | ZegoAudioFrameParam | The param of this AAC audio frame. |
| channel | ZegoPublishChannel | Publish 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
public abstract void SendCustomAudioCapturePCMData(IntPtr data,uint dataLength,ZegoAudioFrameParam param,ZegoPublishChannel channel)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| data | IntPtr | PCM buffer data. |
| dataLength | uint | The total length of the buffer data. |
| param | ZegoAudioFrameParam | The param of this PCM audio frame. |
| channel | ZegoPublishChannel | Publish 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: Not available for WebGL.
FetchCustomAudioRenderPCMData
public abstract void FetchCustomAudioRenderPCMData(IntPtr data,uint dataLength,ZegoAudioFrameParam param)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| data | IntPtr | 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. |
| dataLength | uint | The length of the audio data to be fetch this time (dataLength = duration * sampleRate * channels * 2(16 bit depth i.e. 2 Btye)). |
| param | ZegoAudioFrameParam | Specify the parameters of the fetched audio frame. sampleRate in ZegoAudioFrameParam must assignment |
Details
Fetches PCM audio data of the remote stream from the SDK for custom audio rendering, it is recommended to use the system framework to periodically invoke this function to drive audio data rendering.
- Use cases: When developers have their own rendering requirements, such as special applications or processing and rendering of the original PCM data that are pulled, it is recommended to use the custom audio rendering function of the SDK.
- When to call: After [enableCustomAudioIO] and playing stream successfully.
- Related APIs: Enable the custom audio IO function [enableCustomAudioIO], and start the play stream [startPlayingStream].
- Available since: 1.10.0
- Restrictions: Not available for WebGL.
CreateRangeAudio
public abstract ZegoRangeAudio CreateRangeAudio()ZegoExpressEngine.csCreates a range audio instance. Use case: Often used in game voice scenarios, users can use related functions by creating range audio instance objects.
- When to call: It can be called after the engine by [createEngine] has been initialized.
- Impacts on other APIs: If you use the range audio module, you cannot use the basic push-pull stream [startPublishingStream], [startPlayingStream] interfaces and related callbacks.
- Available since: 2.11.0
- Restrictions: Currently, a maximum of 1 instances can be created, after which it will return null.Not available for WebGL.
range audio instance, null will be returned when the maximum number is exceeded.
DestroyRangeAudio
public abstract void DestroyRangeAudio(ZegoRangeAudio rangeAudio)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| rangeAudio | ZegoRangeAudio | The range audio instance object to be destroyed. |
Details
Destroys a range audio instance.
- Available since: 2.11.0
- Restrictions: Not available for WebGL.
CreateCopyrightedMusic
public abstract ZegoCopyrightedMusic CreateCopyrightedMusic()ZegoExpressEngine.csCreates 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
public abstract void DestroyCopyrightedMusic(ZegoCopyrightedMusic copyrightedMusic)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| copyrightedMusic | ZegoCopyrightedMusic | The copyrighted music instance object to be destroyed. |
Details
Destroys a copyrighted music instance.
- When to call: It can be called before the engine by [destroyEngine]
- Available since: 2.13.0
CreateRangeScene
public abstract ZegoRangeScene CreateRangeScene()ZegoExpressEngine.csCreate a range scene instance object. Use case: Often used in meta world scenarios, users can use related functions by range scene instance objects.
- When to call: After initializing the engine by [createEngine].
- Available since: 3.0.0
- Restrictions: None.
range scene instance object.
DestroyRangeScene
public abstract void DestroyRangeScene(ZegoRangeScene rangeScene)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| rangeScene | ZegoRangeScene | The range scene instance object to be destroyed. |
Details
Destroy a range scene instance.
- When to call: After create the range scene by [createRangeScene].
- Available since: 3.0.0
- Restrictions: Not available for WebGL.
GetScreenCaptureSources
public abstract List<ZegoScreenCaptureSourceInfo> GetScreenCaptureSources(int thumbnailWidth,int thumbnailHeight,int iconWidth,int iconHeight)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| thumbnailWidth | int | Get the thumbnail width corresponding to the window, the thumbnail can be used to draw on the window selection interface. (unit is pixel) |
| thumbnailHeight | int | Get the thumbnail height corresponding to the window, the thumbnail can be used to draw on the window selection interface. (unit is pixel) |
| iconWidth | int | Get the width of the icon corresponding to the program. (unit is pixel) |
| iconHeight | int | Get the height of the icon corresponding to the program. (unit is pixel) |
Details
Get a list of screens or windows in a screen.
- Available since: 3.1.0
- Restrictions: Only support in Windows/macOS.
Return
List of capture source info objects.
CreateScreenCaptureSource
public abstract ZegoScreenCaptureSource CreateScreenCaptureSource(long sourceId,ZegoScreenCaptureSourceType sourceType)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| sourceId | long | The specified screen ID or window ID. |
| sourceType | ZegoScreenCaptureSourceType | The specified screen source type. |
Details
Creates a screen capture source object based on the provided source ID and source type.
- Use cases: It is used when you need to record and share the screen or window.
- When to call: It needs to be called after [createEngine].
- Platform differences: Only supports Windows and macOS.
Return
The screen capture instance, null will be returned when the maximum number is exceeded.
DestroyScreenCaptureSource
public abstract void DestroyScreenCaptureSource(ZegoScreenCaptureSource source)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| source | ZegoScreenCaptureSource | The screen capture source instance to be destroyed. |
Details
Destroy the [ZegoScreenCaptureSource] instance object.
- Use cases: When you no longer need to use the screen capture function, you can use this function to destroy the instance object created by the [createScreenCaptureSource] function
- When to call: When you need to the screen capture source object needs to be destroyed
- Platform differences: Only supports Windows and macOS.
- Restrictions: After destroy the instance, you need to release the [ZegoScreenCaptureSource] instance object you hold by yourself, and don’t call the function of this instance object after the destruction.
SetAppGroupID
public abstract void SetAppGroupID(string groupID)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| groupID | string | The host app and the extension app should belong to the same App Group, and the AppGroupID needs to be passed in here. |
- Use cases: You need to use the iOS cross-process screen sharing function, and you need to start the App Group, which can provide better performance and stability. Must be used with [setupWithAppGroupID:] in the
ZegoReplayKitextension class. - When to call: Called after [createEngine], before calling [startScreenCapture].
- Available since: 3.3.0
- Restrictions: Only available on iOS platform.
StartScreenCaptureInApp
public abstract void StartScreenCaptureInApp(ZegoScreenCaptureConfig config)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| config | ZegoScreenCaptureConfig | Screen capture parameter configuration. |
Details
Start screen capture.
- When to call: After calling the [setVideoSource]、[setAudioSource] function to set the capture source to
ScreenCapture.
- Available since: 3.1.0
- Restrictions: Only valid for iOS system
StartScreenCapture
public abstract void StartScreenCapture(ZegoScreenCaptureConfig config)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| config | ZegoScreenCaptureConfig | Screen capture parameter configuration. |
Details
Start screen capture.
- When to call: After calling the [setVideoSource]、[setAudioSource] function to set the capture source to
ScreenCapture.
- Available since: 3.6.0
StopScreenCapture
public abstract void StopScreenCapture()ZegoExpressEngine.csStop screen capture.
- Available since: 3.1.0
UpdateScreenCaptureConfig
public abstract void UpdateScreenCaptureConfig(ZegoScreenCaptureConfig config)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| config | ZegoScreenCaptureConfig | Screen capture parameter configuration. |
Details
Update screen capture parameter configuration.
- When to call: After calling [startScreenCapture] to start capturing.
- Available since: 3.1.0
- Restrictions: Only valid for iOS system. Only available on iOS 12.0 or newer
EnableBeautify
public abstract void EnableBeautify(int featureBitmask,ZegoPublishChannel channel)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| featureBitmask | int | Beauty features, bitmask format, you can choose to enable several features in [ZegoBeautifyFeature] at the same time |
| channel | ZegoPublishChannel | Publishing 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.
SetBeautifyOption
public abstract void SetBeautifyOption(ZegoBeautifyOption option,ZegoPublishChannel channel)ZegoExpressEngine.csParameters
| Name | Type | Description |
|---|---|---|
| option | ZegoBeautifyOption | Beautify option. |
| channel | ZegoPublishChannel | stream 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.
ZegoMediaPlayer
Declared in ZegoMediaPlayer.cs
Methods
SetVideoHandler
public abstract void SetVideoHandler(OnVideoFrame onVideoFrame,ZegoVideoFrameFormat format)ZegoMediaPlayer.csParameters
| Name | Type | Description |
|---|---|---|
| onVideoFrame | OnVideoFrame | Video data callback handler for media player |
| format | ZegoVideoFrameFormat | Video frame format for video data |
Details
By setting this callback, the video data of the media resource file played by the media player can be called back.
- When to call: After the [ZegoMediaPlayer] instance created.
- Caution: When you no longer need to get the video frame data, please call this function again to clear the handler to stop the video frame data callback.
- Available since: 2.1.0
- Restrictions: Not available for WebGL.
SetAudioHandler
public abstract void SetAudioHandler(OnAudioFrame onAudioFrame)ZegoMediaPlayer.csParameters
| Name | Type | Description |
|---|---|---|
| onAudioFrame | OnAudioFrame | Audio data callback handler for media player |
Details
By setting this callback, the audio data of the media resource file played by the media player can be called back.
- When to call: After the [ZegoMediaPlayer] instance created.
- Caution: When you no longer need to get the audio data, please call this function again to clear the handler to stop the audio data callback.
- Available since: 2.1.0
- Restrictions: Not available for WebGL.
LoadResource
public abstract void LoadResource(string path,OnMediaPlayerLoadResourceCallback callback)ZegoMediaPlayer.csParameters
| Name | Type | Description |
|---|---|---|
| path | string | The absolute resource path or the URL of the network resource and cannot be null or "". Android can set this path string with Uri. |
| callback | OnMediaPlayerLoadResourceCallback | Notification of resource loading results |
Details
Load media resources. Use case: Developers can load the absolute path to the local resource or the URL of the network resource incoming.
- When to call: It can be called after the engine by [createEngine] has been initialized and the media player has been created by [createMediaPlayer].
- Related APIs: Resources can be loaded through the [loadResourceWithPosition] or [loadResourceFromMediaData] function.
- Caution: If the mediaplayer has already loaded resources or is in the process of playing, please first call the [stop] interface to halt the playback, and then proceed to call the interface to load the media resources; failure to do so will result in an unsuccessful load.
- Restrictions: Not available for WebGL.
Return
Callback result of loading media resource.
LoadResourceWithPosition
public abstract void LoadResourceWithPosition(string path,long startPosition,OnMediaPlayerLoadResourceCallback callback)ZegoMediaPlayer.csParameters
| Name | Type | Description |
|---|---|---|
| path | string | The absolute resource path or the URL of the network resource and cannot be null or "". Android can set this path string with Uri. |
| startPosition | long | The progress at which the playback started. |
| callback | OnMediaPlayerLoadResourceCallback | Notification of resource loading results |
Details
Load media resources, and specify the progress, in milliseconds, at which playback begins. Use case: Developers can load the absolute path to the local resource or the URL of the network resource incoming.
- When to call: It can be called after the engine by [createEngine] has been initialized and the media player has been created by [createMediaPlayer].
- Related APIs: Resources can be loaded through the [loadResource] or [loadResourceFromMediaData] function.
- Caution: 1.When [startPosition] exceeds the total playing time, it will start playing from the beginning. 2.If the mediaplayer has already loaded resources or is in the process of playing, please first call the [stop] interface to halt the playback, and then proceed to call the interface to load the media resources; failure to do so will result in an unsuccessful load.
- Restrictions: Not available for WebGL.
Return
Callback result of loading media resource.
LoadResourceFromMediaData
public abstract void LoadResourceFromMediaData(IntPtr mediaData,int mediaDataLength,long startPosition,OnMediaPlayerLoadResourceCallback callback)ZegoMediaPlayer.csParameters
| Name | Type | Description |
|---|---|---|
| mediaData | IntPtr | Binary audio data. |
| mediaDataLength | int | The length of the binary audio data. |
| startPosition | long | Position of starting playback, in milliseconds. |
| callback | OnMediaPlayerLoadResourceCallback | Notification of resource loading results. |
Details
Load binary audio data. Use case: Developers do not want to cache the audio data locally, and directly transfer the audio binary data to the media player, directly load and play the audio.
- When to call: It can be called after the engine by [createEngine] has been initialized and the media player has been created by [createMediaPlayer].
- Related APIs: Resources can be loaded through the [loadResource] or [loadResourceWithPosition] function.
- Caution: 1.When [startPosition] exceeds the total playing time, it will start playing from the beginning. 2.If the mediaplayer has already loaded resources or is in the process of playing, please first call the [stop] interface to halt the playback, and then proceed to call the interface to load the media resources; failure to do so will result in an unsuccessful load.
- Restrictions: Not available for WebGL.
Return
Callback result of loading media resource.
LoadCopyrightedMusicResourceWithPosition
public abstract void LoadCopyrightedMusicResourceWithPosition(string resourceID,long startPosition,OnMediaPlayerLoadResourceCallback callback)ZegoMediaPlayer.csParameters
| Name | Type | Description |
|---|---|---|
| resourceID | string | The resource ID obtained from the copyrighted music module. |
| startPosition | long | The progress at which the playback started. |
| callback | OnMediaPlayerLoadResourceCallback | Notification of resource loading results |
Details
Load media resources, and specify the progress, in milliseconds, at which playback begins. Use case: Developers can load the resource ID of copyrighted music.
- When to call: It can be called after the engine by [createEngine] has been initialized and the media player has been created by [createMediaPlayer].
- Caution: 1.When [startPosition] exceeds the total playing time, it will start playing from the beginning. 2.If the mediaplayer has already loaded resources or is in the process of playing, please first call the [stop] interface to halt the playback, and then proceed to call the interface to load the media resources; failure to do so will result in an unsuccessful load.
Return
Callback result of loading media resource.
LoadResourceWithConfig
public abstract void LoadResourceWithConfig(ZegoMediaPlayerResource resource,OnMediaPlayerLoadResourceCallback callback)ZegoMediaPlayer.csParameters
| Name | Type | Description |
|---|---|---|
| resource | ZegoMediaPlayerResource | Multimedia resources that need to be loaded. |
| callback | OnMediaPlayerLoadResourceCallback | Notification of resource loading results |
Details
Load media resources. Use case: Developers can load the absolute path to the local resource or the URL of the network resource incoming.
- When to call: Called after the engine [createEngine] has been initialized and the media player [createMediaPlayer] has been created.
- Related APIs: Support for loading resources through the [loadResourceWithPosition] or [loadResourceFromMediaData] interface.
- Caution: If the mediaplayer has already loaded resources or is in the process of playing, please first call the [stop] interface to halt the playback, and then proceed to call the interface to load the media resources; failure to do so will result in an unsuccessful load.
- Restrictions: Not available for WebGL.
Return
Callback result of loading media resource.
Start
public abstract void Start()ZegoMediaPlayer.csYou need to load resources before playing
Stop
public abstract void Stop()ZegoMediaPlayer.csPause
public abstract void Pause()ZegoMediaPlayer.csResume
public abstract void Resume()ZegoMediaPlayer.csSeekTo
public abstract void SeekTo(ulong millisecond,OnMediaPlayerSeekToCallback callback)ZegoMediaPlayer.csParameters
| Name | Type | Description |
|---|---|---|
| millisecond | ulong | Point in time of specified playback progress |
| callback | OnMediaPlayerSeekToCallback | The result notification of set the specified playback progress |
Details
Unit is millisecond
Return
The result notification of set the specified playback progress
EnableRepeat
public abstract void EnableRepeat(bool enable)ZegoMediaPlayer.cs| Name | Type | Description |
|---|---|---|
| enable | bool | repeat playback flag. The default is false. |
SetPlayLoopCount
public abstract void SetPlayLoopCount(int count)ZegoMediaPlayer.csParameters
| Name | Type | Description |
|---|---|---|
| count | int | the count of play loops. |
Details
Set the count of play loops.
- Use cases: Users can call this function when they need to use the media player to loop playback resources.
- When to call /Trigger: It can be called after the engine by [createEngine] has been initialized and the media player has been created by [createMediaPlayer].
- Caution: Please note that after using this interface, the [enableRepeat] interface will become invalid.
- Restrictions: None.
SetPlaySpeed
public abstract void SetPlaySpeed(float speed)ZegoMediaPlayer.csParameters
| Name | Type | Description |
|---|---|---|
| speed | float | The speed of play. The default is 1.0. Versions 2.12.0 to 3.15.1: The range is 0.5 ~ 4.0. Versions 3.16.0 and above: The range is 0.3 ~ 4.0. |
Details
Set the playback speed of the player.
- When to call: You should load resource before invoking this function.
- Related APIs: Resources can be loaded through the [loadResource] function.
- Available since: 2.12.0
- Restrictions: None.
EnableAux
public abstract void EnableAux(bool enable)ZegoMediaPlayer.csParameters
| Name | Type | Description |
|---|---|---|
| enable | bool | Aux audio flag. The default is false. |
Details
This interface will only mix the media player sound into the main channel
MuteLocal
public abstract void MuteLocal(bool mute)ZegoMediaPlayer.csParameters
| Name | Type | Description |
|---|---|---|
| mute | bool | Mute local audio flag, The default is false. |
Details
If [enableAux] switch is turned on, there is still sound in the publishing stream. The default is false.
SetVolume
public abstract void SetVolume(int volume)ZegoMediaPlayer.cs| Name | Type | Description |
|---|---|---|
| volume | int | The range is 0 ~ 200. The default is 60. |
SetPlayVolume
public abstract void SetPlayVolume(int volume)ZegoMediaPlayer.cs| Name | Type | Description |
|---|---|---|
| volume | int | The range is 0 ~ 200. The default is 60. |
SetPublishVolume
public abstract void SetPublishVolume(int volume)ZegoMediaPlayer.cs| Name | Type | Description |
|---|---|---|
| volume | int | The range is 0 ~ 200. The default is 60. |
SetProgressInterval
public abstract void SetProgressInterval(ulong millisecond)ZegoMediaPlayer.csParameters
| Name | Type | Description |
|---|---|---|
| millisecond | ulong | Interval of playback progress callback in milliseconds |
Details
This function can control the callback frequency of [onMediaPlayerPlayingProgress]. When the callback interval is set to 0, the callback is stopped. The default callback interval is 1s This callback are not returned exactly at the set callback interval, but rather at the frequency at which the audio or video frames are processed to determine whether the callback is needed to call
GetPlayVolume
public abstract int GetPlayVolume()ZegoMediaPlayer.cscurrent volume
GetPublishVolume
public abstract int GetPublishVolume()ZegoMediaPlayer.cscurrent volume
GetTotalDuration
public abstract ulong GetTotalDuration()ZegoMediaPlayer.csYou should load resource before invoking this function, otherwise the return value is 0
Unit is millisecond
GetCurrentProgress
public abstract ulong GetCurrentProgress()ZegoMediaPlayer.csYou should load resource before invoking this function, otherwise the return value is 0
current progress
GetCurrentRenderingProgress
public abstract ulong GetCurrentRenderingProgress()ZegoMediaPlayer.csYou should load resource before invoking this function, otherwise the return value is 0
current rendering progress
GetAudioTrackCount
public abstract uint GetAudioTrackCount()ZegoMediaPlayer.csNumber of audio tracks
SetAudioTrackIndex
public abstract void SetAudioTrackIndex(uint index)ZegoMediaPlayer.cs| Name | Type | Description |
|---|---|---|
| index | uint | Audio track index, the number of audio tracks can be obtained through the [getAudioTrackCount] function. |
EnableVoiceChanger
public abstract void EnableVoiceChanger(ZegoMediaPlayerAudioChannel audioChannel,bool enable,ZegoVoiceChangerParam param)ZegoMediaPlayer.csParameters
| Name | Type | Description |
|---|---|---|
| audioChannel | ZegoMediaPlayerAudioChannel | The audio channel to be voice changed |
| enable | bool | Whether enable voice changer or not. True - enabled, false - disabled, default value is false. |
| param | ZegoVoiceChangerParam | Voice changer parameters |
Details
Enable voice changer, set up the specific voice changer parameters.
- When to call: It can be called after the engine by [createEngine] has been initialized and the media player has been created by [createMediaPlayer].
- Available since: 3.15.0
GetCurrentState
public abstract ZegoMediaPlayerState GetCurrentState()ZegoMediaPlayer.cscurrent state
GetIndex
public abstract int GetIndex()ZegoMediaPlayer.csGet media player index.
- When to call: It can be called after [createMediaPlayer].
- Restrictions: None.
Media player index.
EnableAccurateSeek
public abstract void EnableAccurateSeek(bool enable,ZegoAccurateSeekConfig config)ZegoMediaPlayer.csParameters
| Name | Type | Description |
|---|---|---|
| enable | bool | Whether to enable accurate seek |
| config | ZegoAccurateSeekConfig | The property setting of accurate seek, only valid when enable is true. |
Details
The timestamp specified by normal seek may not an I frame, and then returns the I frame near the specified timestamp, which is not so accurate. But the accurate seek, when the specified timestamp is not an I frame, it will use the I frame near the specified timestamp to decode the frame of the specified timestamp.
- Use cases: When user needs to seek to the specified timestamp accurately.
- When to call: The setting must be called before [loadResource], and it will take effect during the entire life cycle of the media player.
- Available since: 2.4.0
SetNetWorkResourceMaxCache
public abstract void SetNetWorkResourceMaxCache(uint time,uint size)ZegoMediaPlayer.csParameters
| Name | Type | Description |
|---|---|---|
| time | uint | The maximum length of the cache time, in ms, the SDK internal default is 5000; the effective value is greater than or equal to 2000; if you fill in 0, it means no limit. |
| size | uint | The maximum size of the cache, the unit is byte, the internal default size of the SDK is 1510241024 byte; the effective value is greater than or equal to 5000000, if you fill in 0, it means no limit. |
Details
The setting must be called before loading the resource, and it will take effect during the entire life cycle of the media player. Time and size are not allowed to be 0 at the same time. The SDK internal default time is 5000, and the size is 1510241024 byte.When one of time and size reaches the set value first, the cache will stop. When loading resources with a non-empty onlineResourceCachePath, the cache is controlled by maxCachePendingLength. This configuration is invalid.
GetNetWorkResourceCache
public abstract ZegoNetWorkResourceCache GetNetWorkResourceCache()ZegoMediaPlayer.csReturns the current cached information, including the length of time the data can be played and the size of the cached data.
SetNetWorkBufferThreshold
public abstract void SetNetWorkBufferThreshold(uint threshold)ZegoMediaPlayer.csParameters
| Name | Type | Description |
|---|---|---|
| threshold | uint | Threshold that needs to be reached to resume playback, unit ms. |
Details
The setting must be called before loading the resource, and it will take effect during the entire life cycle of the media player.
When the network status is poor and the media player has finished playing the cached network resources, it will stop playing, and notify the user through the ZegoMediaPlayerNetworkEvent.BUFFER_BEGIN state of the callback interface onMediaPlayerNetworkEvent that the network resources are being recached.
Only when the cached network resources are greater than the set threshold, the media player will automatically resume playback at the original paused position, and notify the user through the ZegoMediaPlayerNetworkEvent.BUFFER_ENDED of the callback interface onMediaPlayerNetworkEvent that the user has cached the network resources The threshold was reached and playback resumed.
EnableSoundLevelMonitor
public abstract void EnableSoundLevelMonitor(bool enable,uint millisecond)ZegoMediaPlayer.csParameters
| Name | Type | Description |
|---|---|---|
| enable | bool | Whether to enable monitoring, true is enabled, false is disabled. |
| millisecond | uint | Monitoring time period of the sound level, in milliseconds, has a value range of [100, 3000]. |
Details
Whether to enable sound level monitoring.
- When to call: It can be called after the engine by [createEngine] has been initialized and the media player has been created by [createMediaPlayer].
- Related callbacks: After it is turned on, user can use the [onMediaPlayerSoundLevelUpdate] callback to monitor sound level updates.
- Available since: 2.15.0
- Restrictions: None.
EnableFrequencySpectrumMonitor
public abstract void EnableFrequencySpectrumMonitor(bool enable,uint millisecond)ZegoMediaPlayer.csParameters
| Name | Type | Description |
|---|---|---|
| enable | bool | Whether to enable monitoring, true is enabled, false is disabled. |
| millisecond | uint | Monitoring time period of the frequency spectrum, in milliseconds, has a value range of [10, 3000]. Note that on v3.19.0 and older version, the value range is [100, 3000]. |
Details
Whether to enable frequency spectrum monitoring.
- When to call: It can be called after the engine by [createEngine] has been initialized and the media player has been created by [createMediaPlayer].
- Related APIs: After it is turned on, user can use the [onMediaPlayerFrequencySpectrumUpdate] callback to monitor frequency spectrum updates.
- Available since: 2.15.0
- Restrictions: None.
UpdatePosition
public abstract void UpdatePosition(float[] position)ZegoMediaPlayer.csParameters
| Name | Type | Description |
|---|---|---|
| position | float[] | The unit vector of the front axis of its own coordinate system. The parameter is a float array with a length of 3. |
Details
Update the position of the media player (audio source).
- Use cases: The media player also needs to have 3D spatial sound.
- When to call: It can be called after the engine by [createEngine] has been initialized and the media player has been created by [createMediaPlayer].
- Available since: 3.6.0
- Restrictions: This interface needs to be used in conjunction with the RangeAudio/RangeScene module. This interface can only be called successfully after the RangeAudio/RangeScene module enables 3D sound effects.
SetHttpHeader
public abstract void SetHttpHeader(Dictionary<string, string> headers)ZegoMediaPlayer.csParameters
| Name | Type | Description |
|---|---|---|
| headers | Dictionary<string, string> | Headers info. |
Details
Call this function to set the http headers of the http network resource.
- Use cases: When the network resource needs to set special header information.
- When to call: It can be called after the engine by [createEngine] has been initialized and the media player has been created by [createMediaPlayer].
- Available since: 3.8.0
- Restrictions: Called before the corresponding network resource is loaded.
SetPlayMediaStreamType
public abstract void SetPlayMediaStreamType(ZegoMediaStreamType streamType)ZegoMediaPlayer.csParameters
| Name | Type | Description |
|---|---|---|
| streamType | ZegoMediaStreamType | Stream type. |
Details
Configure the media stream type to be played. You can only play video streams or audio streams. This will take effect during the life cycle of the media player.
- Use cases: When only the video stream or audio stream needs to be played.
- When to call: It can be called after the engine by [createEngine] has been initialized and the media player has been created by [createMediaPlayer].
- Caution: Changing the media stream type during playing will take effect in the next playing.
- Available since: 3.10.0
EnableLocalCache
public abstract void EnableLocalCache(bool enable,string cacheDir)ZegoMediaPlayer.csParameters
| Name | Type | Description |
|---|---|---|
| enable | bool | Whether to enable local caching. |
| cacheDir | string | Cache dir. If left blank, the directory specified internally by SDK will be used. |
Details
When playing http/https network resources, when the local cache is enabled, the network resources will be saved locally and the cache information will be called back through [onMediaPlayerLocalCache].
- When to call: It can be called after the engine by [createEngine] has been initialized and the media player has been created by [createMediaPlayer]. Called after [loadResource] or during playback, it will take effect next playback.
- Caution: Only http/https single file type network resources are supported. If there is a [seek] operation during playback, the cache will fail.
- Available since: 3.12.0
- Restrictions: Not available for WebGL.
SetVoiceChangerParam
public abstract void SetVoiceChangerParam(ZegoMediaPlayerAudioChannel audioChannel,ZegoVoiceChangerParam param)ZegoMediaPlayer.cs| Name | Type | Description |
|---|---|---|
| audioChannel | ZegoMediaPlayerAudioChannel | The audio channel to be voice changed |
| param | ZegoVoiceChangerParam | Voice changer parameters |
ZegoRangeAudio
Declared in ZegoRangeAudio.cs
Methods
SetAudioReceiveRange
public abstract void SetAudioReceiveRange(float range)ZegoRangeAudio.csParameters
| Name | Type | Description |
|---|---|---|
| range | float | the audio range, the value must be greater than or equal to 0. |
Details
Set the audio receiving range, the audio source sound beyond this range will not be received.
Use case: Set the receiver's receiving range in the World mode.
- Default value: When this function is not called, only the voices of the members in the team can be received, and all voices outside the team cannot be received.
- When to call: After initializing the range audio [createRangeAudio].
- Available since: 2.11.0
- Restrictions: This range only takes effect for people outside the team.Not available for WebGL.
SetAudioReceiveRange
public abstract int SetAudioReceiveRange(ZegoReceiveRangeParam param)ZegoRangeAudio.csParameters
| Name | Type | Description |
|---|---|---|
| param | ZegoReceiveRangeParam | Configuration of audio receiving range. |
Details
Set the audio receiving range, the audio source sound beyond this range will not be received.
Use case: Set the receiver's receiving range in the World mode.
- Default value: When this function is not called, only the voices of the members in the team can be received, and all voices outside the team cannot be received.
- When to call: After initializing the range audio [createRangeAudio].
- Available since: 3.7.0
- Restrictions: This range only takes effect for people outside the team.
Return
Error code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details.
SetRangeAudioVolume
public abstract void SetRangeAudioVolume(int volume)ZegoRangeAudio.csParameters
| Name | Type | Description |
|---|---|---|
| volume | int | volume, [0,200]. |
Details
Set range voice volume. Use case: This interface allows you to increase or decrease the volume of a range voice stream when the user calls [startPlayingStream] and pulls another stream.
- Default value: 100.
- When to call: After initializing the range audio [createRangeAudio].
- Available since: 2.23.0
- Restrictions: Not available for WebGL.
SetStreamVocalRange
public abstract int SetStreamVocalRange(string streamID,ZegoVocalRangeParam param)ZegoRangeAudio.csParameters
| Name | Type | Description |
|---|---|---|
| streamID | string | play stream id |
| param | ZegoVocalRangeParam | Flow sound range. |
Details
Set range voice volume. Use case: When a user calls [startPlayingStream] and pulls another stream, the stream has a range speech effect by setting the range of sounds for that stream and calling [updateStreamPosition]. After the call will be the sound source of the sound range of the distance attenuation effect.
- When to call: After initializing the range audio [createRangeAudio] and after [startPlayingStream].
- Caution: When calling [enableMicrophone] to enable range speech, the resource of the stream will be switched to RTC, regardless of whether the resource specified when [startPlayingStream] was originally called to pull the stream is RTC. If you really need to specify the resource of the stream as CDN, please configure it to pull a custom CDN stream and specify the CDN address information.
- Available since: 3.7.0
Return
Error code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details.
UpdateSelfPosition
public abstract void UpdateSelfPosition(float[] position,float[] axisForward,float[] axisRight,float[] axisUp)ZegoRangeAudio.csParameters
| Name | Type | Description |
|---|---|---|
| position | float[] | The coordinates of the oneself in the world coordinate system. The parameter is a float array of length 3. The three values represent the front, right, and top coordinate values in turn. |
| axisForward | float[] | The unit vector of the front axis of its own coordinate system. The parameter is a float array with a length of 3. The three values represent the front, right, and top coordinate values in turn. |
| axisRight | float[] | The unit vector of the right axis of its own coordinate system. The parameter is a float array with a length of 3. The three values represent the front, right, and top coordinate values in turn. |
| axisUp | float[] | The unit vector of the up axis of its own coordinate system. The parameter is a float array with a length of 3. The three values represent the front, right, and top coordinate values in turn. |
Details
Update the user's position and orientation so that the SDK can calculate the distance between the user and the audio source and the stereo effect of the left and right ears. Use case: When the role operated by the user in the game moves on the world map, the position information and head orientation of the role are updated.
- When to call: Called after logging in to the room [loginRoom].
- Caution: Before calling [enableSpeaker] to turn on the speaker, if you do not call this interface to set the location information, you will not be able to receive voices from other people except the team.
- Available since: 2.11.0
- Restrictions: Not available for WebGL.
UpdateAudioSource
public abstract void UpdateAudioSource(string userID,float[] position)ZegoRangeAudio.csParameters
| Name | Type | Description |
|---|---|---|
| userID | string | The userID of the sound source. |
| position | float[] | The coordinates of the speaker in the world coordinate system. The parameter is a float array of length 3. The three values represent the front, right, and top coordinate values in turn. |
Details
Set the position of the audio source corresponding to the userID on the game map in the room, so that the SDK can calculate the distance and orientation of the listener to the audio source. Use case: Update the position of the voice user in the game map coordinates.
- When to call: Call [loginRoom] to call after logging in to the room, and the recorded audio source information will be cleared after logging out of the room.
- Available since: 2.11.0
- Restrictions: Not available for WebGL.
EnableSpatializer
public abstract void EnableSpatializer(bool enable)ZegoRangeAudio.csParameters
| Name | Type | Description |
|---|---|---|
| enable | bool | Whether to enable 3D sound effects. |
Details
After the 3D sound effect is turned on, the sound effect in the actual space will be simulated according to the position of the speaker equivalent to the listener. The intuitive feeling is that the sound size and the left and right sound difference will also change when the distance and orientation of the sound source change. Use case: It is a feature of audio recognition in FPS games or social scene games.
- Default value: When this function is not called, 3D sound effects are turned off by default.
- When to call: After initializing the range audio [createRangeAudio].
- Caution: The 3D audio effect will only take effect when [setRangeAudioMode] is called and set to
Worldmode. - Related APIs: After enabling the 3D sound effect, you can use [updateAudioSource] or [updateSelfPosition] to change the position and orientation to experience the 3D effect.
- Available since: 2.11.0
- Restrictions: Not available for WebGL.
EnableMicrophone
public abstract void EnableMicrophone(bool enable)ZegoRangeAudio.csParameters
| Name | Type | Description |
|---|---|---|
| enable | bool | Whether to turn on the microphone. |
Details
When enable is true, turn on the microphone and push audio stream; when it is false, turn off the microphone and stop pushing audio stream.
Use case: The user turns on or off the microphone to communicate in the room.
- Default value: When this function is not called, the microphone is turned off by default.
- When to call: After initializing the range audio [createRangeAudio] and login room [loginRoom].
- Caution: Turning on the microphone will automatically use the main channel to push the audio stream.
- Related callbacks: Get the microphone switch state change through the callback [onRangeAudioMicrophoneStateUpdate].
- Available since: 2.11.0
EnableSpeaker
public abstract void EnableSpeaker(bool enable)ZegoRangeAudio.csParameters
| Name | Type | Description |
|---|---|---|
| enable | bool | Whether to turn on the speaker. |
Details
When enable is true, turn on the speaker and play audio stream; when it is false, turn off the speaker and stop playing audio stream.
Use case: The user turns on or off the speaker to communicate in the room.
- Default value: When this function is not called, the speaker is turned off by default.
- When to call: After initializing the range audio [createRangeAudio] and login room [loginRoom].
- Caution: Turning on the speaker will automatically pull the audio stream in the room.
- Available since: 2.11.0
SetRangeAudioMode
public abstract void SetRangeAudioMode(ZegoRangeAudioMode mode)ZegoRangeAudio.csParameters
| Name | Type | Description |
|---|---|---|
| mode | ZegoRangeAudioMode | The range audio mode. |
Details
The audio mode can be set to World mode or Team mode.
Use case: The user can choose to chat with everyone in the World mode (with distance limitation), or to communicate within the team in the Team mode (without distance limitation).
- Default value: If this function is not called, the
Worldmode is used by default. - When to call: After initializing the range audio [createRangeAudio].
- Related APIs: In the
Worldmode, you can set the sound receiving range [setAudioReceiveRange], in theTeammode, you need to set [setTeamID] to join the corresponding team to hear the voice in the team.
- Available since: 2.11.0
SetRangeAudioCustomMode
public abstract void SetRangeAudioCustomMode(ZegoRangeAudioSpeakMode speakMode,ZegoRangeAudioListenMode listenMode)ZegoRangeAudio.csParameters
| Name | Type | Description |
|---|---|---|
| speakMode | ZegoRangeAudioSpeakMode | The range audio speak mode. |
| listenMode | ZegoRangeAudioListenMode | The range audio listening mode. |
Details
Can set the speak mode and listening mode respectively to control the speak and listening behavior in the world and team. Use case: The user can decide who can listen to his voice by selecting the speak mode, and can also decide whose voice to listen to by selecting the listening mode.
- Default value: If this interface is not called, the ZegoRangeAudioSpeakModeAll mode and ZegoRangeAudioListenModeAll mode is used by default.
- When to call: After initializing the range audio [createRangeAudio].
- Related APIs: When you want to listen to sounds from the world, you need to set the sound reception range [setAudioReceiveRange]. When you want to sound and listen in the squad, you need to set [setTeamID] to join the corresponding squad.
- Available since: 3.3.0
- Restrictions: 1. Cannot be called with [setRangeAudioMode];
- Not compatible with versions prior to 3.3.0.
SetTeamID
public abstract void SetTeamID(string teamID)ZegoRangeAudio.csParameters
| Name | Type | Description |
|---|---|---|
| teamID | string | Team ID, empty to exit the team, a string of up to 64 bytes in length. Support numbers, English characters and '~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', '=', '-', '`', ';', '’', ',', '.', '<', '>', ''. |
Details
After setting the team ID, you will be able to communicate with other users of the same team, and the sound will not change with the distance. It is also possible to exit the team by setting an empty string. Use case: Users join the team or exit the team.
- Default value: When this function is not called, no team will be added by default.
- When to call: After initializing the range audio [createRangeAudio].
- Caution: There will be no distance limit for the sounds in the team, and there will be no 3D sound effects.
MuteUser
public abstract void MuteUser(string userID,bool mute)ZegoRangeAudio.csParameters
| Name | Type | Description |
|---|---|---|
| userID | string | User ID. |
| mute | bool | Whether it can receive the audio data of the specified remote user, "true" means prohibition, "false" means receiving, the default value is "false". |
Details
In the process of real-time audio and video interaction, local users can use this function to control whether to receive audio data from designated remote users when pulling streams as needed. When the developer does not receive the audio receipt, the hardware and network overhead can be reduced.
- Use cases: When developers need to quickly close and restore remote audio, they can call this function to enhance the interactive experience.
- Default value: The default is
false, which means to receive audio data from all users. - When to call: After initializing the range audio [createRangeAudio].
- Caution: This function is valid only when the [muteAllPlayStreamAudio] function is set to
false. - Related APIs: You can call the [muteAllPlayStreamAudio] function to control whether to receive all audio data. 1. When the [muteAllPlayStreamAudio(true)] function is called, it takes effect globally, that is, local users will be prohibited from receiving audio data from all remote users. At this time, the [muteUser] function will not take effect regardless of whether the [muteUser] function is called before or after [muteAllPlayStreamAudio]. 2. When the [muteAllPlayStreamAudio(false)] function is called, the local user can receive the audio data of all remote users. At this time, the [muteUser] function can be used to control whether to receive the audio data of the specified user. Calling the [muteUser(userID, true)] function allows the local user to receive audio data other than the
userID; calling the [muteUser(userID, false)] function allows the local user to receive the audio data of theuserID.
- Available since: 2.16.0
ZegoRangeScene
Declared in ZegoRangeScene.cs
Methods
GetRangeSceneStream
public abstract ZegoRangeSceneStream GetRangeSceneStream()ZegoRangeScene.csGet a range scene stream instance. Use case: Often used in meta world scenarios, users can use related functions by getting range scene stream instance objects.
- When to call: After creating the range scene via [createRangeScene], before destroying the range scene via [destroyRangeScene].
- Available since: 3.0.0
- Restrictions: Not available for WebGL.
range scene stream instance.
GetRangeSceneHandle
public abstract int GetRangeSceneHandle()ZegoRangeScene.csGet range scene instance handle. Use case: Used to publish stream to the scene.
- When to call: After creating the range scene via [createRangeScene], before destroying the range scene via [destroyRangeScene].
- Available since: 3.0.0
- Restrictions: Not available for WebGL.
Range scene instance handle.
LoginScene
public abstract int LoginScene(ZegoSceneParam param,OnLoginSceneCallback callback)ZegoRangeScene.csParameters
| Name | Type | Description |
|---|---|---|
| param | ZegoSceneParam | Scene param. |
| callback | OnLoginSceneCallback | The callback of login scene. |
Details
SDK RangeScene uses the 'scene' to organize users.
- Use cases: Users interact in the RangeScene within the same scene.
- When to call: After creating the range scene via [createRangeScene], before destroying the range scene via [destroyRangeScene].
- Caution: 1. Apps that use different appIDs cannot intercommunication with each other. 2. It is strongly recommended that userID corresponds to the user ID of the business APP, that is, a userID and a real user are fixed and unique, and should not be passed to the SDK in a random userID. Because the unique and fixed userID allows ZEGO technicians to quickly locate online problems.
- Privacy reminder: Please do not fill in sensitive user information in this interface, including but not limited to mobile phone number, ID number, passport number, real name, etc.
- Related callbacks: 1. When the user starts to log in to the scene, the scene is successfully logged in, or the scene fails to log in, the [onSceneStateUpdate] callback will be triggered to notify the developer of the status of the current user connected to the scene. 2. If the network is temporarily interrupted due to network quality reasons, the SDK will automatically reconnect internally. You can get the current connection status of the local scene by listening to the [onSceneStateUpdate] callback method.
- Related APIs: 1. Users can call [logoutScene] to log out.
- Restrictions: Not available for WebGL.
Return
Error code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details.
LogoutScene
public abstract int LogoutScene(OnLogoutSceneCallback callback)ZegoRangeScene.csParameters
| Name | Type | Description |
|---|---|---|
| callback | OnLogoutSceneCallback | The callback of logout scene. |
Details
This API will log out the current user has logged in the scene.
- When to call: After successfully logging in to the scene, if the scene is no longer used, the user can call the function [logoutScene].
- Caution: Exiting a scene stops all publishing and playing stream associated with the scene for that user.
- Related callbacks: After calling this function, you will receive [onSceneStateUpdate] callback notification successfully exits the scene.
- Related APIs: Users can use [loginScene] functions to log in scene.
- Restrictions: Not available for WebGL.
Return
Error code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details.
UpdateUserStatus
public abstract int UpdateUserStatus(ZegoPosition position,uint channel,byte[] status)ZegoRangeScene.csParameters
| Name | Type | Description |
|---|---|---|
| position | ZegoPosition | User's current location. |
| channel | uint | The channel to which the status belongs, starting from 0, cannot exceed the maximum channel number. |
| status | byte[] | Current status data. |
Details
Developers can call this function to update the user status.
- When to call: After [LoginScene], before [LogoutScene].
- Caution: None.
- Restrictions: Not available for WebGL.
Return
Error code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details.
UpdateUserCommand
public abstract int UpdateUserCommand(ZegoPosition position,uint channel,byte[] command)ZegoRangeScene.csParameters
| Name | Type | Description |
|---|---|---|
| position | ZegoPosition | User's current location. |
| channel | uint | The channel to which the command belongs, starting from 0, cannot exceed the maximum channel number. |
| command | byte[] | Next command data. |
Details
Developers can call this function to update the user command.
- When to call: After [LoginScene], before [LogoutScene].
- Caution: None.
- Restrictions: Not available for WebGL.
Return
Error code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details.
UpdateUserPosition
public abstract int UpdateUserPosition(ZegoPosition position)ZegoRangeScene.csParameters
| Name | Type | Description |
|---|---|---|
| position | ZegoPosition | User's current location. |
Details
Developers can call this function to update the user position.
- When to call: After [LoginScene], before [LogoutScene].
- Caution: None.
- Restrictions: Not available for WebGL.
Return
Error code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details.
GetUserCount
public abstract int GetUserCount(OnGetUserCountCallback callback)ZegoRangeScene.csParameters
| Name | Type | Description |
|---|---|---|
| callback | OnGetUserCountCallback | The callback of get user count in scene. |
Details
Developers can call this function to get user count in scene.
- When to call: After [LoginScene], before [LogoutScene].
- Default value: NULL.
- Caution: None.
- Restrictions: Not available for WebGL.
Return
Error code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details.
GetUserListInView
public abstract int GetUserListInView(OnGetUserListInViewCallback callback)ZegoRangeScene.csParameters
| Name | Type | Description |
|---|---|---|
| callback | OnGetUserListInViewCallback | The callback of get user list in view. |
Details
Developers can call this function to get user list in view.
- When to call: After [LoginScene], before [LogoutScene].
- Default value: NULL.
- Caution: None.
- Restrictions: Not available for WebGL.
Return
Error code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details.
SendCustomCommand
public abstract int SendCustomCommand(byte[] command,OnSendCustomCommandCallback callback)ZegoRangeScene.csParameters
| Name | Type | Description |
|---|---|---|
| command | byte[] | Custom command. |
| callback | OnSendCustomCommandCallback | The callback of send custom command. |
Details
Developers can call this function to send custom command.
- When to call: After [LoginScene], before [LogoutScene].
- Default value: NULL.
- Caution: None.
- Restrictions: Not available for WebGL.
Return
Error code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details.
RenewToken
public abstract int RenewToken(string token)ZegoRangeScene.csParameters
| Name | Type | Description |
|---|---|---|
| token | string | The token that needs to be renew. |
Details
After the developer receives [onSceneTokenWillExpire], they can use this API to update the token to ensure that the subsequent RTC functions are normal.
- Use cases: Used when the token is about to expire.
- When to call /Trigger: After the developer receives [onSceneTokenWillExpire].
- Available since: 3.1.0
- Restrictions: Not available for WebGL.
Return
Error code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details.
SetStreamConfig
public abstract int SetStreamConfig(ZegoSceneStreamConfig config)ZegoRangeScene.csParameters
| Name | Type | Description |
|---|---|---|
| config | ZegoSceneStreamConfig | Range scene stream config. |
Details
Developers can call this function to set range scene stream config.
- When to call: After [createRangeScene].
- Default value: NULL.
- Caution: None.
- Restrictions: Not available for WebGL.
Return
Error code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details.
ZegoRangeSceneStream
Declared in ZegoRangeSceneStream.cs
Methods
SetReceiveRange
public abstract int SetReceiveRange(float range)ZegoRangeSceneStream.csParameters
| Name | Type | Description |
|---|---|---|
| range | float | The range distance from the center point of the person. |
Details
This interface will set the receiving range of audio and video streams, and ZEGO SDK will actively playing the streams of users in this range.
- When to call: After [getRangeSceneStream].
- Default value: The default value of receive range is 0.0 .
- Caution: None.
- Restrictions: Not available for WebGL.
Return
Error code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details.
SetReceiveRange
public abstract int SetReceiveRange(ZegoReceiveRangeParam param)ZegoRangeSceneStream.csParameters
| Name | Type | Description |
|---|---|---|
| param | ZegoReceiveRangeParam | The configuration of audio receiving range. |
Details
This interface will set the receiving range of audio and video streams, and ZEGO SDK will actively playing the streams of users in this range.
- When to call: After [getRangeSceneStream].
- Default value: The default value of receive range is 0.0 .
- Caution: None.
- Restrictions: None.
Return
Error code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details.
EnableRangeSpatializer
public abstract int EnableRangeSpatializer(bool enable)ZegoRangeSceneStream.csParameters
| Name | Type | Description |
|---|---|---|
| enable | bool | Whether to turn 3D spatial sound on, true: enable, false: disable. |
Details
After it is turned on, the audio of non-team members in the world will change spatially with the distance and direction from the person.
- When to call: After [getRangeSceneStream].
- Default value: Disable.
- Caution: None.
- Restrictions: Media volume is required to use 3D spatial sound.Not available for WebGL.
Return
Error code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details.
MutePlayAudio
public abstract int MutePlayAudio(string userID,bool mute)ZegoRangeSceneStream.csParameters
| Name | Type | Description |
|---|---|---|
| userID | string | User ID. |
| mute | bool | true: do not receive the user's audio stream, false: receive the user's audio stream. |
Details
Set whether to receive the audio data of the specified user.
- When to call: After [LoginScene], before [LogoutScene].
- Default value: Receive.
- Caution: None.
- Restrictions: Not available for WebGL.
Return
Error code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details.
MutePlayVideo
public abstract int MutePlayVideo(string userID,bool mute)ZegoRangeSceneStream.csParameters
| Name | Type | Description |
|---|---|---|
| userID | string | User ID. |
| mute | bool | true: do not receive the user's video stream, false: receive the user's video stream. |
Details
After it is turned on, the audio of non-team members in the world will change spatially with the distance and direction from the person.
- When to call: After [LoginScene], before [LogoutScene].
- Default value: Receive.
- Caution: None.
- Restrictions: Not available for WebGL.
Return
Error code, please refer to the error codes document https://doc-en.zego.im/en/5548.html for details.
ZegoRealTimeSequentialDataManager
Declared in ZegoRealTimeSequentialDataManager.cs
Methods
StartBroadcasting
public abstract void StartBroadcasting(string streamID)ZegoRealTimeSequentialDataManager.csParameters
| Name | Type | Description |
|---|---|---|
| streamID | string | Stream ID, a string of up to 256 characters. Caution: 1. Need to be globally unique within the entire AppID (Note that it cannot be the same as the stream ID passed in [startPublishingStream]). If in the same AppID, different users publish each stream and the stream ID is the same, which will cause the user to publish the stream failure. You cannot include URL keywords, otherwise publishing stream and playing stream will fails. 2. Only support numbers, English characters and '-', '_'. |
Details
This function allows users to broadcast their local real-time sequential data stream to the ZEGO RTC server, and other users in the same room can subscribe to the real-time sequential data stream for intercommunication through "streamID".
- Use cases: Before sending real-time sequential data, you need to call this function to start broadcasting.
- When to call: After creating the [ZegoRealTimeSequentialDataManager] instance.
- Caution: After calling this function, you will receive the [onPublisherStateUpdate] callback to tell you the broadcast state (publish state) of this stream. After the broadcast is successful, other users in the same room will receive the [onRoomStreamUpdate] callback to tell them this stream has been added to the room.
- Available since: 2.14.0
- Restrictions: Not available for WebGL.
StopBroadcasting
public abstract void StopBroadcasting(string streamID)ZegoRealTimeSequentialDataManager.csParameters
| Name | Type | Description |
|---|---|---|
| streamID | string | The ID of the stream that needs to stop broadcasting. |
Details
This function allows users to stop broadcasting their local real-time sequential data stream.
- Use cases: When you no longer need to send real-time sequential data, you need to call this function to stop broadcasting.
- When to call: After creating the [ZegoRealTimeSequentialDataManager] instance.
- Caution: After calling this function, you will receive the [onPublisherStateUpdate] callback to tell you the broadcast state (publish state) of this stream. After stopping the broadcast, other users in the same room will receive the [onRoomStreamUpdate] callback to tell them this stream has been deleted from the room.
- Available since: 2.14.0
- Restrictions: Not available for WebGL.
SendRealTimeSequentialData
public abstract void SendRealTimeSequentialData(IntPtr data,uint dataLength,string streamID,OnRealTimeSequentialDataSent callback)ZegoRealTimeSequentialDataManager.csParameters
| Name | Type | Description |
|---|---|---|
| data | IntPtr | The real-time sequential data to be sent. |
| dataLength | uint | Data content length. |
| streamID | string | The stream ID to which the real-time sequential data is sent. |
| callback | OnRealTimeSequentialDataSent | Send real-time sequential data result callback. |
Details
This function can be used to send real-time sequential data on the stream currently being broadcast.
- Use cases: You need to call this function when you need to send real-time sequential data.
- When to call: After calling [startBroadcasting].
- Caution: None.
- Available since: 2.14.0
- Restrictions: Not available for WebGL.
StartSubscribing
public abstract void StartSubscribing(string streamID)ZegoRealTimeSequentialDataManager.csParameters
| Name | Type | Description |
|---|---|---|
| streamID | string | Stream ID, a string of up to 256 characters. Caution: Only support numbers, English characters and '-', '_'. |
Details
This function allows users to subscribe to the real-time sequential data stream of remote users from the ZEGO RTC server.
- Use cases: When you need to receive real-time sequential data sent from other remote users, you need to call this function to start subscribing to the stream broadcasted by other remote users.
- When to call: After creating the [ZegoRealTimeSequentialDataManager] instance.
- Caution: After calling this function, you will receive the [onPlayerStateUpdate] callback to tell you the subscribe state (play state) of this stream.
- Available since: 2.14.0
- Restrictions: Not available for WebGL.
StopSubscribing
public abstract void StopSubscribing(string streamID)ZegoRealTimeSequentialDataManager.csParameters
| Name | Type | Description |
|---|---|---|
| streamID | string | The ID of the stream that needs to stop subscribing. |
Details
This function can be used to stop subscribing to the real-time sequential data stream.
- Use cases: When you no longer need to receive real-time sequential data sent by other users, you need to call this function to stop subscribing to the other user's stream.
- When to call: After creating the [ZegoRealTimeSequentialDataManager] instance.
- Caution: After calling this function, you will receive the [onPlayerStateUpdate] callback to tell you the subscribe state (play state) of this stream.
- Available since: 2.14.0
- Restrictions: Not available for WebGL.
GetIndex
public abstract int GetIndex()ZegoRealTimeSequentialDataManager.csIndex of the real-time sequential data manager.
ZegoScreenCaptureSource
Declared in ZegoScreenCaptureSource.cs
Methods
UpdateCaptureSource
public abstract void UpdateCaptureSource(long sourceId,ZegoScreenCaptureSourceType sourceType)ZegoScreenCaptureSource.csParameters
| Name | Type | Description |
|---|---|---|
| sourceId | long | The specified screen ID or window ID. |
| sourceType | ZegoScreenCaptureSourceType | The specified screen source type. |
Details
Update a screen capture source object based on the provided source ID and source type.
- Use cases: It is used when you need to record and share the screen or window.
- When to call: It can be called after the engine by [createScreenCaptureSource] has been initialized.
- Restrictions: Only available on Windows/macOS.
StartCapture
public abstract void StartCapture()ZegoScreenCaptureSource.csStart screen capture.
- When to call: It can be called after the engine by [createScreenCaptureSource] has been initialized.
- Available since: 3.1.0
StopCapture
public abstract void StopCapture()ZegoScreenCaptureSource.csStop screen capture.
- Available since: 3.1.0
GetCaptureSourceRect
public abstract ZegoRect GetCaptureSourceRect()ZegoScreenCaptureSource.csGets the rectangle of the screen capture source.
- Available since: 3.6.0
- Restrictions: Called after starting [startScreenCapture] acquisition, only support in Windows/macOS.
Rect information about the capture resource.
UpdateCaptureRegion
public abstract void UpdateCaptureRegion(ZegoRect rect)ZegoScreenCaptureSource.csParameters
| Name | Type | Description |
|---|---|---|
| rect | ZegoRect | The position of the area to be captured relative to the entire screen or window. |
Details
Update the area captured by the screen.
- When to call: It can be called after the engine by [createScreenCaptureSource] has been initialized.
- Available since: 3.1.0
- Restrictions: Only support in Windows/macOS.
SetExcludeWindowList
public abstract void SetExcludeWindowList(List<long> list)ZegoScreenCaptureSource.csParameters
| Name | Type | Description |
|---|---|---|
| list | List<long> | List of IDs to filter windows. |
Details
Specify a list of windows, and filter these windows when capturing the screen, and not display them on the screen.
- When to call: It can be called after the engine by [createScreenCaptureSource] has been initialized.
- Available since: 3.1.0
- Restrictions: Only available on Windows/macOS.
EnableWindowActivate
public abstract void EnableWindowActivate(bool active)ZegoScreenCaptureSource.csParameters
| Name | Type | Description |
|---|---|---|
| active | bool | Whether to activate the window. true to activate the window, false to not activate the window, the default is true. |
Details
When the capture target is a window, set whether to activate the window to be displayed in the foreground during the first capture.
- When to call: It can be called after the engine by [createScreenCaptureSource] has been initialized.
- Available since: 3.1.0
- Restrictions: Only available on Windows/macOS.
EnableCursorVisible
public abstract void EnableCursorVisible(bool visible)ZegoScreenCaptureSource.csParameters
| Name | Type | Description |
|---|---|---|
| visible | bool | Whether to show the cursor. true to show the cursor, false to not show the cursor, the default is true. |
Details
Set whether to show the cursor.
- When to call: It can be called after the engine by [createScreenCaptureSource] has been initialized.
- Available since: 3.1.0
- Restrictions: Only available on Windows/macOS.
GetIndex
public abstract int GetIndex()ZegoScreenCaptureSource.csIndex of the screen capture source.
