Class
IZegoApiCalledEventHandler
Declared in callback/IZegoApiCalledEventHandler.java
Methods
onApiCalledResult
public void onApiCalledResult(int errorCode, String funcName, String info)callback/IZegoApiCalledEventHandler.javaParameters
| 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: None.
IZegoAudioDataHandler
Declared in callback/IZegoAudioDataHandler.java
Methods
onCapturedAudioData
public void onCapturedAudioData(ByteBuffer data, int dataLength, ZegoAudioFrameParam param)callback/IZegoAudioDataHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| data | ByteBuffer | Audio data in PCM format. |
| dataLength | int | 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: None.
onPlaybackAudioData
public void onPlaybackAudioData(ByteBuffer data, int dataLength, ZegoAudioFrameParam param)callback/IZegoAudioDataHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| data | ByteBuffer | Audio data in PCM format. |
| dataLength | int | 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.
onMixedAudioData
public void onMixedAudioData(ByteBuffer data, int dataLength, ZegoAudioFrameParam param)callback/IZegoAudioDataHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| data | ByteBuffer | Audio data in PCM format. |
| dataLength | int | 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.
onPlayerAudioData
public void onPlayerAudioData(ByteBuffer data, int dataLength, ZegoAudioFrameParam param, String streamID)callback/IZegoAudioDataHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| data | ByteBuffer | Audio data in PCM format. |
| dataLength | int | 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: None.
IZegoAudioEffectPlayerEventHandler
Declared in callback/IZegoAudioEffectPlayerEventHandler.java
Methods
onAudioEffectPlayStateUpdate
public void onAudioEffectPlayStateUpdate(ZegoAudioEffectPlayer audioEffectPlayer, int audioEffectID, ZegoAudioEffectPlayState state, int errorCode)callback/IZegoAudioEffectPlayerEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| audioEffectPlayer | ZegoAudioEffectPlayer | Audio effect player instance that triggers this callback. |
| audioEffectID | int | 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.
IZegoCopyrightedMusicEventHandler
Declared in callback/IZegoCopyrightedMusicEventHandler.java
Methods
onDownloadProgressUpdate
public void onDownloadProgressUpdate(ZegoCopyrightedMusic copyrightedMusic, String resourceID, float progressRate)callback/IZegoCopyrightedMusicEventHandler.java| 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 void onCurrentPitchValueUpdate(ZegoCopyrightedMusic copyrightedMusic, String resourceID, int currentDuration, int pitchValue)callback/IZegoCopyrightedMusicEventHandler.java| 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. |
IZegoCustomAudioProcessHandler
Declared in callback/IZegoCustomAudioProcessHandler.java
Methods
onProcessCapturedAudioData
public void onProcessCapturedAudioData(ByteBuffer data, int dataLength, ZegoAudioFrameParam param, double timestamp)callback/IZegoCustomAudioProcessHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| data | ByteBuffer | Audio data in PCM format. |
| dataLength | int | Length of the data. |
| param | ZegoAudioFrameParam | Parameters of the audio frame. |
| timestamp | double | The audio frame timestamp, starting from 0 when capture is started, the unit is milliseconds. |
Details
In this callback, you can receive the PCM audio frames captured locally after used headphone monitor. Developers can modify the audio frame data, as well as the audio channels and sample rate. The timestamp can be used for data synchronization, such as lyrics, etc. If you need the data after used headphone monitor, please use the [onProcessCapturedAudioDataAfterUsedHeadphoneMonitor] callback. When to trigger: You need to call [enableCustomAudioCaptureProcessing] to enable the function first, and call [startPreview] or [startPublishingStream] to trigger this callback function.
- Caution: This callback is a high-frequency callback, please do not perform time-consuming operations in this callback.
- Restrictions: None.
onProcessCapturedAudioDataAfterUsedHeadphoneMonitor
public void onProcessCapturedAudioDataAfterUsedHeadphoneMonitor(ByteBuffer data, int dataLength, ZegoAudioFrameParam param, double timestamp)callback/IZegoCustomAudioProcessHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| data | ByteBuffer | Audio data in PCM format |
| dataLength | int | Length of the data |
| param | ZegoAudioFrameParam | Parameters of the audio frame |
| timestamp | double | The audio frame timestamp, starting from 0 when capture is started, the unit is milliseconds. |
Details
In this callback, you can receive the PCM audio frames captured locally after used headphone monitor. Developers can modify the audio frame data, as well as the audio channels and sample rate. The timestamp can be used for data synchronization, such as lyrics, etc. When to trigger: You need to call [enableCustomAudioCaptureProcessingAfterHeadphoneMonitor] to enable the function first, and call [startPreview] or [startPublishingStream] to trigger this callback function.
- Caution: This callback is a high-frequency callback, please do not perform time-consuming operations in this callback.
onProcessRemoteAudioData
public void onProcessRemoteAudioData(ByteBuffer data, int dataLength, ZegoAudioFrameParam param, String streamID, double timestamp)callback/IZegoCustomAudioProcessHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| data | ByteBuffer | Audio data in PCM format. |
| dataLength | int | Length of the data. |
| param | ZegoAudioFrameParam | Parameters of the audio frame. |
| streamID | String | Corresponding stream ID. |
| timestamp | double | The audio frame timestamp, starting from 0 when capture is started, the unit is milliseconds. |
Details
In this callback, you can receive the PCM audio frames of remote playing stream. Developers can modify the audio frame data, as well as the audio channels and sample rate. The timestamp can be used for data synchronization, such as lyrics, etc. When to trigger: You need to call [enableCustomAudioRemoteProcessing] to enable the function first, and call [startPlayingStream] to trigger this callback function.
- Caution: This callback is a high-frequency callback, please do not perform time-consuming operations in this callback.
- Restrictions: None.
onProcessPlaybackAudioData
public void onProcessPlaybackAudioData(ByteBuffer data, int dataLength, ZegoAudioFrameParam param, double timestamp)callback/IZegoCustomAudioProcessHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| data | ByteBuffer | Audio data in PCM format. |
| dataLength | int | Length of the data. |
| param | ZegoAudioFrameParam | Parameters of the audio frame. |
| timestamp | double | The audio frame timestamp, starting from 0 when capture is started, the unit is milliseconds (It is effective when there is one and only one stream). |
Details
In this callback, you can receive the SDK playback PCM audio frame. Developers can modify the audio frame data, as well as the audio channels and sample rate. The timestamp can be used for data synchronization, such as lyrics, etc. When to trigger: You need to call [enableCustomAudioPlaybackProcessing] to enable the function first, and call [startPublishingStream], [startPlayingStream], [startPreview], [createMediaPlayer] or [createAudioEffectPlayer] to trigger this callback function.
- Caution: This callback is a high-frequency callback, please do not perform time-consuming operations in this callback.
- Restrictions: None.
IZegoCustomVideoCaptureHandler
Declared in callback/IZegoCustomVideoCaptureHandler.java
Methods
onStart
public void onStart(int channel)callback/IZegoCustomVideoCaptureHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| channel | int | 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
onStop
public void onStop(int channel)callback/IZegoCustomVideoCaptureHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| channel | int | 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
onEncodedDataTrafficControl
public void onEncodedDataTrafficControl(ZegoTrafficControlInfo trafficControlInfo, ZegoPublishChannel channel)callback/IZegoCustomVideoCaptureHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| trafficControlInfo | ZegoTrafficControlInfo | traffic control info. |
| channel | ZegoPublishChannel | Publishing stream channel. |
Details
When using custom video capture, the SDK detects a network change, informs the developer that it needs to do flow control, and adjust the encoding configuration according to the recommended parameters of the SDK. In the case of custom collection and transmission of encoded data, the SDK cannot know the external encoding configuration, so the flow control operation needs to be completed by the developer. The SDK will notify the developer of the recommended value of the video configuration according to the current network situation, and the developer needs to modify the encoder configuration by himself to ensure the smoothness of video transmission.
- Use cases: Live data collected by non-cameras. For example, local video file playback, screen sharing, game live broadcast, etc. When to
- Trigger: When network status changes during the process of custom video capture and flow control is required.
- Caution: Please do not perform time-consuming operations in this callback, such as reading and writing large files. If you need to perform time-consuming operations, please switch threads.
- Related APIs: Call [setCustomVideoCaptureHandler] to set custom video capture callback.
- Available since: 1.14.0
IZegoCustomVideoRenderHandler
Declared in callback/IZegoCustomVideoRenderHandler.java
Methods
onCapturedVideoFrameRawData
public void onCapturedVideoFrameRawData(ByteBuffer[] data, int[] dataLength, ZegoVideoFrameParam param, ZegoVideoFlipMode flipMode, int channel)callback/IZegoCustomVideoRenderHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| data | ByteBuffer[] | Raw video frame data (eg: RGBA only needs to consider data[0], I420 needs to consider data[0,1,2]). |
| dataLength | int[] | 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 | int | 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 void onRemoteVideoFrameRawData(ByteBuffer[] data, int[] dataLength, ZegoVideoFrameParam param, String streamID)callback/IZegoCustomVideoRenderHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| data | ByteBuffer[] | Raw video frame data (eg: RGBA only needs to consider data[0], I420 needs to consider data[0,1,2]). |
| dataLength | int[] | 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
onRemoteVideoFrameEncodedData
public void onRemoteVideoFrameEncodedData(ByteBuffer data, int dataLength, ZegoVideoEncodedFrameParam param, long referenceTimeMillisecond, String streamID)callback/IZegoCustomVideoRenderHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| data | ByteBuffer | Encoded data of video frames. |
| dataLength | int | Data length. |
| param | ZegoVideoEncodedFrameParam | Video frame parameters. |
| referenceTimeMillisecond | long | video frame reference time, UNIX timestamp, in milliseconds. |
| streamID | String | Stream ID. |
Details
When [enableCustomVideoRender] is called to enable custom video rendering and the specified data type is [EncodedData], this function will be called back with the remote playing stream undecoded video frame data. When to
- Trigger: After calling [startPlayingStream], the SDK will call back when the remote streaming video frame data is received.
- Related APIs: Call [setCustomVideoRenderHandler] to set custom video rendering callback.
- Available since: 1.10.0
IZegoDataRecordEventHandler
Declared in callback/IZegoDataRecordEventHandler.java
Methods
onCapturedDataRecordStateUpdate
public void onCapturedDataRecordStateUpdate(ZegoDataRecordState state, int errorCode, ZegoDataRecordConfig config, int channel)callback/IZegoDataRecordEventHandler.javaParameters
| 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 | int | 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: None.
onCapturedDataRecordProgressUpdate
public void onCapturedDataRecordProgressUpdate(ZegoDataRecordProgress progress, ZegoDataRecordConfig config, int channel)callback/IZegoDataRecordEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| progress | ZegoDataRecordProgress | File recording progress, which allows developers to hint at the UI, etc. |
| config | ZegoDataRecordConfig | Record config. |
| channel | int | 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: None.
IZegoEventHandler
Declared in callback/IZegoEventHandler.java
Methods
onDebugError
public void onDebugError(int errorCode, String funcName, String info)callback/IZegoEventHandler.javaParameters
| 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.
onEngineStateUpdate
public void onEngineStateUpdate(ZegoEngineState state)callback/IZegoEventHandler.javaParameters
| 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 void onRecvExperimentalAPI(String content)callback/IZegoEventHandler.javaParameters
| 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
onFatalError
public void onFatalError(int errorCode)callback/IZegoEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| errorCode | int | Error code. |
Details
The callback that triggered a fatal error.
- Trigger: The APP has enabled the restriction of access from foreign IP addresses, and the current client is outside of the domain.
- Caution: None.
- Available since: 3.6.0
- Restrictions: None.
onRoomStateUpdate
public void onRoomStateUpdate(String roomID, ZegoRoomState state, int errorCode, String extendedData)callback/IZegoEventHandler.javaParameters
| 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 void onRoomStateChanged(String roomID, ZegoRoomStateChangedReason reason, int errorCode, String extendedData)callback/IZegoEventHandler.javaParameters
| 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 void onRoomUserUpdate(String roomID, ZegoUpdateType updateType, ArrayList<ZegoUser> userList)callback/IZegoEventHandler.javaParameters
| 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). |
| userList | ArrayList<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 void onRoomOnlineUserCountUpdate(String roomID, int count)callback/IZegoEventHandler.javaParameters
| 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 void onRoomStreamUpdate(String roomID, ZegoUpdateType updateType, ArrayList<ZegoStream> streamList, String extendedData)callback/IZegoEventHandler.javaParameters
| 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 | ArrayList<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 void onRoomStreamExtraInfoUpdate(String roomID, ArrayList<ZegoStream> streamList)callback/IZegoEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| roomID | String | Room ID where the user is logged in, a string of up to 128 bytes in length. |
| streamList | ArrayList<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 void onRoomExtraInfoUpdate(String roomID, ArrayList<ZegoRoomExtraInfo> roomExtraInfoList)callback/IZegoEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| roomID | String | Room ID where the user is logged in, a string of up to 128 bytes in length. |
| roomExtraInfoList | ArrayList<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 void onRoomTokenWillExpire(String roomID, int remainTimeInSecond)callback/IZegoEventHandler.javaParameters
| 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 void onPublisherStateUpdate(String streamID, ZegoPublisherState state, int errorCode, String extendedData)callback/IZegoEventHandler.javaParameters
| 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 void onPublisherQualityUpdate(String streamID, ZegoPublishStreamQuality quality)callback/IZegoEventHandler.javaParameters
| 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 void onPublisherCapturedAudioFirstFrame()callback/IZegoEventHandler.javaThis callback will be received when the SDK starts the microphone to capture the first frame of audio data. If this callback is not received, the audio capture device is occupied or abnormal.
- Trigger: When the engine of the audio/video module inside the SDK starts, the SDK will go and collect the audio data from the local device and will receive the callback at that time.
- Related callbacks: Determine if the SDK actually collected video data by the callback function [onPublisherCapturedVideoFirstFrame], determine if the SDK has rendered the first frame of video data collected by calling back [onPublisherRenderVideoFirstFrame].
- Available since: 1.1.0
onPublisherCapturedVideoFirstFrame
public void onPublisherCapturedVideoFirstFrame(int channel)callback/IZegoEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| channel | int | 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]. This function is only available in ZegoExpressVideo SDK!
- Available since: 1.1.0
onPublisherSendAudioFirstFrame
public void onPublisherSendAudioFirstFrame(ZegoPublishChannel channel)callback/IZegoEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| channel | ZegoPublishChannel | Publishing stream channel.If you only publish one audio stream, you can ignore this parameter. |
Details
After the [startPublishingStream] function is called successfully, this callback will be called when SDK received the first frame of audio data. Developers can use this callback to determine whether SDK has actually collected audio data. If the callback is not received, the audio capture device is occupied or abnormal.
- Trigger: In the case of no startPublishingStream audio stream, the first startPublishingStream audio stream, it will receive this callback.
- Related callbacks: After the [startPublishingStream] function is called successfully, 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: 3.5.0
onPublisherSendVideoFirstFrame
public void onPublisherSendVideoFirstFrame(int channel)callback/IZegoEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| channel | int | Publishing stream channel.If you only publish one video stream, you can ignore this parameter. |
Details
After the [startPublishingStream] function is called successfully, this callback will be called when SDK received the first frame of video data. Developers can use this callback to determine whether SDK has actually collected video data. If the callback is not received, the video capture device is occupied or abnormal.
- Trigger: In the case of no startPublishingStream video stream, the first startPublishingStream video stream, it will receive this 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 has rendered the first frame of video data collected by calling back [onPublisherRenderVideoFirstFrame]. This function is only available in ZegoExpressVideo SDK!
- Available since: 3.5.0
onPublisherRenderVideoFirstFrame
public void onPublisherRenderVideoFirstFrame(ZegoPublishChannel channel)callback/IZegoEventHandler.javaParameters
| 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]. This function is only available in ZegoExpressVideo SDK!
- Available since: 2.4.0
onPublisherVideoSizeChanged
public void onPublisherVideoSizeChanged(int width, int height, int channel)callback/IZegoEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| width | int | Video capture resolution width. |
| height | int | Video capture resolution height. |
| channel | int | 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. This function is only available in ZegoExpressVideo SDK!
- Available since: 1.1.0
onPublisherRelayCDNStateUpdate
public void onPublisherRelayCDNStateUpdate(String streamID, ArrayList<ZegoStreamRelayCDNInfo> infoList)callback/IZegoEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| streamID | String | Stream ID. |
| infoList | ArrayList<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
onPublisherVideoEncoderChanged
public void onPublisherVideoEncoderChanged(ZegoVideoCodecID fromCodecID, ZegoVideoCodecID toCodecID, int channel)callback/IZegoEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| fromCodecID | ZegoVideoCodecID | Video codec ID before the change. |
| toCodecID | ZegoVideoCodecID | Video codec ID after the change. |
| channel | int | Publishing stream channel.If you only publish one audio and video stream, you can ignore this parameter. |
Details
After the H.265 automatic downgrade policy is enabled, if H.265 encoding is not supported or the encoding fails during the streaming process with H.265 encoding, the SDK will actively downgrade to the specified encoding (H.264), and this callback will be triggered at this time. When to trigger: In the process of streaming with H.265 encoding, if H.265 encoding is not supported or encoding fails, the SDK will actively downgrade to the specified encoding (H.264), and this callback will be triggered at this time.
- Caution: When this callback is triggered, if local video recording or cloud recording is in progress, multiple recording files will be generated. Developers need to collect all the recording files for processing after the recording ends. When this callback is triggered, because the streaming code has changed, the developer can evaluate whether to notify the streaming end, so that the streaming end can deal with it accordingly.
- Available since: 2.12.0
onPublisherStreamEvent
public void onPublisherStreamEvent(ZegoStreamEvent eventID, String streamID, String extraInfo)callback/IZegoEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| eventID | ZegoStreamEvent | Publish 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 publishing stream, this callback will return the current stream address, resource type and protocol-related information. When to trigger: Publish and retry publish events.
- Caution: None.
- Available since: 2.18.0
onPlayerStateUpdate
public void onPlayerStateUpdate(String streamID, ZegoPlayerState state, int errorCode, String extendedData)callback/IZegoEventHandler.javaParameters
| 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 void onPlayerQualityUpdate(String streamID, ZegoPlayStreamQuality quality)callback/IZegoEventHandler.javaParameters
| 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 void onPlayerMediaEvent(String streamID, ZegoPlayerMediaEvent event)callback/IZegoEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| streamID | String | Stream ID. |
| event | 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. 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.
- Available since: 1.1.0
onPlayerRecvAudioFirstFrame
public void onPlayerRecvAudioFirstFrame(String streamID)callback/IZegoEventHandler.javaParameters
| 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
onPlayerRecvVideoFirstFrame
public void onPlayerRecvVideoFirstFrame(String streamID)callback/IZegoEventHandler.javaParameters
| 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. This function is only available in ZegoExpressVideo SDK!
- Available since: 1.1.0
onPlayerRenderVideoFirstFrame
public void onPlayerRenderVideoFirstFrame(String streamID)callback/IZegoEventHandler.javaParameters
| 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. This function is only available in ZegoExpressVideo SDK!
- Available since: 1.1.0
onPlayerRenderCameraVideoFirstFrame
public void onPlayerRenderCameraVideoFirstFrame(String streamID)callback/IZegoEventHandler.javaParameters
| 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. This function is only available in ZegoExpressVideo SDK!
- Available since: 3.0.0
onPlayerVideoSizeChanged
public void onPlayerVideoSizeChanged(String streamID, int width, int height)callback/IZegoEventHandler.javaParameters
| 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.
- If the user enables custom video rendering of the ZegoVideoBufferTypeEncodedData type, the SDK is not responsible for video decoding and will not trigger this callback. This function is only available in ZegoExpressVideo SDK!
- Available since: 1.1.0
onPlayerRecvSEI
public void onPlayerRecvSEI(String streamID, byte[] data)callback/IZegoEventHandler.javaParameters
| 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.The customer can directly operate the UI control in this callback function.
- 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.
- 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
onPlayerSyncRecvSEI
public void onPlayerSyncRecvSEI(String streamID, byte[] data)callback/IZegoEventHandler.javaParameters
| 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:
- 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.
- 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
onPlayerRecvMediaSideInfo
public void onPlayerRecvMediaSideInfo(ZegoMediaSideInfo info)callback/IZegoEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| info | ZegoMediaSideInfo | SEI Callback info. |
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.9.0
onPlayerRecvAudioSideInfo
public void onPlayerRecvAudioSideInfo(String streamID, byte[] data)callback/IZegoEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| streamID | String | Stream ID. |
| data | byte[] | Audio side information content. |
Details
After the [startPlayingStream] function is called successfully, when the remote stream sends audio side information, the local end will receive this callback.
- Trigger: After the [startPlayingStream] function is called successfully, when the remote stream sends audio side information, the local end will receive this callback.
- Caution: 1. When [mutePlayStreamAudio] or [muteAllPlayStreamAudio] is called to set only the video stream to be pulled, the audio side information not be received. 2. Due to factors such as the network, the received data may be missing, but the order is guaranteed.
- Related APIs: Send audio side information by the [sendAudioSideInfo] function.
- Available since: 2.19.0
onPlayerLowFpsWarning
public void onPlayerLowFpsWarning(ZegoVideoCodecID codecID, String streamID)callback/IZegoEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| codecID | ZegoVideoCodecID | Video codec ID. |
| streamID | String | Stream ID. |
Details
This callback triggered by low frame rate when playing stream. When to trigger: This callback triggered by low frame rate when playing stream.
- Caution: If the callback is triggered when the user playing the h.265 stream, you can stop playing the h.265 stream and switch to play the H.264 stream.
- Available since: 2.14.0
onPlayerStreamEvent
public void onPlayerStreamEvent(ZegoStreamEvent eventID, String streamID, String extraInfo)callback/IZegoEventHandler.javaParameters
| 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 void onMixerRelayCDNStateUpdate(String taskID, ArrayList<ZegoStreamRelayCDNInfo> infoList)callback/IZegoEventHandler.javaParameters
| 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 | ArrayList<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: None.
onCapturedSoundLevelUpdate
public void onCapturedSoundLevelUpdate(float soundLevel)callback/IZegoEventHandler.javaParameters
| 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
onCapturedSoundLevelInfoUpdate
public void onCapturedSoundLevelInfoUpdate(ZegoSoundLevelInfo soundLevelInfo)callback/IZegoEventHandler.javaParameters
| 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
onRemoteSoundLevelUpdate
public void onRemoteSoundLevelUpdate(HashMap<String, Float> soundLevels)callback/IZegoEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| soundLevels | HashMap<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
onRemoteSoundLevelInfoUpdate
public void onRemoteSoundLevelInfoUpdate(HashMap<String, ZegoSoundLevelInfo> soundLevelInfos)callback/IZegoEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| soundLevelInfos | HashMap<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
onLocalDeviceExceptionOccurred
public void onLocalDeviceExceptionOccurred(ZegoDeviceExceptionType exceptionType, ZegoDeviceType deviceType, String deviceID)callback/IZegoEventHandler.javaParameters
| 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
onRemoteCameraStateUpdate
public void onRemoteCameraStateUpdate(String streamID, ZegoRemoteDeviceState state)callback/IZegoEventHandler.javaParameters
| 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. This function is only available in ZegoExpressVideo SDK!
- Available since: 1.1.0
onRemoteMicStateUpdate
public void onRemoteMicStateUpdate(String streamID, ZegoRemoteDeviceState state)callback/IZegoEventHandler.javaParameters
| 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
onRemoteSpeakerStateUpdate
public void onRemoteSpeakerStateUpdate(String streamID, ZegoRemoteDeviceState state)callback/IZegoEventHandler.javaParameters
| 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
onAudioVADStateUpdate
public void onAudioVADStateUpdate(ZegoAudioVADStableStateMonitorType type, ZegoAudioVADType state)callback/IZegoEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| type | ZegoAudioVADStableStateMonitorType | audio VAD monitor type |
| state | ZegoAudioVADType | VAD result |
Details
Callback for audio VAD stable state update. When to trigger: the [startAudioVADStableStateMonitor] function must be called to start the audio VAD monitor and you must be in a state where it is publishing the audio and video stream or be in [startPreview] state.
- Related APIs: [startAudioVADStableStateMonitor], [stopAudioVADStableStateMonitor].
- Available since: 2.14.0
- Restrictions: The callback notification period is 3 seconds.
onRecvRoomTransparentMessage
public void onRecvRoomTransparentMessage(String roomID, ZegoRoomRecvTransparentMessage message)callback/IZegoEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| roomID | String | Room ID. Value range: The maximum length is 128 bytes. |
| message | ZegoRoomRecvTransparentMessage | recv message. |
Details
This callback is used to receive room passthrough messages sent by other users in the same room. When to trigger: After calling [loginRoom] to login to the room, this callback is triggered if there is a user in the room who sends a message received by the specified client through the [sendTransparentMessage] function.
- 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: A bullet-screen message sent by the user himself is not notified by this callback. [sendTransparentMessage] specifies that only a server callback is used. This callback is not triggered.
- Available since: 1.5.0
- Restrictions: None
onIMRecvBroadcastMessage
public void onIMRecvBroadcastMessage(String roomID, ArrayList<ZegoBroadcastMessageInfo> messageList)callback/IZegoEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| roomID | String | Room ID. Value range: The maximum length is 128 bytes. |
| messageList | ArrayList<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: None
onIMRecvBarrageMessage
public void onIMRecvBarrageMessage(String roomID, ArrayList<ZegoBarrageMessageInfo> messageList)callback/IZegoEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| roomID | String | Room ID. Value range: The maximum length is 128 bytes. |
| messageList | ArrayList<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: None
onIMRecvCustomCommand
public void onIMRecvCustomCommand(String roomID, ZegoUser fromUser, String command)callback/IZegoEventHandler.javaParameters
| 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: None
onPerformanceStatusUpdate
public void onPerformanceStatusUpdate(ZegoPerformanceStatus status)callback/IZegoEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| status | ZegoPerformanceStatus | System performance monitoring status. |
Details
System performance monitoring callback. The callback notification period is the value of millisecond parameter set by call [startPerformanceMonitor].
- Use cases: Monitor system performance can help user quickly locate and solve performance problems and improve user experience. When to trigger: It will triggered after [createEngine], and call [startPerformanceMonitor] to start system performance monitoring.
- Available since: 1.19.0
- Restrictions: None.
onNetworkModeChanged
public void onNetworkModeChanged(ZegoNetworkMode mode)callback/IZegoEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| mode | ZegoNetworkMode | Current network mode. |
Details
Network mode changed callback. When to trigger: This callback will be triggered when the device's network mode changed, such as switched from WiFi to 5G, or when network is disconnected.
- Available since: 1.20.0
- Restrictions: None.
onNetworkSpeedTestError
public void onNetworkSpeedTestError(int errorCode, ZegoNetworkSpeedTestType type)callback/IZegoEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| errorCode | int | Network speed test error code. Please refer to error codes document https://docs.zegocloud.com/en/5548.html for details. |
| type | ZegoNetworkSpeedTestType | Uplink or downlink. |
Details
Network speed test error callback.
- Use cases: This function can be used to detect whether the network environment is suitable for pushing/pulling streams with specified bitrates. When to
- Trigger: If an error occurs during the speed test, such as: can not connect to speed test server, this callback will be triggered.
- Available since: 1.20.0
- Restrictions: None.
onNetworkSpeedTestQualityUpdate
public void onNetworkSpeedTestQualityUpdate(ZegoNetworkSpeedTestQuality quality, ZegoNetworkSpeedTestType type)callback/IZegoEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| quality | ZegoNetworkSpeedTestQuality | Network speed test quality. |
| type | ZegoNetworkSpeedTestType | Uplink or downlink. |
Details
Network speed test quality callback when the network can be connected.
- Use cases: This function can be used to detect whether the network environment is suitable for pushing/pulling streams with specified bitrates. When to
- Trigger: After call [startNetworkSpeedTest] start network speed test, this callback will be triggered. The trigger period is determined by the parameter value specified by call [startNetworkSpeedTest], default value is 3 seconds
- Caution: When error occurred during network speed test or [stopNetworkSpeedTest] called, this callback will not be triggered.
- Available since: 1.20.0
- Restrictions: None.
onNetworkQuality
public void onNetworkQuality(String userID, ZegoStreamQualityLevel upstreamQuality, ZegoStreamQualityLevel downstreamQuality)callback/IZegoEventHandler.javaParameters
| 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:
- 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.
- 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. When to
- Trigger: After publishing a stream by called [startPublishingStream] or playing a stream by called [startPlayingStream].
- Available since: 2.10.0
onNetworkTimeSynchronized
public void onNetworkTimeSynchronized()callback/IZegoEventHandler.java- Available since: 2.12.0 This callback is triggered when internal network time synchronization completes after a developer calls [createEngine].
onRequestDumpData
public void onRequestDumpData()callback/IZegoEventHandler.java- Trigger: When the customer reports back the problem, ZEGO expects the user to dump the data to analyze the audio / video processing problem, which will trigger this callback.
- Available since: 3.10.0 When to
onRequestUploadDumpData
public void onRequestUploadDumpData(String dumpDir, boolean takePhoto)callback/IZegoEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| dumpDir | String | Dump data dir. |
| takePhoto | boolean | Need to take photo when uploading dump data |
- Trigger: When the customer reports back the problem, ZEGO expects the user to dump the data to analyze the audio / video processing problem, which will trigger this callback.
- Available since: 3.11.0 When to
onStartDumpData
public void onStartDumpData(int errorCode)callback/IZegoEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| errorCode | int | Error code. |
- Trigger: This callback is triggered when [startDumpData] is called.
- Available since: 3.10.0 When to
onStopDumpData
public void onStopDumpData(int errorCode, String dumpDir)callback/IZegoEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| errorCode | int | Error code. |
| dumpDir | String | Dump data dir. |
- Trigger: This callback is triggered when [stopDumpData] is called.
- Available since: 3.10.0 When to
onUploadDumpData
public void onUploadDumpData(int errorCode)callback/IZegoEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| errorCode | int | Error code. |
- Trigger: When [uploadDumpData] is called, this callback will be triggered after SDK executes the upload task.
- Available since: 3.10.0 When to
IZegoMediaDataPublisherEventHandler
Declared in callback/IZegoMediaDataPublisherEventHandler.java
Methods
onMediaDataPublisherFileOpen
public void onMediaDataPublisherFileOpen(ZegoMediaDataPublisher * mediaDataPublisher, String path)callback/IZegoMediaDataPublisherEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| mediaDataPublisher | ZegoMediaDataPublisher * | Callback publisher object |
| path | String | Path of currently open file |
Details
The event callback of the media data publisher opening a media file.
- Trigger: The callback triggered when the media data publisher start loading a media file.
- Available since: 2.17.0
- Restrictions: None.
onMediaDataPublisherFileClose
public void onMediaDataPublisherFileClose(ZegoMediaDataPublisher * mediaDataPublisher, int errorCode, String path)callback/IZegoMediaDataPublisherEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| mediaDataPublisher | ZegoMediaDataPublisher * | Callback publisher object |
| errorCode | int | error code. 0 means closing the file normally. -1 is a file error. -2 is a path exception. -3 is a decoding exception. -4 is an incorrect timestamp. -5 Unable to fix audio/video synchronization. -6 Unsupported audio sample rate. Contact technical support for details. |
| path | String | Path of currently open file |
Details
The event callback of the media data publisher closing a media file.
- Trigger: The callback triggered when the media data publisher start unloading a media file.
- Available since: 2.17.0
- Restrictions: None.
onMediaDataPublisherFileDataBegin
public void onMediaDataPublisherFileDataBegin(ZegoMediaDataPublisher * mediaDataPublisher, String path)callback/IZegoMediaDataPublisherEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| mediaDataPublisher | ZegoMediaDataPublisher * | Callback publisher object |
| path | String | Path of currently open file |
Details
The event callback that the media data publisher has read data from the media file.
- Trigger: The callback triggered when the media data publisher begin to read media data from a media file.
- Available since: 2.17.0
- Restrictions: None.
onMediaDataPublisherFileDataEnd
public void onMediaDataPublisherFileDataEnd(ZegoMediaDataPublisher * mediaDataPublisher, String path)callback/IZegoMediaDataPublisherEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| mediaDataPublisher | ZegoMediaDataPublisher * | Callback publisher object. |
| path | String | The path of the file that has completed stream publishing. |
Details
The media data publisher has finished a file stream publishing.
- Trigger: The callback triggered when the media data publisher has completed a file stream publishing.
- Available since: 3.14.0
- Restrictions: None.
IZegoMediaPlayerEventHandler
Declared in callback/IZegoMediaPlayerEventHandler.java
Methods
onMediaPlayerStateUpdate
public void onMediaPlayerStateUpdate(ZegoMediaPlayer mediaPlayer, ZegoMediaPlayerState state, int errorCode)callback/IZegoMediaPlayerEventHandler.javaParameters
| 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 void onMediaPlayerNetworkEvent(ZegoMediaPlayer mediaPlayer, ZegoMediaPlayerNetworkEvent networkEvent)callback/IZegoMediaPlayerEventHandler.javaParameters
| 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.
onMediaPlayerPlayingProgress
public void onMediaPlayerPlayingProgress(ZegoMediaPlayer mediaPlayer, long millisecond)callback/IZegoMediaPlayerEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| mediaPlayer | ZegoMediaPlayer | Callback player object. |
| millisecond | long | 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 void onMediaPlayerRenderingProgress(ZegoMediaPlayer mediaPlayer, long millisecond)callback/IZegoMediaPlayerEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| mediaPlayer | ZegoMediaPlayer | Callback player object. |
| millisecond | long | 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: None.
onMediaPlayerVideoSizeChanged
public void onMediaPlayerVideoSizeChanged(ZegoMediaPlayer mediaPlayer, int width, int height)callback/IZegoMediaPlayerEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| mediaPlayer | ZegoMediaPlayer | Callback player object. |
| width | int | width. |
| height | int | height. |
Details
The callback triggered when when the resolution of the playback video changes.
- Trigger: When the media player is playing a video resource, This callback will be triggered when playback starts and the resolution of the video changes.
- Available since: 3.11.0
onMediaPlayerRecvSEI
public void onMediaPlayerRecvSEI(ZegoMediaPlayer mediaPlayer, byte[] data)callback/IZegoMediaPlayerEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| mediaPlayer | ZegoMediaPlayer | Callback player object. |
| data | 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
onMediaPlayerSoundLevelUpdate
public void onMediaPlayerSoundLevelUpdate(ZegoMediaPlayer mediaPlayer, float soundLevel)callback/IZegoMediaPlayerEventHandler.javaParameters
| 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
onMediaPlayerFrequencySpectrumUpdate
public void onMediaPlayerFrequencySpectrumUpdate(ZegoMediaPlayer mediaPlayer, float[] spectrumList)callback/IZegoMediaPlayerEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| mediaPlayer | ZegoMediaPlayer | Callback player object. |
| spectrumList | 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
onMediaPlayerFirstFrameEvent
public void onMediaPlayerFirstFrameEvent(ZegoMediaPlayer mediaPlayer, ZegoMediaPlayerFirstFrameEvent event)callback/IZegoMediaPlayerEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| mediaPlayer | ZegoMediaPlayer | Callback player object. |
| event | ZegoMediaPlayerFirstFrameEvent | The first frame callback event type. |
Details
The callback triggered when the media player plays the first frame.
- Trigger: This callback is generated when the media player starts playing.
- Caution: The callback does not actually take effect until call [setEventHandler] to set.
- Related APIs: You need to call the [setPlayerCanvas] interface to set the view for the media player in order to receive the video first frame event callback.
- Available since: 3.5.0
IZegoRangeAudioEventHandler
Declared in callback/IZegoRangeAudioEventHandler.java
Methods
onRangeAudioMicrophoneStateUpdate
public void onRangeAudioMicrophoneStateUpdate(ZegoRangeAudio rangeAudio, ZegoRangeAudioMicrophoneState state, int errorCode)callback/IZegoRangeAudioEventHandler.javaParameters
| 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
IZegoRealTimeSequentialDataEventHandler
Declared in callback/IZegoRealTimeSequentialDataEventHandler.java
Methods
onReceiveRealTimeSequentialData
public void onReceiveRealTimeSequentialData(ZegoRealTimeSequentialDataManager manager, byte[] data, String streamID)callback/IZegoRealTimeSequentialDataEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| manager | ZegoRealTimeSequentialDataManager | The real-time sequential data manager instance that triggers this callback. |
| data | byte[] | The received real-time sequential data. |
| 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: None.
ZegoAccurateSeekConfig
Precise seek configuration
Declared in entity/ZegoAccurateSeekConfig.java
Properties
timeout
public long timeoutThe timeout time for precise search; if not set, the SDK internal default is set to 5000 milliseconds, the effective value range is [2000, 10000], the unit is ms
Methods
ZegoAccurateSeekConfig
ZegoAudioConfig
Audio configuration.
Details
Configure audio bitrate, audio channel, audio encoding for publishing stream
Declared in entity/ZegoAudioConfig.java
Properties
bitrate
public int bitrateAudio bitrate in kbps, default is 48 kbps. The settings before and after publishing stream can be effective
channel
public ZegoAudioChannel channelAudio channel, default is Mono. The setting only take effect before publishing stream
codecID
public ZegoAudioCodecID codecIDcodec ID, default is ZegoAudioCodecIDDefault. The setting only take effect before publishing stream
Methods
ZegoAudioConfig
public ZegoAudioConfigentity/ZegoAudioConfig.javaZegoAudioConfig
public ZegoAudioConfig(ZegoAudioConfigPreset presetType)entity/ZegoAudioConfig.javaZegoAudioEffectPlayConfig
AudioEffectPlayer play configuration.
Declared in entity/ZegoAudioEffectPlayConfig.java
Properties
playCount
public int playCountThe number of play counts. When set to 0, it will play in an infinite loop until the user invoke [stop]. The default is 1, which means it will play only once.
isPublishOut
public boolean isPublishOutWhether to mix audio effects into the publishing stream, the default is false.
Methods
ZegoAudioEffectPlayConfig
public ZegoAudioEffectPlayConfigentity/ZegoAudioEffectPlayConfig.javaZegoAudioEffectPlayer
Declared in ZegoAudioEffectPlayer.java
Methods
setEventHandler
public void setEventHandler(IZegoAudioEffectPlayerEventHandler handler)ZegoAudioEffectPlayer.javaParameters
| Name | Type | Description |
|---|---|---|
| handler | IZegoAudioEffectPlayerEventHandler | event handler for audio effect player. |
Details
Set audio effect player event handler.
- When to call: It can be called after [createAudioEffectPlayer].
- Related APIs: [createAudioEffectPlayer].
- Available since: 1.16.0
- Restrictions: None.
start
public void start(int audioEffectID, String path, ZegoAudioEffectPlayConfig config)ZegoAudioEffectPlayer.javaParameters
| Name | Type | Description |
|---|---|---|
| audioEffectID | int | 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 void stop(int audioEffectID)ZegoAudioEffectPlayer.javaParameters
| Name | Type | Description |
|---|---|---|
| audioEffectID | int | 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 void pause(int audioEffectID)ZegoAudioEffectPlayer.javaParameters
| Name | Type | Description |
|---|---|---|
| audioEffectID | int | 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 void resume(int audioEffectID)ZegoAudioEffectPlayer.javaParameters
| Name | Type | Description |
|---|---|---|
| audioEffectID | int | 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 void stopAll()ZegoAudioEffectPlayer.javaStop playing all audio effect.
- When to call: Some audio effects are Playing.
- Available since: 1.16.0
- Restrictions: None.
pauseAll
public void pauseAll()ZegoAudioEffectPlayer.javaPause playing all audio effect.
- When to call: It can be called after [createAudioEffectPlayer].
- Available since: 1.16.0
- Restrictions: None.
resumeAll
public void resumeAll()ZegoAudioEffectPlayer.javaResume playing all audio effect.
- When to call: It can be called after [pauseAll].
- Available since: 1.16.0
- Restrictions: None.
seekTo
public void seekTo(int audioEffectID, long millisecond, IZegoAudioEffectPlayerSeekToCallback callback)ZegoAudioEffectPlayer.javaParameters
| Name | Type | Description |
|---|---|---|
| audioEffectID | int | ID for the audio effect. |
| millisecond | long | Point in time of specified playback progress. |
| callback | IZegoAudioEffectPlayerSeekToCallback | 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 void setVolume(int audioEffectID, int volume)ZegoAudioEffectPlayer.javaParameters
| Name | Type | Description |
|---|---|---|
| audioEffectID | int | 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 void setVolumeAll(int volume)ZegoAudioEffectPlayer.javaParameters
| 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.
setPlaySpeed
public void setPlaySpeed(int audioEffectID, float speed)ZegoAudioEffectPlayer.javaParameters
| Name | Type | Description |
|---|---|---|
| audioEffectID | int | ID for the audio effect. |
| speed | float | The speed of play. <br>Value range: The range is 0.5 ~ 2.0. <br>Default value: The default is 1.0. |
Details
Set the playback speed for a given audio effect. Both the local play speed and the publish speed are set. (separate settings are not supported).
- When to call: The specified [audioEffectID] is [start].
- Available since: 2.18.0
- Restrictions: None.
getTotalDuration
public long getTotalDuration(int audioEffectID)ZegoAudioEffectPlayer.javaParameters
| Name | Type | Description |
|---|---|---|
| audioEffectID | int | 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 long getCurrentProgress(int audioEffectID)ZegoAudioEffectPlayer.javaParameters
| Name | Type | Description |
|---|---|---|
| audioEffectID | int | 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 void loadResource(int audioEffectID, String path, IZegoAudioEffectPlayerLoadResourceCallback callback)ZegoAudioEffectPlayer.javaParameters
| Name | Type | Description |
|---|---|---|
| audioEffectID | int | ID for the audio effect. |
| 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. |
| callback | IZegoAudioEffectPlayerLoadResourceCallback | load audio effect resource result. |
Details
Load audio effect resource.
- Use cases: In a scene where the same sound effect is played frequently, the SDK provides the function of preloading the sound effect file into the memory in order to optimize the performance of repeatedly reading and decoding the file.
- When to call: It can be called after [createAudioEffectPlayer].
- Available since: 1.16.0
- Restrictions: Preloading supports loading up to 15 sound effect files at the same time, and the duration of the sound effect files cannot exceed 30s, otherwise an error will be reported when loading.
unloadResource
public void unloadResource(int audioEffectID)ZegoAudioEffectPlayer.javaParameters
| Name | Type | Description |
|---|---|---|
| audioEffectID | int | 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: None.
getIndex
public int getIndex()ZegoAudioEffectPlayer.javaGet audio effect player index.
- When to call: It can be called after [createAudioEffectPlayer].
- Available since: 1.16.0
- Restrictions: None.
Audio effect player index.
ZegoAudioFrameParam
Parameter object for audio frame.
Details
Including the sampling rate and channel of the audio frame
Declared in entity/ZegoAudioFrameParam.java
Properties
sampleRate
channel
ZegoAudioSourceMixConfig
Audio source mix config
Details
Used to config whether mix media player, audio effect player and captured system audio into publish stream or not when set audio source.
Declared in entity/ZegoAudioSourceMixConfig.java
Properties
mediaPlayerIndexList
public int[] mediaPlayerIndexListMedia player instance index list.
audioEffectPlayerIndexList
public int[] audioEffectPlayerIndexListAudio effect player instance index list.
enableMixScreenCapture
public boolean enableMixScreenCaptureEnable or disable mix screen capture into publish stream, the input source cannot be set to screen capture. (only for Android and iOS)
ZegoAutoMixerTask
Auto mix stream task object.
Details
When using [StartAutoMixerTask] function to start an auto stream mixing task to the ZEGO RTC server, user need to set this parameter to configure the auto stream mixing task, including the task ID, room ID, audio configuration, output stream list, and whether to enable the sound level callback.
- Use cases: This configuration is required when an auto stream mixing task is requested to the ZEGO RTC server.
- Caution: As an argument passed when [StartAutoMixerTask] function is called.
Declared in entity/ZegoAutoMixerTask.java
Properties
taskID
public String taskIDAuto stream mixing task id, must be unique in a room.
- Use cases: User need to set this parameter when initiating an auto stream mixing task.
- Required: Yes.
- Recommended value: Set this parameter based on requirements.
- Value range: A string up to 256 bytes.
- Caution: When starting a new auto stream mixing task, only one auto stream mixing task ID can exist in a room, that is, to ensure the uniqueness of task ID. You are advised to associate task ID with room ID. You can directly use the room ID as the task ID.Cannot include URL keywords, for example, 'http' and '?' etc, otherwise publishing stream and playing stream will fail. Only support numbers, English characters and '~', '!', '@', '$', '%', '^', '&', '*', '(', ')', '_', '+', '=', '-', '`', ';', '’', ',', '.', '<', '>', '/', ''.
roomID
public String roomIDAuto stream mixing task id.
- Use cases: User need to set this parameter when initiating an auto stream mixing task.
- Required: Yes.
- Recommended value: Set this parameter based on requirements.
- Value range: A string up to 128 bytes.
- Caution: Only support numbers, English characters and '~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', '=', '-', '`', ';', '’', ',', '.', '<', '>', ''.If you need to communicate with the Web SDK, please do not use '%'.
audioConfig
public ZegoMixerAudioConfig audioConfigThe audio config of the auto mixer task.
- Use cases: If user needs special requirements for the audio config of the auto stream mixing task, such as adjusting the audio bitrate, user can set this parameter as required. Otherwise, user do not need to set this parameter.
- Required: No.
- Default value: The default audio bitrate is
48 kbps, the default audio channel isZEGO_AUDIO_CHANNEL_MONO, the default encoding ID isZEGO_AUDIO_CODEC_ID_DEFAULT, and the default multi-channel audio stream mixing mode isZEGO_AUDIO_MIX_MODE_RAW. - Recommended value: Set this parameter based on requirements.
outputList
public ArrayList<ZegoMixerOutput> outputListThe output list of the auto stream mixing task, items in the list are URL or stream ID, if the item set to be URL format, only RTMP URL surpported, for example rtmp://xxxxxxxx.
- Use cases: User need to set this parameter to specify the mix stream output target when starting an auto stream mixing task.
- Required: Yes.
enableSoundLevel
public boolean enableSoundLevelEnable or disable sound level callback for the task.If enabled, then the remote player can get the sound level of every stream in the inputlist by [onAutoMixerSoundLevelUpdate] callback.
- Use cases: This parameter needs to be configured if user need the sound level information of every stream when an auto stream mixing task started.
- Required: No.
- Default value:
false. - Recommended value: Set this parameter based on requirements.
streamAlignmentMode
minPlayStreamBufferLength
public int minPlayStreamBufferLengthSets the lower limit of the interval range for the adaptive adjustment of the stream playing cache of the stream mixing server. In the real-time chorus KTV scenario, slight fluctuations in the network at the push end may cause the mixed stream to freeze. At this time, when the audience pulls the mixed stream, there is a high probability of the problem of freeze. By adjusting the lower limit of the interval range for the adaptive adjustment of the stream playing cache of the stream mixing server, it can optimize the freezing problem that occurs when playing mixing streams at the player end, but it will increase the delay. It is not set by default, that is, the server uses its own configuration values. It only takes effect for the new input stream setting, and does not take effect for the input stream that has already started mixing.Value Range: [0,10000], exceeding the maximum value will result in a failure of the stream mixing request. On web platforms, this property does not take effect.
streamAlignmentVolumeControlMode
public ZegoStreamAlignmentVolumeControlMode streamAlignmentVolumeControlModeStream mixing alignment scene volume adjustment mode.
streamAlignmentBaselineStreamID
public String streamAlignmentBaselineStreamIDStream mixing alignment scene baseline streamID.
Methods
ZegoAutoMixerTask
public ZegoAutoMixerTaskentity/ZegoAutoMixerTask.javaZegoBarrageMessageInfo
Barrage message info.
Details
The received object of the room barrage message, including the message content, message ID, sender, sending time
Declared in entity/ZegoBarrageMessageInfo.java
Properties
message
public String messagemessage content
messageID
public String messageIDmessage id
sendTime
public long sendTimeMessage send time, UNIX timestamp, in milliseconds.
fromUser
public ZegoUser fromUserMessage sender.Please do not fill in sensitive user information in this field, including but not limited to mobile phone number, ID number, passport number, real name, etc.
ZegoBeautifyOption
Beauty configuration options.
Details
Configure the parameters of skin peeling, whitening and sharpening
Declared in entity/ZegoBeautifyOption.java
Properties
polishStep
public double polishStepThe sample step size of beauty peeling, the value range is [0,1], default 0.2
whitenFactor
public double whitenFactorBrightness parameter for beauty and whitening, the larger the value, the brighter the brightness, ranging from [0,1], default 0.5
sharpenFactor
public double sharpenFactorBeauty sharpening parameter, the larger the value, the stronger the sharpening, value range [0,1], default 0.1
ZegoBlurInfo
blur info.
Details
mix stream blur padding info.
- Use cases: Set text watermark in manual stream mixing scene, such as Co-hosting.
Declared in entity/ZegoBlurInfo.java
Properties
topPadding
public int topPadding- Required: False.
- Default value: 0.
leftPadding
public int leftPadding- Required: False.
- Default value: 0.
bottomPadding
public int bottomPaddingThe distance between the feathered edge and the bottom canvas border.
rightPadding
public int rightPadding- Required: False.
- Default value: 0.
Methods
ZegoBlurInfo
ZegoBroadcastMessageInfo
Broadcast message info.
Details
The received object of the room broadcast message, including the message content, message ID, sender, sending time
Declared in entity/ZegoBroadcastMessageInfo.java
Properties
message
public String messagemessage content
messageID
public long messageIDmessage id
sendTime
public long sendTimeMessage send time, UNIX timestamp, in milliseconds.
fromUser
public ZegoUser fromUserMessage sender.Please do not fill in sensitive user information in this field, including but not limited to mobile phone number, ID number, passport number, real name, etc.
ZegoCDNConfig
CDN config object.
Details
Includes CDN URL and authentication parameter string
Declared in entity/ZegoCDNConfig.java
Properties
url
public String urlCDN URL
authParam
public String authParamAuth param of URL. Please contact ZEGO technical support if you need to use it, otherwise this parameter can be ignored (set to null or empty string).
protocol
public String protocolURL supported protocols, candidate values are "tcp" and "quic". If there are more than one, separate them with English commas and try them in order. Please contact ZEGO technical support if you need to use it, otherwise this parameter can be ignored (set to null or empty string).
quicVersion
public String quicVersionQUIC version。 If [protocol] has the QUIC protocol, this information needs to be filled in. If there are multiple version numbers, separate them with commas. Please contact ZEGO technical support if you need to use it, otherwise this parameter can be ignored (set to null or empty string).
httpdns
public ZegoHttpDNSType httpdnscustomized httpdns service. This feature is only supported for playing stream currently.
quicConnectMode
public int quicConnectModeQUIC establishes link mode. If the value is 1, quic 0 rtt is used preferentially to establish link. Otherwise, the link is established normally. If [protocol] has the QUIC protocol, this value takes effect.
customParams
public String customParamscustom param of URL. Please contact ZEGO technical support if you need to use it, otherwise this parameter can be ignored (set to null or empty string).
ZegoCopyrightedMusic
Declared in ZegoCopyrightedMusic.java
Methods
setEventHandler
public void setEventHandler(IZegoCopyrightedMusicEventHandler handler)ZegoCopyrightedMusic.javaParameters
| Name | Type | Description |
|---|---|---|
| handler | IZegoCopyrightedMusicEventHandler | The object used to receive copyrighted music callbacks. |
Details
Set the callback function of the copyrighted music module, which can receive callback notifications related to song playback status .
- When to call: After create the copyrighted music [createCopyrightedMusic].
- Available since: 2.13.0
initCopyrightedMusic
public void initCopyrightedMusic(ZegoCopyrightedMusicConfig config, IZegoCopyrightedMusicInitCallback callback)ZegoCopyrightedMusic.javaParameters
| Name | Type | Description |
|---|---|---|
| config | ZegoCopyrightedMusicConfig | the copyrighted music configuration. |
| callback | IZegoCopyrightedMusicInitCallback | 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 long getCacheSize()ZegoCopyrightedMusic.javaWhen using this module, some cache files may be generated, and the size of the cache file can be obtained through this interface. Use case: Used to display the cache size of the App.
- When to call: After initializing the copyrighted music [createCopyrightedMusic].
- Available since: 2.13.0
cache file size, in byte.
clearCache
public void clearCache()ZegoCopyrightedMusic.javaWhen 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 void sendExtendedRequest(String command, String params, IZegoCopyrightedMusicSendExtendedRequestCallback callback)ZegoCopyrightedMusic.javaParameters
| Name | Type | Description |
|---|---|---|
| command | String | request command, details about the commands supported. |
| params | String | request parameters, each request command has corresponding request parameters. |
| callback | IZegoCopyrightedMusicSendExtendedRequestCallback | 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 void getLrcLyric(String songID, ZegoCopyrightedMusicVendorID vendorID, IZegoCopyrightedMusicGetLrcLyricCallback callback)ZegoCopyrightedMusic.javaParameters
| 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 | IZegoCopyrightedMusicGetLrcLyricCallback | 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 void getLrcLyric(ZegoCopyrightedMusicGetLyricConfig config, IZegoCopyrightedMusicGetLrcLyricCallback callback)ZegoCopyrightedMusic.javaParameters
| Name | Type | Description |
|---|---|---|
| config | ZegoCopyrightedMusicGetLyricConfig | The configuration of get lyric. |
| callback | IZegoCopyrightedMusicGetLrcLyricCallback | 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 void getKrcLyricByToken(String krcToken, IZegoCopyrightedMusicGetKrcLyricByTokenCallback callback)ZegoCopyrightedMusic.javaParameters
| 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 | IZegoCopyrightedMusicGetKrcLyricByTokenCallback | 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 void requestResource(ZegoCopyrightedMusicRequestConfigV2 config, IZegoCopyrightedMusicRequestResourceCallback callback)ZegoCopyrightedMusic.javaParameters
| Name | Type | Description |
|---|---|---|
| config | ZegoCopyrightedMusicRequestConfigV2 | The configuration of requesting music resource. |
| callback | IZegoCopyrightedMusicRequestResourceCallback | 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 void getSharedResource(ZegoCopyrightedMusicGetSharedConfigV2 config, IZegoCopyrightedMusicGetSharedResourceCallback callback)ZegoCopyrightedMusic.javaParameters
| Name | Type | Description |
|---|---|---|
| config | ZegoCopyrightedMusicGetSharedConfigV2 | The configuration of getting shared music resource. |
| callback | IZegoCopyrightedMusicGetSharedResourceCallback | 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 void download(String resourceID, IZegoCopyrightedMusicDownloadCallback callback)ZegoCopyrightedMusic.javaParameters
| Name | Type | Description |
|---|---|---|
| resourceID | String | the resource ID corresponding to the song or accompaniment. |
| callback | IZegoCopyrightedMusicDownloadCallback | 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 void cancelDownload(String resourceID)ZegoCopyrightedMusic.javaParameters
| 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 boolean queryCache(ZegoCopyrightedMusicQueryCacheConfigV2 config)ZegoCopyrightedMusic.javaParameters
| 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 long getDuration(String resourceID)ZegoCopyrightedMusic.javaParameters
| 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 void setScoringLevel(int level)ZegoCopyrightedMusic.javaParameters
| 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 int startScore(String resourceID, int pitchValueInterval)ZegoCopyrightedMusic.javaParameters
| 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 int pauseScore(String resourceID)ZegoCopyrightedMusic.javaParameters
| 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 int resumeScore(String resourceID)ZegoCopyrightedMusic.javaParameters
| 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 int stopScore(String resourceID)ZegoCopyrightedMusic.javaParameters
| 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 int resetScore(String resourceID)ZegoCopyrightedMusic.javaParameters
| 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 int getPreviousScore(String resourceID)ZegoCopyrightedMusic.javaParameters
| 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 int getAverageScore(String resourceID)ZegoCopyrightedMusic.javaParameters
| 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 int getTotalScore(String resourceID)ZegoCopyrightedMusic.javaParameters
| 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 int getFullScore(String resourceID)ZegoCopyrightedMusic.javaParameters
| 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 void getStandardPitch(String resourceID, IZegoCopyrightedMusicGetStandardPitchCallback callback)ZegoCopyrightedMusic.javaParameters
| Name | Type | Description |
|---|---|---|
| resourceID | String | the resource ID corresponding to the accompaniment or accompaniment clip. |
| callback | IZegoCopyrightedMusicGetStandardPitchCallback | 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 int getCurrentPitch(String resourceID)ZegoCopyrightedMusic.javaParameters
| 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 void requestSong(ZegoCopyrightedMusicRequestConfig config, IZegoCopyrightedMusicRequestSongCallback callback)ZegoCopyrightedMusic.javaParameters
| Name | Type | Description |
|---|---|---|
| config | ZegoCopyrightedMusicRequestConfig | request configuration. |
| callback | IZegoCopyrightedMusicRequestSongCallback | 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 void requestAccompaniment(ZegoCopyrightedMusicRequestConfig config, IZegoCopyrightedMusicRequestAccompanimentCallback callback)ZegoCopyrightedMusic.javaParameters
| Name | Type | Description |
|---|---|---|
| config | ZegoCopyrightedMusicRequestConfig | request configuration. |
| callback | IZegoCopyrightedMusicRequestAccompanimentCallback | 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 void requestAccompanimentClip(ZegoCopyrightedMusicRequestConfig config, IZegoCopyrightedMusicRequestAccompanimentClipCallback callback)ZegoCopyrightedMusic.javaParameters
| Name | Type | Description |
|---|---|---|
| config | ZegoCopyrightedMusicRequestConfig | request configuration. |
| callback | IZegoCopyrightedMusicRequestAccompanimentClipCallback | 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 void getMusicByToken(String shareToken, IZegoCopyrightedMusicGetMusicByTokenCallback callback)ZegoCopyrightedMusic.javaParameters
| Name | Type | Description |
|---|---|---|
| shareToken | String | access the corresponding authorization token for a song or accompaniment. |
| callback | IZegoCopyrightedMusicGetMusicByTokenCallback | 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 void getLrcLyric(String songID, IZegoCopyrightedMusicGetLrcLyricCallback callback)ZegoCopyrightedMusic.javaParameters
| Name | Type | Description |
|---|---|---|
| songID | String | the ID of the song or accompaniment, the song and accompaniment of a song share the same ID. |
| callback | IZegoCopyrightedMusicGetLrcLyricCallback | 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 boolean queryCache(String songID, ZegoCopyrightedMusicType type)ZegoCopyrightedMusic.javaParameters
| 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 boolean queryCache(String songID, ZegoCopyrightedMusicType type, ZegoCopyrightedMusicVendorID vendorID)ZegoCopyrightedMusic.javaParameters
| 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
ZegoCopyrightedMusicConfig
CopyrightedMusic play configuration.
Declared in entity/ZegoCopyrightedMusicConfig.java
Properties
user
public ZegoUser userUser object instance, configure userID, userName. that the user ID set here needs to be consistent with the user ID set when logging in to the room, otherwise the request for the copyright music background service will fail.
ZegoCopyrightedMusicGetLyricConfig
The configuration of getting lyric.
Declared in entity/ZegoCopyrightedMusicGetLyricConfig.java
Properties
songID
public String songIDthe ID of the song.
vendorID
public int vendorIDCopyright music resource song copyright provider.
Methods
ZegoCopyrightedMusicGetLyricConfig
entity/ZegoCopyrightedMusicGetLyricConfig.javaZegoCopyrightedMusicGetSharedConfigV2
The configuration of getting shared resource.
Declared in entity/ZegoCopyrightedMusicGetSharedConfigV2.java
Properties
songID
public String songIDthe ID of the song.
vendorID
public int vendorIDCopyright music resource song copyright provider. Refer to the value of [ZegoCopyrightedMusicVendorID].
roomID
public String roomIDThe room ID, the single-room mode can not be passed, and the corresponding room ID must be passed in the multi-room mode. Indicates which room to get resources from.
resourceType
public int resourceTypeThe resource type of music.
Methods
ZegoCopyrightedMusicGetSharedConfigV2
entity/ZegoCopyrightedMusicGetSharedConfigV2.javaZegoCopyrightedMusicQueryCacheConfigV2
The configuration of querying cache.
Declared in entity/ZegoCopyrightedMusicQueryCacheConfigV2.java
Properties
songID
public String songIDthe ID of the song.
resourceType
public int resourceTypeThe resource type of music. Refer to the value of [ZegoCopyrightedMusicResourceType].
resourceQualityType
public int resourceQualityTypeThe resource quality type of music. Refer to the value of [ZegoCopyrightedMusicResourceQualityType].
vendorID
public int vendorIDCopyright music resource song copyright provider. Refer to the value of [ZegoCopyrightedMusicVendorID].
Methods
ZegoCopyrightedMusicQueryCacheConfigV2
entity/ZegoCopyrightedMusicQueryCacheConfigV2.javaZegoCopyrightedMusicRequestConfig
The configuration of requesting resource.
Declared in entity/ZegoCopyrightedMusicRequestConfig.java
Properties
songID
public String songIDthe ID of the song.
mode
vendorID
public ZegoCopyrightedMusicVendorID vendorIDCopyright music resource song copyright provider.
roomID
public String roomIDThe room ID, the single-room mode can not be passed, and the corresponding room ID must be passed in the multi-room mode. Indicate in which room to order song/accompaniment/accompaniment clip/accompaniment segment.
masterID
public String masterIDThe master ID, which must be passed when the billing mode is billed by host. Indicate which homeowner to order song/accompaniment/accompaniment clip/accompaniment segment.
sceneID
public int sceneIDThe scene ID, indicate the actual business. For details, please consult ZEGO technical support.
Methods
ZegoCopyrightedMusicRequestConfig
entity/ZegoCopyrightedMusicRequestConfig.javaZegoCopyrightedMusicRequestConfigV2
The configuration of requesting resource.
Declared in entity/ZegoCopyrightedMusicRequestConfigV2.java
Properties
songID
public String songIDthe ID of the song.
mode
public int modeVOD billing mode. Refer to the value of [ZegoCopyrightedMusicBillingMode].
vendorID
public int vendorIDCopyright music resource song copyright provider. Refer to the value of [ZegoCopyrightedMusicVendorID].
roomID
public String roomIDThe room ID, the single-room mode can not be passed, and the corresponding room ID must be passed in the multi-room mode. Indicate in which room to order song/accompaniment/accompaniment clip/accompaniment segment.
masterID
public String masterIDThe master ID, which must be passed when the billing mode is billed by host. Indicate which homeowner to order song/accompaniment/accompaniment clip/accompaniment segment.
sceneID
public int sceneIDThe scene ID, indicate the actual business. For details, please consult ZEGO technical support.
resourceType
public int resourceTypeThe resource type of music. Refer to the value of [ZegoCopyrightedMusicResourceType].
Methods
ZegoCopyrightedMusicRequestConfigV2
entity/ZegoCopyrightedMusicRequestConfigV2.javaZegoCrossAppInfo
Cross APP playing stream configuration.
Declared in entity/ZegoCrossAppInfo.java
Properties
appID
public long appIDAppID for playing streams across apps.
token
public String tokenThe token that needs to be set.
ZegoCustomAudioConfig
Custom audio configuration.
Declared in entity/ZegoCustomAudioConfig.java
Properties
sourceType
ZegoCustomAudioProcessConfig
Customize the audio processing configuration object.
Details
Including custom audio acquisition type, sampling rate, channel number, sampling number and other parameters
Declared in entity/ZegoCustomAudioProcessConfig.java
Properties
sampleRate
public ZegoAudioSampleRate sampleRateSampling rate, the sampling rate of the input data expected by the audio pre-processing module in App. If 0, the default is the SDK internal sampling rate.
channel
public ZegoAudioChannel channelNumber of sound channels, the expected number of sound channels for input data of the audio pre-processing module in App. If 0, the default is the number of internal channels in the SDK
samples
public int samplesThe number of samples required to encode a frame; if samples = 0, the SDK will use the internal sample number, and the SDK will pass the audio data to the external pre-processing module. If the samples! = 0 (the effective value of samples is between [160, 2048]), and the SDK will send audio data to the external preprocessing module that sets the length of sample number.
ZegoCustomPlayerResourceConfig
Custom play stream resource type configuration.
Details
Custom play stream resource type configuration.
Declared in entity/ZegoCustomPlayerResourceConfig.java
Properties
beforePublish
public ZegoResourceType beforePublishThe resource type selected by the play stream before starting the publish stream.
publishing
public ZegoResourceType publishingThe type of resource selected by the play stream in the publish stream.
afterPublish
public ZegoResourceType afterPublishThe type of resource selected by the play stream after stopping the publish stream.
ZegoCustomVideoCaptureConfig
Custom video capture configuration.
Details
Custom video capture, that is, the developer is responsible for collecting video data and sending the collected video data to SDK for video data encoding and publishing to the ZEGO RTC server. This feature is generally used by developers who use third-party beauty features or record game screen living. When you need to use the custom video capture function, you need to set an instance of this class as a parameter to the [enableCustomVideoCapture] function. Because when using custom video capture, SDK will no longer start the camera to capture video data. You need to collect video data from video sources by yourself.
Declared in entity/ZegoCustomVideoCaptureConfig.java
Properties
bufferType
ZegoCustomVideoRenderConfig
Custom video render configuration.
Details
When you need to use the custom video render function, you need to set an instance of this class as a parameter to the [enableCustomVideoRender] function.
Declared in entity/ZegoCustomVideoRenderConfig.java
Properties
bufferType
frameFormatSeries
public ZegoVideoFrameFormatSeries frameFormatSeriesCustom video rendering video frame data format。Useless when set bufferType as [EncodedData]
enableEngineRender
public boolean enableEngineRenderWhether the engine also renders while customizing video rendering. The default value is [false]. Useless when set bufferType as [EncodedData]
ZegoDataRecordConfig
Record config.
Declared in entity/ZegoDataRecordConfig.java
Properties
filePath
public String filePathThe path to save the recording file, absolute path, need to include the file name, the file name need to specify the suffix, currently supports .mp4/.flv/.aac format files, if multiple recording for the same path, will overwrite the file with the same name. The maximum length should be less than 1024 bytes. Android developers can pass parameters through Uri, namely:String path = uri.toString();
recordType
ZegoDataRecordProgress
File recording progress.
Declared in entity/ZegoDataRecordProgress.java
Properties
duration
public long durationCurrent recording duration in milliseconds
currentFileSize
public long currentFileSizeCurrent recording file size in byte
quality
ZegoDeviceInfo
Device Info.
Details
Including device ID and name
Declared in entity/ZegoDeviceInfo.java
Properties
deviceID
public String deviceIDDevice ID
deviceName
public String deviceNameDevice name
deviceExtraInfo
public String deviceExtraInfoDevice extra info, Format: key="value" key2="value2"..., use line break to separate key-value pairs, and use equal sign = to separate key and "value", and there are double quotes around the value
ZegoDumpDataConfig
Dump data config.
Declared in entity/ZegoDumpDataConfig.java
Properties
dataType
ZegoEffectsBeautyParam
Beauty configuration param.
Details
Configure the whiten, rosy, smooth, and sharpen parameters for beauty.
Declared in entity/ZegoEffectsBeautyParam.java
Properties
whitenIntensity
public int whitenIntensityThe whiten intensity parameter, the value range is [0,100], and the default is 50.
rosyIntensity
public int rosyIntensitythe rosy intensity parameter, value range [0,100], and the default is 50.
smoothIntensity
public int smoothIntensitythe smooth intensity parameter, value range [0,100], and the default is 50.
sharpenIntensity
public int sharpenIntensitythe sharpen intensity parameter, value range [0,100], and the default is 50.
ZegoEngineConfig
Advanced engine configuration.
Declared in entity/ZegoEngineConfig.java
Properties
logConfig
public ZegoLogConfig logConfigLog configuration, if not set, use the default configuration. It must be set before calling [createEngine] to take effect. If it is set after [createEngine], it will take effect at the next [createEngine] after [destroyEngine].
advancedConfig
public HashMap<String, String> advancedConfigOther special function switches, if not set, no special function will be used by default. Please contact ZEGO technical support before use.
soFullPath
public String soFullPathDynamic shared library (.so) path. For developers who need to dynamically load the shared library, the default is empty string, that is to use the project embed shared library.
Methods
ZegoEngineConfig
ZegoEngineProfile
Profile for create engine
Details
Profile for create engine
Declared in entity/ZegoEngineProfile.java
Properties
appID
public long appIDApplication 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
public String appSignApplication 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.
scenario
public ZegoScenario scenarioThe 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
ZegoExpressEngine
Declared in ZegoExpressEngine.java
Methods
createEngine
public ZegoExpressEngine createEngine(ZegoEngineProfile profile, IZegoEventHandler eventHandler)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| profile | ZegoEngineProfile | The basic configuration information is used to create the engine. |
| eventHandler | IZegoEventHandler | Event notification callback. [NULL] means not receiving any callback notifications.It can also be managed later via [setEventHandler]. If [createEngine] is called repeatedly and the [destroyEngine] function is not called to destroy the engine before the second call, the eventHandler will not be updated. |
Details
Create ZegoExpressEngine singleton object and initialize SDK.
- When to call: The engine needs to be created before calling other functions.
- Caution: The SDK only supports the creation of one instance of ZegoExpressEngine. If you need call [createEngine] multiple times, you need call [destroyEngine] before you call the next [createEngine]. Otherwise it will return the instance which created by [createEngine] you called last time.
- Available since: 2.14.0
- Restrictions: None.
Return
engine singleton instance.
destroyEngine
public void destroyEngine(IZegoDestroyCompletionCallback callback)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| callback | 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 ZegoExpressEngine getEngine()ZegoExpressEngine.javaIf 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 void setEngineConfig(ZegoEngineConfig config)ZegoExpressEngine.javaParameters
| 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 void setLogConfig(ZegoLogConfig config)ZegoExpressEngine.javaParameters
| 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: None.
setLocalProxyConfig
public void setLocalProxyConfig(ArrayList<ZegoProxyInfo> proxyList, boolean enable)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| proxyList | ArrayList<ZegoProxyInfo> | proxy info. |
| enable | boolean | 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.
setCloudProxyConfig
public void setCloudProxyConfig(ArrayList<ZegoProxyInfo> proxyList, String token, boolean enable)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| proxyList | ArrayList<ZegoProxyInfo> | proxy info. |
| token | String | token. if use appsign auth, ignore. |
| enable | boolean | 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.
setRoomMode
public void setRoomMode(ZegoRoomMode mode)ZegoExpressEngine.javaParameters
| 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.
setGeoFence
public void setGeoFence(ZegoGeoFenceType type, List<Integer> areaList)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| type | ZegoGeoFenceType | Geo fence type. Description: Used to set the geo fence type. |
| areaList | List<Integer> | Geo fence area. Description: Used to describe the range of geo fence. |
Details
If you need to use the geo fence feature, please call this function to complete the configuration.
- When to call: Must be set before calling [createEngine] to take effect, otherwise it will fail.
- Caution: None.
- Available since: 3.4.0
- Restrictions: If you need to use the geo fence feature, please contact ZEGO Technical Support.
getVersion
public String getVersion()ZegoExpressEngine.javaIf you encounter an abnormality during the running of the SDK, you can submit the problem, log and other information to the ZEGO technical staff to locate and troubleshoot. Developers can also collect current SDK version information through this API, which is convenient for App operation statistics and related issues.
- When to call: Any time.
- Caution: None.
- Available since: 1.1.0
- Restrictions: None.
SDK version.
setApiCalledCallback
public void setApiCalledCallback(IZegoApiCalledEventHandler callback)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| callback | IZegoApiCalledEventHandler | Method execution result callback. |
Details
Set the setting of the execution result of the calling method. After setting, you can get the detailed information of the result of each execution of the ZEGO SDK method.
- When to call: Any time.
- Caution: It is recommended that developers call this interface only when they need to obtain the call results of each interface. For example, when troubleshooting and tracing problems. Developers generally do not need to pay attention to this interface.
- Available since: 2.3.0
- Restrictions: None.
isFeatureSupported
public boolean isFeatureSupported(ZegoFeatureType featureType)ZegoExpressEngine.javaParameters
| 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
Return
Whether the specified feature is supported. true: supported; false: not supported.
submitLog
public void submitLog()ZegoExpressEngine.javaBy 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 ZegoExpressEngine createEngine(long appID, String appSign, boolean isTestEnv, ZegoScenario scenario, IZegoEventHandler eventHandler)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| appID | long | 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 | boolean | [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 |
| eventHandler | IZegoEventHandler | Event notification callback. [NULL] means not receiving any callback notifications.It can also be managed later via [setEventHandler]. If [createEngine] is called repeatedly and the [destroyEngine] function is not called to destroy the engine before the second call, the eventHandler will not be updated. |
Details
Create ZegoExpressEngine singleton object and initialize SDK.
- When to call: The engine needs to be created before calling other functions.
- Caution: The SDK only supports the creation of one instance of ZegoExpressEngine. If you need call [createEngine] multiple times, you need call [destroyEngine] before you call the next [createEngine]. Otherwise it will return the instance which created by [createEngine] you called last time.
- Restrictions: None.
Return
Engine singleton instance.
setEventHandler
public void setEventHandler(IZegoEventHandler eventHandler)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| eventHandler | IZegoEventHandler | Event notification callback. If the eventHandler is set to [null], all the callbacks set previously will be cleared. Developers should monitor the corresponding callbacks according to their own business scenarios. The main callback functions of the SDK are here. |
Details
Set up event notification callbacks, used to monitor callbacks such as engine status changes, room status changes, etc.
- When to call: After [createEngine].
- Caution: After calling this function or [createEngine] setting a callback, unless this function is called to clear the callback, setting a callback again will not take effect. After calling [destroyEngine], the event handler that has been set will be invalid and need to be reset after next calling of [createEngine].
- Available since: 1.1.0
- Restrictions: None.
setRoomScenario
public void setRoomScenario(ZegoScenario scenario)ZegoExpressEngine.javaParameters
| 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 void uploadLog()ZegoExpressEngine.javaBy default, SDK creates and prints log files in the App's default directory. Each log file defaults to a maximum of 5MB. Three log files are written over and over in a circular fashion. When calling this function, SDK will auto package and upload the log files to the ZEGO server.
- Use cases: Developers can provide a business “feedback” channel in the App. When users feedback problems, they can call this function to upload the local log information of SDK to help locate user problems.
- When to call: After [createEngine].
- Caution: 1.After calling this interface to upload logs, if you call [destroyEngine] or exit the App too quickly, there may be a failure.It is recommended to wait a few seconds, and then call [destroyEngine] or exit the App after receiving the upload success callback. 2.If you want to call before [createEngine], use the [submitLog] interface.
- Available since: 1.1.0
- Restrictions: The frequency limit is once per minute.
uploadLog
public void uploadLog(IZegoUploadLogResultCallback callback)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| callback | IZegoUploadLogResultCallback | Log upload result callback. |
Details
By default, SDK creates and prints log files in the App's default directory. Each log file defaults to a maximum of 5MB. Three log files are written over and over in a circular fashion. When calling this function, SDK will auto package and upload the log files to the ZEGO server.
- Use cases: Developers can provide a business “feedback” channel in the App. When users feedback problems, they can call this function to upload the local log information of SDK to help locate user problems.
- When to call: After [createEngine].
- Caution: 1.After calling this interface to upload logs, if you call [destroyEngine] or exit the App too quickly, there may be a failure.It is recommended to wait a few seconds, and then call [destroyEngine] or exit the App after receiving the upload success callback. 2.If you want to call before [createEngine], use the [submitLog] interface.
- Available since: 2.4.0
- Restrictions: The frequency limit is once per minute.
enableDebugAssistant
public void enableDebugAssistant(boolean enable)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| enable | boolean | 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.
- 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 String callExperimentalAPI(String params)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| params | 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
Return
Returns an argument in the format of a JSON string, please consult ZEGO technical support for details.
loginRoom
public void loginRoom(String roomID, ZegoUser user)ZegoExpressEngine.javaParameters
| 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. |
Details
If the room does not exist, [loginRoom] creates and logs in the room. SDK uses the 'room' to organize users. After users log in to a room, they can use interface such as push stream [startPublishingStream], pull stream [startPlayingStream], send and receive broadcast messages [sendBroadcastMessage], etc.
- Use cases: In the same room, users can conduct live broadcast, audio and video calls, etc.
- When to call /Trigger: This interface is called after [createEngine] initializes the SDK.
- Caution: 1. Apps that use different appIDs cannot intercommunication with each other. 2. SDK supports startPlayingStream audio and video streams from different rooms under the same appID, that is, startPlayingStream audio and video streams across rooms. Since ZegoExpressEngine's room related callback notifications are based on the same room, when developers want to startPlayingStream streams across rooms, developers need to maintain related messages and signaling notifications by themselves. 3. It is strongly recommended that userID corresponds to the user ID of the business APP, that is, a userID and a real user are fixed and unique, and should not be passed to the SDK in a random userID. Because the unique and fixed userID allows ZEGO technicians to quickly locate online problems. 4. After the first login failure due to network reasons or the room is disconnected, the default time of SDK reconnection is 20min.
- Privacy reminder: Please do not fill in sensitive user information in this interface, including but not limited to mobile phone number, ID number, passport number, real name, etc.
- Related callbacks: 1. When the user starts to log in to the room, the room is successfully logged in, or the room fails to log in, the [onRoomStateChanged] (Not supported before 2.18.0, please use [onRoomStateUpdate]) callback will be triggered to notify the developer of the status of the current user connected to the room. 2. Different users who log in to the same room can get room related notifications in the same room (eg [onRoomUserUpdate], [onRoomStreamUpdate], etc.), and users in one room cannot receive room signaling notifications in another room. 3. If the network is temporarily interrupted due to network quality reasons, the SDK will automatically reconnect internally. You can get the current connection status of the local room by listening to the [onRoomStateChanged] (Not supported before 2.18.0, please use [onRoomStateUpdate]) callback method, and other users in the same room will receive [onRoomUserUpdate] callback notification. 4. Messages sent in one room (e.g. [setStreamExtraInfo], [sendBroadcastMessage], [sendBarrageMessage], [sendCustomCommand], etc.) cannot be received callback ((eg [onRoomStreamExtraInfoUpdate], [onIMRecvBroadcastMessage], [onIMRecvBarrageMessage], [onIMRecvCustomCommand], etc) in other rooms. Currently, SDK does not provide the ability to send messages across rooms. Developers can integrate the SDK of third-party IM to achieve.
- Related APIs: 1. Users can call [logoutRoom] to log out. In the case that a user has successfully logged in and has not logged out, if the login interface is called again, the console will report an error and print the error code 1002001. 2. SDK supports multi-room login, please call [setRoomMode] function to select multi-room mode before engine initialization, and then call [loginRoom] to log in to multi-room. 3. Calling [destroyEngine] will also automatically log out.
- 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 void loginRoom(String roomID, ZegoUser user, ZegoRoomConfig config)ZegoExpressEngine.javaParameters
| 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 void loginRoom(String roomID, ZegoUser user, ZegoRoomConfig config, IZegoRoomLoginCallback callback)ZegoExpressEngine.javaParameters
| 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 | IZegoRoomLoginCallback | 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 void logoutRoom()ZegoExpressEngine.javaThis 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 void logoutRoom(IZegoRoomLogoutCallback callback)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| callback | IZegoRoomLogoutCallback | 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 void logoutRoom(String roomID)ZegoExpressEngine.javaParameters
| 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 '%'. |
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.
logoutRoom
public void logoutRoom(String roomID, IZegoRoomLogoutCallback callback)ZegoExpressEngine.javaParameters
| 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 | IZegoRoomLogoutCallback | 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 void switchRoom(String fromRoomID, String toRoomID)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| fromRoomID | String | Current roomID. |
| toRoomID | String | The next roomID. |
Details
Using this interface allows users to quickly switch from one room to another room.
- Use cases: If you need to quickly switch to the next room, you can call this function.
- When to call /Trigger: After successfully login room.
- Caution: 1. When this function is called, all streams currently publishing or playing will stop (but the local preview will not stop). 2. Multi-room mode is supported in version 3.5.0 (use the function [setRoomMode] to set ZegoRoomMode to ZEGO_ROOM_MODE_MULTI_ROOM). 3. If a Token is passed in for login when logging into the room [loginRoom], the [switchroom] interface must be used with the config parameter and the corresponding Token value passed in when switching rooms.
- Privacy reminder: Please do not fill in sensitive user information in this interface, including but not limited to mobile phone number, ID number, passport number, real name, etc.
- Related callbacks: When the user call the [switchRoom] function, the [onRoomStateChanged] (Not supported before 2.18.0, please use [onRoomStateUpdate]) callback will be triggered to notify the developer of the status of the current user connected to the room.
- Related APIs: Users can use the [logoutRoom] function to log out of the room.
- Available since: 1.14.0
- Restrictions: None.
switchRoom
public void switchRoom(String fromRoomID, String toRoomID, ZegoRoomConfig config)ZegoExpressEngine.javaParameters
| 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 void renewToken(String roomID, String token)ZegoExpressEngine.javaParameters
| 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 void setRoomExtraInfo(String roomID, String key, String value, IZegoRoomSetRoomExtraInfoCallback callback)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| roomID | String | Room ID. |
| key | String | key of the extra info. |
| value | String | value if the extra info. |
| callback | IZegoRoomSetRoomExtraInfoCallback | Callback for setting room extra information. |
Details
The user can call this function to set the extra info of the room.
- Use cases: You can set some room-related business attributes, such as whether someone is Co-hosting.
- When to call /Trigger: After logging in the room successful.
- Caution: For key and value restrictions, please refer to Restrictions. Newly set values will overwrite old ones.
- Related callbacks: Other users in the same room will be notified through the [onRoomExtraInfoUpdate] callback function.
- Related APIs: None.
- 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.
getRoomStreamList
public ZegoRoomStreamList getRoomStreamList(String roomID, ZegoRoomStreamListType streamListType)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| roomID | String | Room ID. |
| streamListType | ZegoRoomStreamListType | Get type |
Details
Get room stream list.
- Use cases: Get room stream list.
- When to call /Trigger: After logging in the room successful.
- Caution: This interface is to get a real-time internal stream list, which may be inaccurate when the room is disconnected from the service. Do not call this interface with high frequency.
- Related APIs: None.
- Available since: 3.12.0
Return
return stream list
startPublishingStream
public void startPublishingStream(String streamID)ZegoExpressEngine.javaParameters
| 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 '-', '_'. |
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 void startPublishingStream(String streamID, int channel)ZegoExpressEngine.javaParameters
| 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 | int | 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 void startPublishingStream(String streamID, ZegoPublisherConfig config, int channel)ZegoExpressEngine.javaParameters
| 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 | int | 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.
stopPublishingStream
public void stopPublishingStream()ZegoExpressEngine.javaThe user stops sending local audio and video streams, and other users in the room will receive a stream deletion notification.
- Use cases: It can be used to stop publish streams in real-time connecting wheat, live broadcast and other scenarios.
- When to call: After [startPublishingStream].
- Caution: 1. After stopping the streaming, other users in the same room can receive the delete notification of the stream by listening to the [onRoomStreamUpdate] callback. 2. If the user has initiated publish flow, this function must be called to stop the publish of the current stream before publishing the new stream (new streamID), otherwise the new stream publish will return a failure. 3. After stopping streaming, the developer should stop the local preview based on whether the business situation requires it.
- Available since: 1.1.0
- Restrictions: None.
stopPublishingStream
public void stopPublishingStream(int channel)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| channel | int | 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 void setStreamExtraInfo(String extraInfo, IZegoPublisherSetStreamExtraInfoCallback callback)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| extraInfo | String | Stream extra information, a string of up to 1024 characters. |
| callback | IZegoPublisherSetStreamExtraInfoCallback | Set stream extra information execution result notification. |
Details
Use this function to set the extra info of the stream. The stream extra information is an extra information identifier of the stream ID. Unlike the stream ID, which cannot be modified during the publishing process, the stream extra information can be modified midway through the stream corresponding to the stream ID. Developers can synchronize variable content related to stream IDs based on stream additional information.
- When to call: After the engine is created [createEngine], Called before and after [startPublishingStream] can both take effect.
- Caution: Act on the main publish channel ZegoPublishChannel.Main.
- Related callbacks: Other users in the same room will be notified through the [onRoomStreamExtraInfoUpdate] callback function.
- Available since: 1.1.0
- Restrictions: None.
setStreamExtraInfo
public void setStreamExtraInfo(String extraInfo, int channel, IZegoPublisherSetStreamExtraInfoCallback callback)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| extraInfo | String | Stream extra information, a string of up to 1024 characters. |
| channel | int | Publish stream channel. |
| callback | IZegoPublisherSetStreamExtraInfoCallback | Set stream extra information execution result notification. |
Details
Use this function to set the extra info of the stream. The stream extra information is an extra information identifier of the stream ID. Unlike the stream ID, which cannot be modified during the publishing process, the stream extra information can be modified midway through the stream corresponding to the stream ID. Developers can synchronize variable content related to stream IDs based on stream additional information.
- When to call: After the engine is created [createEngine], Called before and after [startPublishingStream] can both take effect.
- Related callbacks: Users can obtain the execution result of the function through [ZegoPublisherSetStreamExtraInfoCallback] callback.
- Available since: 1.1.0
- Restrictions: None.
startPreview
public void startPreview(int channel)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| channel | int | 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. This function is only available in ZegoExpressVideo SDK!
- Available since: 1.1.0
- Restrictions: None.
stopPreview
public void stopPreview(int channel)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| channel | int | 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. This function is only available in ZegoExpressVideo SDK!
- Available since: 1.1.0
setVideoConfig
public void setVideoConfig(ZegoVideoConfig config)ZegoExpressEngine.javaParameters
| 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. |
Details
Set the video frame rate, bit rate, video capture resolution, and video encoding output resolution.
- Use cases: Recommended configuration in different business scenarios https://docs.zegocloud.com/article/12122.
- Default value: The default video capture resolution is 360p, the video encoding output resolution is 360p, the bit rate is 600 kbps, and the frame rate is 15 fps.
- When to call: After [createEngine].
- Caution: Developers should note that the wide and high resolution of the mobile end is opposite to the wide and high resolution of the PC. For example, in the case of 360p, the resolution of the mobile end is 360x640, and the resolution of the PC end is 640x360. This function is only available in ZegoExpressVideo SDK!
- Available since: 1.1.0
- Restrictions: It is necessary to set the relevant video configuration before [startPreview], and only support the modification of the encoding resolution, the bit rate and the frame rate after [startPreview].
setVideoConfig
public void setVideoConfig(ZegoVideoConfig config, ZegoPublishChannel channel)ZegoExpressEngine.javaParameters
| 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. This function is only available in ZegoExpressVideo SDK!
- 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 ZegoVideoConfig getVideoConfig()ZegoExpressEngine.javaThis function can be used to get the main publish channel's current video frame rate, bit rate, video capture resolution, and video encoding output resolution. This function is only available in ZegoExpressVideo SDK!
Video configuration object
getVideoConfig
public ZegoVideoConfig getVideoConfig(int channel)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| channel | int | 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. This function is only available in ZegoExpressVideo SDK!
Return
Video configuration object
setPublishDualStreamConfig
public void setPublishDualStreamConfig(ArrayList<ZegoPublishDualStreamConfig> configList, ZegoPublishChannel channel)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| configList | ArrayList<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 .
setAudioConfig
public void setAudioConfig(ZegoAudioConfig config)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| config | ZegoAudioConfig | Audio config. |
Details
You can set the combined value of the audio codec, bit rate, and audio channel through this function. If the preset value cannot meet the developer's scenario, the developer can set the parameters according to the business requirements.
- Default value: The default audio config refers to the default value of [ZegoAudioConfig].
- When to call: After the engine is created [createEngine], and before publishing [startPublishingStream].
- Caution: Act on the main publish channel ZegoPublishChannel.Main.
- Related APIs: [getAudioConfig].
- Available since: 1.3.4
- Restrictions: None.
setAudioConfig
public void setAudioConfig(ZegoAudioConfig config, int channel)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| config | ZegoAudioConfig | Audio config. |
| channel | int | 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 ZegoAudioConfig getAudioConfig()ZegoExpressEngine.javaYou can get the current audio codec, bit rate, and audio channel through this function.
- When to call: After the engine is created [createEngine].
- Caution: Act on the main publish channel ZegoPublishChannel.Main.
- Related APIs: [setAudioConfig].
- Available since: 1.8.0
- Restrictions: None.
Audio config.
getAudioConfig
public ZegoAudioConfig getAudioConfig(int channel)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| channel | int | 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.
setPublishStreamEncryptionKey
public void setPublishStreamEncryptionKey(String key)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| key | String | The encryption key, note that the key length only supports 16/24/32 bytes. |
Details
Support calling this function to update the encryption key while publishing stream.
- When to call: After the engine is created [createEngine], Called before and after [startPublishingStream] can both take effect.
- Caution: that developers need to update the player's decryption key before updating the publisher's encryption key. Act on the main publish channel ZegoPublishChannel.Main.
- Related APIs: Calling [stopPublishingStream] or [logoutRoom] will clear the encryption key.
- Available since: 1.19.0
- Restrictions: This function is only valid when publishing stream to the Zego RTC server.
setPublishStreamEncryptionKey
public void setPublishStreamEncryptionKey(String key, int channel)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| key | String | The encryption key, note that the key length only supports 16/24/32 bytes. |
| channel | int | Publish stream channel. |
Details
Support calling this function to update the encryption key while publishing stream.
- When to call: After the engine is created [createEngine], Called before and after [startPublishingStream] can both take effect.
- Caution: that developers need to update the player's decryption key before updating the publisher's encryption key.
- Related APIs: Calling [stopPublishingStream] or [logoutRoom] will clear the encryption key.
- Available since: 1.19.0
- Restrictions: This function is only valid when publishing stream to the Zego RTC server.
mutePublishStreamAudio
public void mutePublishStreamAudio(boolean mute)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| mute | boolean | Whether to stop sending audio streams, true means not to send audio stream, and false means sending audio stream. The default is false. |
Details
This function can be called when publishing the stream to realize not publishing the audio data stream. The SDK still collects and processes the audio, but send muted audio frame packets to the network. Use case: Users can call this interface when they do not want to publish any audio data. This interface does not affect [onBeforeAudioPrepAudioData].
- When to call: Called after the engine is created [createEngine] can take effect.
- Caution: Act on the main publish channel ZegoPublishChannel.Main.
- Related callbacks: If you stop sending audio streams, the remote user that play stream of local user publishing stream can receive
Mutestatus change notification by monitoring [onRemoteMicStateUpdate] callbacks. - Related APIs: [mutePublishStreamVideo].
- Available since: 1.1.0
- Restrictions: None.
mutePublishStreamAudio
public void mutePublishStreamAudio(boolean mute, int channel)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| mute | boolean | Whether to stop sending audio streams, true means not to send audio stream, and false means sending audio stream. The default is false. |
| channel | int | 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 void mutePublishStreamVideo(boolean mute)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| mute | boolean | Whether to stop sending video streams, true means not to send video stream, and false means sending video stream. The default is false. |
Details
This function can be called when publishing the stream to realize not publishing the video stream. The local camera can still work normally, can capture, preview and process video images normally, but does not send the video data to the network.
- When to call: Called after the engine is created [createEngine] can take effect.
- Caution: Act on the main publish channel ZegoPublishChannel.Main.
- Related callbacks: If you stop sending video streams locally, the remote user that play stream of local user publishing stream can receive
Mutestatus change notification by monitoring [onRemoteCameraStateUpdate] callbacks. - Related APIs: [mutePublishStreamAudio]. This function is only available in ZegoExpressVideo SDK!
- Available since: 1.1.0
- Restrictions: None.
mutePublishStreamVideo
public void mutePublishStreamVideo(boolean mute, int channel)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| mute | boolean | Whether to stop sending video streams, true means not to send video stream, and false means sending video stream. The default is false. |
| channel | int | 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]. This function is only available in ZegoExpressVideo SDK!
- Available since: 1.1.0
- Restrictions: None.
setStreamAlignmentProperty
public void setStreamAlignmentProperty(int alignment, int channel)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| alignment | int | Whether to enable the stream mixing precision alignment function. |
| channel | int | 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 mixing alignment is required.
- When to call: After the engine is created [createEngine].
- Caution: If you need to align each stream through network time when playing multiple streams or mixed streams, you need to call [startPublishingStream] to publish the stream and [forceSynchronousNetworkTime] in [ZegoPublisherConfig] is 1 to enable network time synchronization.
- Related APIs: [startMixerTask], [startAutoMixerTask]
- Available since: 2.11.0.
enableTrafficControl
public void enableTrafficControl(boolean enable, int property)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| enable | boolean | 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.
enableTrafficControl
public void enableTrafficControl(boolean enable, int property, int channel)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| enable | boolean | Whether to enable traffic control. The default is ture. |
| property | int | Adjustable property of traffic control, bitmask format. Should be one or the combinations of [ZegoTrafficControlProperty] enumeration. [AdaptiveFPS] as default. |
| channel | int | Publish stream channel. |
Details
Enabling traffic control allows the SDK to adjust the audio and video streaming bitrate according to the current upstream network environment conditions, or according to the counterpart's downstream network environment conditions in a one-to-one interactive scenario, to ensure smooth results. At the same time, you can further specify the attributes of traffic control to adjust the corresponding control strategy.
- Default value: Enable.
- When to call: After the engine is created [createEngine], Called before [startPublishingStream] can take effect.
- Available since: 1.5.0
- Restrictions: Only support RTC publish.
setMinVideoBitrateForTrafficControl
public void setMinVideoBitrateForTrafficControl(int bitrate, ZegoTrafficControlMinVideoBitrateMode mode)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| bitrate | int | Minimum video bitrate threshold for traffic control(kbps). |
| mode | ZegoTrafficControlMinVideoBitrateMode | Video sending mode below the minimum bitrate. |
Details
Set the control strategy when the video bitrate reaches the lowest threshold during flow control. When the bitrate is lower than the minimum threshold, you can choose not to send video data or send it at a very low frame bitrate.
- Default value: There is no control effect of the lowest threshold of video bitrate.
- When to call: After the engine is created [createEngine], Called before [startPublishingStream] can take effect.
- Caution: Act on the main publish channel ZegoPublishChannel.Main.
- Related APIs: [enableTrafficControl]. This function is only available in ZegoExpressVideo SDK!
- Available since: 1.1.0
- Restrictions: The traffic control must be turned on [enableTrafficControl].
setMinVideoBitrateForTrafficControl
public void setMinVideoBitrateForTrafficControl(int bitrate, ZegoTrafficControlMinVideoBitrateMode mode, int channel)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| bitrate | int | Minimum video bitrate (kbps). |
| mode | ZegoTrafficControlMinVideoBitrateMode | Video sending mode below the minimum bitrate. |
| channel | int | 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]. This function is only available in ZegoExpressVideo SDK!
- Available since: 1.1.0
- Restrictions: The traffic control must be turned on [enableTrafficControl].
setMinVideoFpsForTrafficControl
public void setMinVideoFpsForTrafficControl(int fps, int channel)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| fps | int | The minimum video frame rate threshold for traffic control(fps). |
| channel | int | 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. This function is only available in ZegoExpressVideo SDK!
- Available since: 2.17.0
- Restrictions: The traffic control must be turned on [enableTrafficControl]. And its parameter [property] must contain AdaptiveFPS, Please refer to [ZegoTrafficControlProperty] for details.
setMinVideoResolutionForTrafficControl
public void setMinVideoResolutionForTrafficControl(int width, int height, int channel)ZegoExpressEngine.javaParameters
| 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 | int | 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. This function is only available in ZegoExpressVideo SDK!
- Available since: 2.17.0
- Restrictions: The traffic control must be turned on [enableTrafficControl]. And its parameter [property] must contain AdaptiveResolution, Please refer to [ZegoTrafficControlProperty] for details.
setTrafficControlFocusOn
public void setTrafficControlFocusOn(ZegoTrafficControlFocusOnMode mode)ZegoExpressEngine.javaParameters
| 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. |
Details
Use this interface to control whether to start traffic control due to poor remote network conditions.
- Default value: Default is ZegoTrafficControlFounsOnRemote.
- When to call: After the engine is created [createEngine], Called before [startPublishingStream] can take effect.
- Related APIs: [enableTrafficControl.
- Available since: 2.4.0
- Restrictions: The traffic control must be turned on [enableTrafficControl].
setTrafficControlFocusOn
public void setTrafficControlFocusOn(ZegoTrafficControlFocusOnMode mode, int channel)ZegoExpressEngine.javaParameters
| 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 | int | 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].
setCaptureVolume
public void setCaptureVolume(int volume)ZegoExpressEngine.javaParameters
| 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.
addPublishCdnUrl
public void addPublishCdnUrl(String streamID, String targetURL, IZegoPublisherUpdateCdnUrlCallback callback)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| streamID | String | Stream ID. |
| targetURL | String | CDN relay address, supported address format is rtmp, rtmps. |
| callback | IZegoPublisherUpdateCdnUrlCallback | The execution result of update the relay CDN operation. |
Details
Forward audio and video streams from ZEGO RTC servers to custom CDN content distribution networks with high latency but support for high concurrent pull streams.
- Use cases: 1. It is often used in large-scale live broadcast scenes that do not have particularly high requirements for delay. 2. Since ZEGO RTC server itself can be configured to support CDN(content distribution networks), this function is mainly used by developers who have CDN content distribution services themselves. 3. This function supports dynamic relay to the CDN content distribution network, so developers can use this function as a disaster recovery solution for CDN content distribution services.
- When to call: After calling the [createEngine] function to create the engine.
- Caution: Removing URLs retweeted to CDN requires calling [removePublishCdnUrl], calling [stopPublishingStream] will not remove URLs publish to CDN.
- Related APIs: Remove URLs that are re-pushed to the CDN [removePublishCdnUrl].
- Available since: 1.1.0
- Restrictions: When the [enablePublishDirectToCDN] function is set to true to publish the stream straight to the CDN, then calling this function will have no effect.
addPublishCdnUrl
public void addPublishCdnUrl(String streamID, String targetURL, int timeout, IZegoPublisherUpdateCdnUrlCallback callback)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| streamID | String | Stream ID. |
| targetURL | String | CDN relay address, supported address format is rtmp, rtmps. |
| timeout | int | Timeout. Callback if it does not start in the time. Default is 0, which means no timeout. Valid range is [5, 600], in seconds. Less than 0 will be reset to 0, 1 to 4 will be reset to 5, and a greater than 600 will be reset to 600. |
| callback | IZegoPublisherUpdateCdnUrlCallback | The execution result of update the relay CDN operation. |
Details
Forward audio and video streams from ZEGO RTC servers to custom CDN content distribution networks with high latency but support for high concurrent pull streams.
- Use cases: 1. It is often used in large-scale live broadcast scenes that do not have particularly high requirements for delay. 2. Since ZEGO RTC server itself can be configured to support CDN(content distribution networks), this function is mainly used by developers who have CDN content distribution services themselves. 3. This function supports dynamic relay to the CDN content distribution network, so developers can use this function as a disaster recovery solution for CDN content distribution services.
- When to call: After calling the [createEngine] function to create the engine.
- Caution: Removing URLs retweeted to CDN requires calling [removePublishCdnUrl], calling [stopPublishingStream] will not remove URLs publish to CDN.
- Related APIs: Remove URLs that are re-pushed to the CDN [removePublishCdnUrl].
- Available since: 1.1.0
- Restrictions: When the [enablePublishDirectToCDN] function is set to true to publish the stream straight to the CDN, then calling this function will have no effect.
removePublishCdnUrl
public void removePublishCdnUrl(String streamID, String targetURL, IZegoPublisherUpdateCdnUrlCallback callback)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| streamID | String | Stream ID. |
| targetURL | String | CDN relay address, supported address format rtmp. |
| callback | IZegoPublisherUpdateCdnUrlCallback | The execution result of update the relay CDN operation. |
Details
When a CDN forwarding address has been added via [addPublishCdnUrl], this function is called when the stream needs to be stopped.
- When to call: After calling the [createEngine] function to create the engine, When you don't need to continue publish to the CDN.
- Caution: This function does not stop publishing audio and video stream to the ZEGO ZEGO RTC server.
- Related APIs: Add URLs that are re-pushed to the CDN [addPublishCdnUrl].
- Available since: 1.1.0
- Restrictions: When the [enablePublishDirectToCDN] function is set to true to publish the stream straight to the CDN, then calling this function will have no effect.
enablePublishDirectToCDN
public void enablePublishDirectToCDN(boolean enable, ZegoCDNConfig config)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| enable | boolean | 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. |
Details
Whether to publish streams directly from the client to CDN without passing through Zego RTC server.
- Use cases: It is often used in large-scale live broadcast scenes that do not have particularly high requirements for delay.
- Default value: The default is false, and direct push is not enabled.
- When to call: After creating the engine [createEngine], before starting to push the stream [startPublishingStream].
- Caution: The Direct Push CDN feature does not pass through the ZEGO Real-Time Audio and Video Cloud during network transmission, so you cannot use ZEGO's ultra-low latency audio and video services.
- Related APIs: Dynamic re-push to CDN function [addPublishCdnUrl], [removePublishCdnUrl].
- Available since: 1.5.0
enablePublishDirectToCDN
public void enablePublishDirectToCDN(boolean enable, ZegoCDNConfig config, int channel)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| enable | boolean | 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 | int | 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
setSEIConfig
public void setSEIConfig(ZegoSEIConfig config)ZegoExpressEngine.javaParameters
| 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: 1.18.0
- Restrictions: None.
sendSEI
public void sendSEI(byte[] data)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| data | byte[] | SEI data. |
Details
While pushing the stream to transmit the audio and video stream data, the stream media enhancement supplementary information is sent to synchronize some other additional information.
- Use cases: Generally used in scenes such as synchronizing music lyrics or precise video layout, you can choose to send SEI.
- When to call: After starting to push the stream [startPublishingStream].
- Caution: 1. Due to network issues, frame loss may occur, which means SEI information may also be lost. To address this situation, it is advisable to send it multiple times within a limited frequency. 2. Even if the [enableCamera] interface is called to turn off the camera or [mutePublishStreamVideo] is used to stop sending video data, SEI can still be successfully sent; as long as the playback side does not call the [mutePlayStreamVideo] interface to stop pulling audio data, SEI can still be received normally. 3. If the SDK does not support the video module but does support the SEI functional module, SEI information can still be sent normally.
- Related APIs: After the pusher sends the SEI, the puller can obtain the SEI content by monitoring the callback of [onPlayerRecvSEI].
- Available since: 1.1.0
- Restrictions: Do not exceed 30 times per second, and the SEI data length is limited to 4096 bytes.
sendSEI
public void sendSEI(byte[] data, int channel)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| data | byte[] | SEI data. |
| channel | int | 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.
sendSEISyncWithCustomVideo
public void sendSEISyncWithCustomVideo(byte[] data, long timeStampNs, int channel)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| data | byte[] | SEI data. |
| timeStampNs | long | video frame reference time, UNIX timestamp, in nanosecond. |
| channel | int | Publish stream channel. |
Details
When using custom video capture, push the stream to transmit the video stream data, and send the stream media enhancement supplementary information to synchronize some other additional information, which is synchronized with the current video frame.
- Use cases: Generally used in scenes that need to be played back in strong synchronization with the video frame, such as video karaoke, video and lyrics are strongly synchronized; or scenes that need to be accurate to the frame level for strategic processing.
- When to call: To ensure that the SEI is synchronized with the current video frame, it must be called before sending the video frame data.
- Caution: The sent SEI information follows the video frame. Due to network problems, there may be frame loss. At this time, the SEI will follow the next frame of video data. Therefore, in order to keep the SEI synchronized with the video frame, you should avoid sending SEI continuously; only when using SurfaceTexture on the Android platform , Need to pass the time stamp parameter timeStampNs, otherwise the parameter is invalid.
- Related APIs: After the pusher sends the SEI, the puller can obtain the SEI content by monitoring the callback of [onPlayerRecvSEI].
- Available since: 2.15.0
- Restrictions: Only used for custom video capture; only supports video-driven SEI sending; you should try to avoid calling this interface to send SEI continuously; to ensure that SEI is synchronized with the current video frame, it must be kept in the same thread as the interface for sending custom video frame data; SEI data length is limited to 4096 bytes.
sendAudioSideInfo
public void sendAudioSideInfo(byte[] data, double timeStampMs, int channel)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| data | byte[] | Audio side info data. |
| timeStampMs | double | timeStampMs, derived from custom audio processing, in milliseconds. If you fill in 0, it is sent along with the frame that is currently ready to be sent. |
| channel | int | Publish stream channel. |
Details
While streaming audio data, send audio side information to synchronize some additional information.
- Use cases: In the carousel scene, the audio data channel is required to carry accompanying information, such as timestamps to help align the accompaniment, and the need to know who the user is currently singing, whether to amplify the volume, and so on.
- When to call: After starting to push the stream [startPublishingStream].
- Caution: 1. Audio side information is driven by audio data, so audio data must be pushed (audio side information may be lost when the DTX function is enabled via the interface [setEngineConfig]). 2. Due to network issues, audio side information may be lost, and the SDK is responsible for transmission but does not guarantee reliability.
- Related APIs: After the pusher sends the side information, the puller can obtain the side information content by monitoring the callback of [onPlayerRecvAudioSideInfo].
- Available since: 2.19.0
- Restrictions: 1. This function is only valid when publishing stream to the Zego RTC server and it also doesn't work when retweeting the stream from the RTC server to the CDN. 2. The audio side information data length is limited to 1024 bytes.
enableHardwareEncoder
public void enableHardwareEncoder(boolean enable)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| enable | boolean | 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
setCapturePipelineScaleMode
public void setCapturePipelineScaleMode(ZegoCapturePipelineScaleMode mode)ZegoExpressEngine.javaParameters
| 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. This function is only available in ZegoExpressVideo SDK!
- Available since: 1.1.0
setDummyCaptureImagePath
public void setDummyCaptureImagePath(String filePath, int channel)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| filePath | String | Picture file path |
| channel | int | 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. 4. To publish the audio stream, you must call this interface again and set the image path to empty to avoid video billing.
- Platform differences: 1. Windows: Fill in the location of the picture directly, such as "D://dir//image.jpg". 2. iOS: If it is a full path, add the prefix "file:", such as @"file:/var/image.png"; If it is a assets picture path, add the prefix "asset:", such as @"asset". 3. Android: If it is a full path, add the prefix "file:", such as "file:/sdcard/image.png"; If it is a assets directory path, add the prefix "asset:", such as "asset.png". 4. Flutter: If it is a absolute path, add the prefix "file:", such as "file:/sdcard/image.png"; If it is a assets resources directory path, add the prefix "flutter-asset://", such as "flutter-asset://assets/watermark.png". 5. UniApp: Only absolute paths are supported. You need to add a "file:" prefix, such as: "file:/sdcard/image.png".
- Restrictions: 1. Supported picture types are JPEG/JPG, PNG, BMP, HEIF. 2. The function is only for SDK video capture and does not take effect for custom video capture. 3. Not supported that the filePath is a network link.
enableH265EncodeFallback
public void enableH265EncodeFallback(boolean enable)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| enable | boolean | Whether to enable H.265 coding automatically fallback to H.264 coding, true: enable, false: disable, and the default value is true |
Details
When using H.265 encoding to push the stream, whether to enable the strategy of automatically degrading H.265 encoding to H.264 encoding under abnormal circumstances.After enabling automatic downgrade, when H.265 encoding is not supported or H.265 encoding fails, the SDK will try to downgrade and use H.264 encoding to push the stream.After turning off automatic downgrade, when H.265 encoding is not supported or H.265 encoding fails, the direct streaming fails.
- Use cases: In the Co-hosting and Showroom Live Streaming scenarios, use H265 encoding to push the stream to save CDN traffic without degrading the picture quality. Default Value: When this interface is not called, the default is yes, which means that H.265 encoding is turned on and automatically downgraded to H.264 encoding.
- When to call: After creating the engine, call the [startPublishingStream] function before pushing the stream.
- Related callbacks: When the H.265 encoding is automatically downgraded to the H.264 encoding strategy, the [onPublisherVideoEncoderChanged] callback will be triggered when the encoding method changes.
- Caution: When downgrading from H.265 to H.264 encoding occurs during the streaming process, if you are recording local video or cloud recording, multiple recording files will be generated, which needs to be dealt with.
- Available since: 2.12.0
isVideoEncoderSupported
public boolean isVideoEncoderSupported(ZegoVideoCodecID codecID)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| codecID | ZegoVideoCodecID | Video codec id. Required: Yes. |
Details
Whether the specified video encoding is supported depends on the following aspects, whether the hardware model supports hard encoding, whether the performance of the hardware model supports soft encoding, and whether the SDK has the encoding module.
- When to call: After creating the engine.
- Caution: It is recommended that users call this interface to obtain H.265 encoding support capability before publish stream with H.265 encoding, if not supported, you can use other encodings for publish, such as H.264.On the mobile platform, the SDK only supports H.265 hardware encoding, and it is affected by the model and hardware capabilities.
- Available since: 2.12.0 and above
Return
Whether the specified video encoding is supported.Value range: true means support, you can use this encoding format for publish; false means the is not supported, and the encoding format cannot be used for publish.
isVideoEncoderSupported
public int isVideoEncoderSupported(ZegoVideoCodecID codecID, ZegoVideoCodecBackend codecBackend)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| codecID | ZegoVideoCodecID | Video codec id. Required: Yes. |
| codecBackend | ZegoVideoCodecBackend | Backend implementation of encoder. Required: Yes. |
Details
Whether the specified video encoding is supported depends on the following aspects, whether the hardware model supports hard encoding, whether the performance of the hardware model supports soft encoding, and whether the SDK has the encoding module.
- When to call: After creating the engine.
- Caution: It is recommended that users call this interface to obtain H.265 encoding support capability before publish stream with H.265 encoding, if not supported, you can use other encodings for publish, such as H.264.On the mobile platform, the SDK only supports H.265 hardware encoding, and it is affected by the model and hardware capabilities.
- Available since: 3.0.0 and above
Return
Whether the specified video encoding format is supported; 0 means not supported, and the encoding format cannot be used for publish stream; 1 means support, you can use this encoding format for publish stream; 2 means not confirmed, it is recommended to call this interface later.
setVideoSource
public int setVideoSource(ZegoVideoSourceType source)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| source | ZegoVideoSourceType | Video capture source. |
Details
Set video capture source for switching between different video capture sources.
- Use cases: Typically used in educational scenarios that require switching between different video capture sources.
- When to call: After the engine is created [createEngine].
- Caution: 1. Act on the main publish channel ZegoPublishChannel.Main.
- Main push channel ZegoPublishChannel.Main does not support using ZegoVideoSourceType.Player and ZegoVideoSourceType.MainPublishChannel video source type. This function is only available in ZegoExpressVideo SDK!
- Available since: 3.1.0
- Restrictions: None.
setVideoSource
public int setVideoSource(ZegoVideoSourceType source, int instanceID)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| source | ZegoVideoSourceType | Video capture source. |
| instanceID | int | Video capture source instance id. |
Details
Set video capture source for switching between different video capture sources.
- Use cases: Typically used in educational scenarios that require switching between different video capture sources.
- When to call: After the engine is created [createEngine].
- Caution: 1. Act on the main publish channel ZegoPublishChannel.Main.
- Main push channel ZegoPublishChannel.Main does not support using ZegoVideoSourceType.Player and ZegoVideoSourceType.MainPublishChannel video source type. This function is only available in ZegoExpressVideo SDK!
- Available since: 3.1.0
- Restrictions: None.
setVideoSource
public int setVideoSource(ZegoVideoSourceType source, ZegoPublishChannel channel)ZegoExpressEngine.javaParameters
| 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. This function is only available in ZegoExpressVideo SDK!
- Available since: 3.1.0
- Restrictions: None.
setVideoSource
public int setVideoSource(ZegoVideoSourceType source, int instanceID, ZegoPublishChannel channel)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| source | ZegoVideoSourceType | Video capture source. |
| instanceID | int | 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. This function is only available in ZegoExpressVideo SDK!
- Available since: 3.1.0
- Restrictions: None.
setAudioSource
public int setAudioSource(ZegoAudioSourceType source)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| source | ZegoAudioSourceType | Audio capture source. |
Details
Set audio capture source for switching between different audio capture sources.
- Use cases: Typically used in educational scenarios that require switching between different audio capture sources.
- When to call: After the engine is created [createEngine].
- Caution: 1. Act on the main publish channel ZegoPublishChannel.Main.
- Main push channel ZegoPublishChannel.Main does not support using ZegoAudioSourceType.MediaPlayer and ZegoAudioSourceType.MainPublishChannel audio source type.
- Available since: 3.1.0
- Restrictions: None.
setAudioSource
public int setAudioSource(ZegoAudioSourceType source, ZegoPublishChannel channel)ZegoExpressEngine.javaParameters
| 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 int setAudioSource(ZegoAudioSourceType source, ZegoAudioSourceMixConfig config)ZegoExpressEngine.javaParameters
| 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 void startPlayingStream(String streamID)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| streamID | String | Stream ID, a string of up to 256 characters. Caution: Only support numbers, English characters and '-', '_'. |
Details
Play audio and video streams from the ZEGO RTC server.
- Use cases: In the real-time scenario, developers can listen to the [onRoomStreamUpdate] event callback to obtain the new stream information in the room where they are located, and call this interface to pass in streamID for play streams.
- When to call: After [loginRoom].
- Caution: 1. The developer can update the player canvas by calling this function again (the streamID must be the same). 2. After the first play stream failure due to network reasons or the play stream is interrupted, the default time for SDK reconnection is 20min. 3. In the case of poor network quality, user play may be interrupted, the SDK will try to reconnect, and the current play status and error information can be obtained by listening to the [onPlayerStateUpdate] event. please refer to https://docs.zegocloud.com/faq/reconnect. 4. Playing the stream ID that does not exist, the SDK continues to try to play after calling this function. After the stream ID is successfully published, the audio and video stream can be actually played. This function is only available in ZegoExpressVideo SDK!
- Available since: 1.1.0
- Restrictions: None.
startPlayingStream
public void startPlayingStream(String streamID, ZegoPlayerConfig config)ZegoExpressEngine.javaParameters
| 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. This function is only available in ZegoExpressVideo SDK!
- Available since: 1.1.0
- Restrictions: None.
stopPlayingStream
public void stopPlayingStream(String streamID)ZegoExpressEngine.javaParameters
| 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.
setPlayStreamDecryptionKey
public void setPlayStreamDecryptionKey(String streamID, String key)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| streamID | String | Stream ID. |
| key | String | The decryption key, note that the key length only supports 16/24/32 bytes. |
Details
When streaming, the audio and video data will be decrypted according to the set key.
- Use cases: Usually used in scenarios that require high security for audio and video calls.
- When to call: after [createEngine], after the play stream can be changed at any time.
- Related APIs: [setPublishStreamEncryptionKey]Set the publish stream encryption key.
- Caution: This interface can only be called if encryption is set on the publish. Calling [stopPlayingStream] or [logoutRoom] will clear the decryption key.
- Available since: 1.19.0
- Restrictions: This function is only valid when calling from Zego RTC or L3 server.
setPlayStreamCrossAppInfo
public void setPlayStreamCrossAppInfo(String streamID, ZegoCrossAppInfo info)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| streamID | String | Stream ID. |
| info | ZegoCrossAppInfo | Information for cross App playing stream. |
Details
This information is used for authentication before playing a stream or when retrying playing a stream.
- Use cases: Used in scenarios that playing streams across apps.
- When to call: after [createEngine], after the play stream can be changed at any time.
- Caution: Calling [stopPlayingStream] or [logoutRoom] will clear this information.
- Available since: 2.19.0
- Restrictions: This function is only valid when playing stream from Zego RTC server.
setPlayVolume
public void setPlayVolume(String streamID, int volume)ZegoExpressEngine.javaParameters
| 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: None.
setAllPlayStreamVolume
public void setAllPlayStreamVolume(int volume)ZegoExpressEngine.javaParameters
| 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: None.
setPlayStreamVideoType
public void setPlayStreamVideoType(String streamID, ZegoVideoStreamType streamType)ZegoExpressEngine.javaParameters
| 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: None. This function is only available in ZegoExpressVideo SDK!
setPlayStreamBufferIntervalRange
public void setPlayStreamBufferIntervalRange(String streamID, int minBufferInterval, int maxBufferInterval)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| streamID | String | Stream ID. |
| minBufferInterval | int | The lower limit of the buffer adaptation interval, in milliseconds. The default value is 0ms. |
| maxBufferInterval | int | 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], if it has been set, you need to reset it every time you play the stream again.
- Caution: When the upper limit of the cache interval set by the developer exceeds 4000ms, the value will be 4000ms. When the upper limit of the cache interval set by the developer is less than the lower limit of the cache interval, the upper limit will be automatically set as the lower limit.
- Available since: 2.1.0
- Restrictions: None.
setPlayStreamFocusOn
public void setPlayStreamFocusOn(String streamID)ZegoExpressEngine.javaParameters
| 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 audio and video stream in business(do not use in pure audio case). For example: in class scene, if students pull multiple streams, you can set high priority for teacher stream.
- When to call: after called [startPlayingStream].
- Caution: By default, all streams have the same weight. Only one stream can be set with high priority, whichever is set last. After the flow is stopped, the initial state is automatically restored, and all flows have the same weight.When the local network is not good, while ensuring the focus flow, other stalls may be caused more.
- Available since: 1.1.0
- Restrictions: None.
mutePlayStreamAudio
public void mutePlayStreamAudio(String streamID, boolean mute)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| streamID | String | Stream ID. |
| mute | boolean | 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 void mutePlayStreamVideo(String streamID, boolean mute)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| streamID | String | Stream ID. |
| mute | boolean | 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. This function is only available in ZegoExpressVideo SDK!
- Available since: 1.1.0
muteAllPlayStreamAudio
public void muteAllPlayStreamAudio(boolean mute)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| mute | boolean | 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 [muteAllPlayAudioStreams] throughout the SDK lifecycle.
- Related APIs: You can call the [mutePlayStreamAudio] function to control whether to receive a single piece of audio data. When the two functions [muteAllPlayStreamAudio] and [mutePlayStreamAudio] are set to
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
muteAllPlayStreamVideo
public void muteAllPlayStreamVideo(boolean mute)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| mute | boolean | 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 [muteAllPlayVideoStreams] 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. 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. This function is only available in ZegoExpressVideo SDK!
- Available since: 2.4.0
enableHardwareDecoder
public void enableHardwareDecoder(boolean enable)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| enable | boolean | 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: None.
isVideoDecoderSupported
public boolean isVideoDecoderSupported(ZegoVideoCodecID codecID)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| codecID | ZegoVideoCodecID | Video codec id.Required: Yes. |
Details
Whether the specified video decoding is supported depends on the following aspects: whether the hardware model supports hard decoding, whether the performance of the hardware model supports soft decoding, and whether the SDK includes the decoding module.
- When to call: After creating the engine.
- Caution: It is recommended that users call this interface to obtain the H.265 decoding support capability before pulling the H.265 stream. If it is not supported, the user can pull the stream of other encoding formats, such as H.264.
- Available since: 2.12.0
Return
Whether the specified video decoding format is supported; true means supported, you can use this decoding format for playing stream; false means not supported, the SDK does not recommend users to play streams of this encoding format. If users force the play, low frame rates may occur.
isVideoDecoderSupported
public int isVideoDecoderSupported(ZegoVideoCodecID codecID, ZegoVideoCodecBackend codecBackend)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| codecID | ZegoVideoCodecID | Video codec id. Required: Yes. |
| codecBackend | ZegoVideoCodecBackend | Backend implementation of decoder. Required: Yes. |
Details
Whether the specified video decoding is supported depends on the following aspects: whether the hardware model supports hard decoding, whether the performance of the hardware model supports soft decoding, and whether the SDK includes the decoding module.
- When to call: After creating the engine.
- Caution: It is recommended that users call this interface to obtain the H.265 decoding support capability before pulling the H.265 stream. If it is not supported, the user can pull the stream of other encoding formats, such as H.264.
- Available since: 3.0.0
Return
Whether the specified video decoding format is supported; 0 means not supported, and the decoding format cannot be used for play stream; 1 means support, you can use this decoding format for playing stream; 2 means not confirmed, it is recommended to call this interface later.
setPlayStreamsAlignmentProperty
public void setPlayStreamsAlignmentProperty(ZegoStreamAlignmentMode mode)ZegoExpressEngine.javaParameters
| 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
startMixerTask
public void startMixerTask(ZegoMixerTask task, IZegoMixerStartCallback callback)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| task | ZegoMixerTask | Mixing task object. Required: Yes. |
| callback | IZegoMixerStartCallback | 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: None.
stopMixerTask
public void stopMixerTask(ZegoMixerTask task, IZegoMixerStopCallback callback)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| task | ZegoMixerTask | Mixing task object. Required: Yes. |
| callback | IZegoMixerStopCallback | 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: None.
startAutoMixerTask
public void startAutoMixerTask(ZegoAutoMixerTask task, IZegoMixerStartCallback callback)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| task | ZegoAutoMixerTask | Auto mix stream task object |
| callback | IZegoMixerStartCallback | 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.
stopAutoMixerTask
public void stopAutoMixerTask(ZegoAutoMixerTask task, IZegoMixerStopCallback callback)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| task | ZegoAutoMixerTask | Auto mix stream task object |
| callback | IZegoMixerStopCallback | 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
muteMicrophone
public void muteMicrophone(boolean mute)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| mute | boolean | 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 boolean isMicrophoneMuted()ZegoExpressEngine.javaUsed 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 void muteSpeaker(boolean mute)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| mute | boolean | 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: None.
isSpeakerMuted
public boolean isSpeakerMuted()ZegoExpressEngine.javaUsed to determine whether the audio output is muted.
- When to call: After creating the engine [createEngine].
- Related APIs: [muteSpeaker].
- Available since: 1.1.0
- Restrictions: None.
Whether the speaker is muted; true: the speaker is muted; false: the speaker is enable (not muted).
getAudioDeviceList
public ArrayList<ZegoDeviceInfo> getAudioDeviceList(ZegoAudioDeviceType deviceType)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| deviceType | ZegoAudioDeviceType | Audio device type |
Details
Only for Windows / macOS / Linux
Return
Audo device List
getDefaultAudioDeviceID
public String getDefaultAudioDeviceID(ZegoAudioDeviceType deviceType)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| deviceType | ZegoAudioDeviceType | Audio device type |
Details
Only for Windows / macOS / Linux
Return
Default Audio device ID
useAudioDevice
public void useAudioDevice(String deviceID, ZegoAudioDeviceType deviceType)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| deviceID | String | The device ID is obtained through the system API [AudioManager.getDevices], if you want to restore the default device, set this value to an empty string. |
| deviceType | ZegoAudioDeviceType | Audio device type |
Details
Chooses to use the specified audio device.
- When to call: After creating the engine [createEngine] and before call [startPublishingStream] or [startPlayingStream].
- Caution: This interface is not open by default, if you need this feature, please contact technical support.
- Available since: 2.16.0
- Restrictions: This interface is only valid on systems with APIs greater than or equal to 23.
getAudioDeviceVolume
public int getAudioDeviceVolume(ZegoAudioDeviceType deviceType, String deviceID)ZegoExpressEngine.javaParameters
| 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
Return
Device volume
setAudioDeviceVolume
public void setAudioDeviceVolume(ZegoAudioDeviceType deviceType, String deviceID, int volume)ZegoExpressEngine.javaParameters
| 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
enableAudioCaptureDevice
public void enableAudioCaptureDevice(boolean enable)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| enable | boolean | 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, by default, mute data will be used as audio data for streaming. not support Linux.
- Use cases: When the user never needs to use the audio, you can call this function to close the audio collection.
- Default value: The default is
true. - When to call: After creating the engine [createEngine].
- Related APIs: Turning off or turning on the microphone on the hardware is a time-consuming operation, and there is a certain performance overhead when the user performs frequent operations. [muteMicrophone] is generally recommended.
- Available since: 1.1.0
- Restrictions: None.
enableCamera
public void enableCamera(boolean enable)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| enable | boolean | Whether to turn on the camera, true: turn on camera, false: turn off camera |
Details
This function is used to control whether to start the capture of the camera. After the camera is turned off, the video capture will not be performed. At this time, there will be no video data for local preview and push streaming.
- Default value: The default is
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. This function is only available in ZegoExpressVideo SDK!
- Available since: 1.1.0
- Restrictions: None.
enableCamera
public void enableCamera(boolean enable, ZegoPublishChannel channel)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| enable | boolean | 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. This function is only available in ZegoExpressVideo SDK!
- Available since: 1.1.0
- Restrictions: None.
useVideoDevice
public void useVideoDevice(String deviceID, int channel)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| deviceID | String | ID of a device obtained by [getVideoDeviceList] |
| channel | int | Publishing stream channel |
Details
Only for Windows / macOS / Linux This function is only available in ZegoExpressVideo SDK!
getVideoDeviceList
public ArrayList<ZegoDeviceInfo> getVideoDeviceList()ZegoExpressEngine.javaOnly for Windows / macOS / Linux This function is only available in ZegoExpressVideo SDK!
Video device List
getDefaultVideoDeviceID
public String getDefaultVideoDeviceID()ZegoExpressEngine.javaOnly for Windows / macOS / Linux This function is only available in ZegoExpressVideo SDK!
Default video device ID
startSoundLevelMonitor
public void startSoundLevelMonitor()ZegoExpressEngine.javaAfter starting monitoring, you can receive local audio sound level via [onCapturedSoundLevelUpdate] callback, and receive remote audio sound level via [onRemoteSoundLevelUpdate] callback. Before entering the room, you can call [startPreview] with this function and combine it with [onCapturedSoundLevelUpdate] callback to determine whether the audio device is working properly.
- Use cases: During the publishing and playing process, determine who is talking on the wheat and do a UI presentation, in the host K song scene, has been published or played under the premise that the host or audience to see the tone and volume change animation.
- When to call: After the engine is created [createEngine].
- Caution: 1. [onCapturedSoundLevelUpdate] and [onRemoteSoundLevelUpdate] callback notification period is 100 ms. 2. After the sound monitoring is started, even if the local audio capture is not started, [onCapturedSoundLevelUpdate] will have a callback, and the sound level is 0.
- Available since: 1.1.0
startSoundLevelMonitor
public void startSoundLevelMonitor(int millisecond)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| millisecond | int | 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
startSoundLevelMonitor
public void startSoundLevelMonitor(ZegoSoundLevelConfig config)ZegoExpressEngine.javaParameters
| 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
stopSoundLevelMonitor
public void stopSoundLevelMonitor()ZegoExpressEngine.javaAfter the monitoring is stopped, the callback of the local/remote audio sound level will be stopped.
- When to call: After the engine is created [createEngine].
- Related APIs: Soundwave monitoring can be initiated via [startSoundLevelMonitor].
- Available since: 1.1.0
startAudioSpectrumMonitor
public void startAudioSpectrumMonitor(int millisecond)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| millisecond | int | 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
stopAudioSpectrumMonitor
public void stopAudioSpectrumMonitor()ZegoExpressEngine.javaAfter the monitoring is stopped, the callback of the local/remote audio spectrum will be stopped.
- When to call: After the engine is created [createEngine].
- Related APIs: Audio spectrum monitoring can be initiated via [startAudioSpectrumMonitor].
- Available since: 1.1.0
enableHeadphoneMonitor
public void enableHeadphoneMonitor(boolean enable)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| enable | boolean | 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
setHeadphoneMonitorVolume
public void setHeadphoneMonitorVolume(int volume)ZegoExpressEngine.javaParameters
| 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
startAudioVADStableStateMonitor
public void startAudioVADStableStateMonitor(ZegoAudioVADStableStateMonitorType type)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| type | ZegoAudioVADStableStateMonitorType | audio VAD monitor type. |
Details
After monitoring is started, you can use the [onAudioVADStateUpdate] callback to receive the specified type of audio VAD callback.
- Use cases: For example, when you specify the type of collection and use the microphone to collect, you can check whether the host has continuous and stable voice input through this interface.
- When to call: Before publish stream, you can call [startPreview] with this function and combine it with [onAudioVADStateUpdate] callback to determine whether the audio device is working properly.
- Related APIs: [stopAudioVADStableStateMonitor].
- Restrictions: [onAudioVADStateUpdate] callback notification period is 3 seconds.
startAudioVADStableStateMonitor
public void startAudioVADStableStateMonitor(ZegoAudioVADStableStateMonitorType type, int millisecond)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| type | ZegoAudioVADStableStateMonitorType | audio VAD monitor type. |
| millisecond | int | monitoring period default 3000. value of [200, 10000] |
Details
After monitoring is started, you can use the [onAudioVADStateUpdate] callback to receive the specified type of audio VAD callback.
- Use cases: For example, when you specify the type of collection and use the microphone to collect, you can check whether the host has continuous and stable voice input through this interface.
- When to call: Before publish stream, you can call [startPreview] with this function and combine it with [onAudioVADStateUpdate] callback to determine whether the audio device is working properly.
- Related APIs: [stopAudioVADStableStateMonitor].
- Restrictions: None.
stopAudioVADStableStateMonitor
public void stopAudioVADStableStateMonitor(ZegoAudioVADStableStateMonitorType type)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| type | ZegoAudioVADStableStateMonitorType | audio VAD monitor type. |
Details
After calling this interface, the specified type of [onAudioVADStateUpdate] callback can no longer be received.
- When to call: None.
- Related APIs: [startAudioVADStableStateMonitor].
- Available since: 2.14.0
- Restrictions: None.
enableAEC
public void enableAEC(boolean enable)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| enable | boolean | 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: None.
setAECMode
public void setAECMode(ZegoAECMode mode)ZegoExpressEngine.javaParameters
| 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.
enableAGC
public void enableAGC(boolean enable)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| enable | boolean | 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].
- Caution: Before this function is called, the SDK automatically determines whether to use AGC. Once this function is called, the SDK does not automatically determine whether to use AGC.
- Available since: 1.1.0
- Restrictions: None.
enableANS
public void enableANS(boolean enable)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| enable | boolean | 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: None.
enableTransientANS
public void enableTransientANS(boolean enable)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| enable | boolean | 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: None.
setANSMode
public void setANSMode(ZegoANSMode mode)ZegoExpressEngine.javaParameters
| 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 automatic noise suppression (ANS) mode is [Medium].
- When to call: It needs to be called after [createEngine].
- Available since: 1.1.0
- Restrictions: The value set by this function is valid only after the noise suppression function is turned on.
enableSpeechEnhance
public void enableSpeechEnhance(boolean enable, int level)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| enable | boolean | Whether to enable speech enhancement, true: enable, false: disable |
| level | int | Enhancement level; The value range is [0, 10] |
Details
Enable the speech enhancement function. Use case: In the KTV external playback scene, due to 3A damage and distance, the voice is weak or empty or unclear, so it is necessary to enhance the external playback experience through the voice enhancement technology.
- Default value: When this function is not called, this is disabled by default.
- When to call: It needs to be called after [createEngine] and it Supports dynamic change.
- Caution: 1. If this interface is called repeatedly, the settings of the last call are used;
- After call [DestroyEngine], the Settings fail.
- Available since: 3.3.0.
- Restrictions: None.
setAudioEqualizerGain
public void setAudioEqualizerGain(int bandIndex, float bandGain)ZegoExpressEngine.javaParameters
| 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 should be called after the engine has started.
- Available since: 1.12.0
- Restrictions: None.
setVoiceChangerPreset
public void setVoiceChangerPreset(ZegoVoiceChangerPreset preset)ZegoExpressEngine.javaParameters
| 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
setVoiceChangerParam
public void setVoiceChangerParam(ZegoVoiceChangerParam param)ZegoExpressEngine.javaParameters
| 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
setReverbPreset
public void setReverbPreset(ZegoReverbPreset preset)ZegoExpressEngine.javaParameters
| 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
setReverbAdvancedParam
public void setReverbAdvancedParam(ZegoReverbAdvancedParam param)ZegoExpressEngine.javaParameters
| 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
setReverbEchoParam
public void setReverbEchoParam(ZegoReverbEchoParam param)ZegoExpressEngine.javaParameters
| 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
enableVirtualStereo
public void enableVirtualStereo(boolean enable, int angle)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| enable | boolean | 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.
enablePlayStreamVirtualStereo
public void enablePlayStreamVirtualStereo(boolean enable, int angle, String streamID)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| enable | boolean | 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
setElectronicEffects
public void setElectronicEffects(boolean enable, ZegoElectronicEffectsMode mode, int tonal)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| enable | boolean | 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: None.
createRealTimeSequentialDataManager
public ZegoRealTimeSequentialDataManager createRealTimeSequentialDataManager(String roomID)ZegoExpressEngine.javaParameters
| 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.
Return
The real-time sequential data manager instance, null will be returned when the maximum number is exceeded.
destroyRealTimeSequentialDataManager
public void destroyRealTimeSequentialDataManager(ZegoRealTimeSequentialDataManager manager)ZegoExpressEngine.javaParameters
| 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.
sendBroadcastMessage
public void sendBroadcastMessage(String roomID, String message, IZegoIMSendBroadcastMessageCallback callback)ZegoExpressEngine.javaParameters
| 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 '%'. |
| message | String | The content of the message. Required: Yes. Value range: The length does not exceed 1024 bytes. |
| callback | IZegoIMSendBroadcastMessageCallback | Send a notification of the result of a broadcast message. Required: No. Caution: Passing [null] means not receiving callback notifications. |
Details
Send a broadcast message to the room, users who have entered the same room can receive the message, and the message is reliable.
- Use cases: Generally used in the live room.
- When to call: After calling [loginRoom] to log in to the room.
- Related callbacks: The room broadcast message can be received through [onIMRecvBroadcastMessage].
- Related APIs: Barrage messages can be sent through the [sendBarrageMessage] function, and custom command can be sent through the [sendCustomCommand] function.
- Available since: 1.2.1
- Restrictions: The frequency of sending broadcast messages in the same room cannot be higher than 10 messages/s. The maximum QPS for a single user to call this interface within a single room is 2. For restrictions on the use of this function, please contact ZEGO technical support.
sendBarrageMessage
public void sendBarrageMessage(String roomID, String message, IZegoIMSendBarrageMessageCallback callback)ZegoExpressEngine.javaParameters
| 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 '%'. |
| message | String | The content of the message. Required: Yes. Value range: The length does not exceed 1024 bytes. |
| callback | IZegoIMSendBarrageMessageCallback | Send barrage message result callback.Required: No. Caution: Passing [null] means not receiving callback notifications. |
Details
Send a barrage message to the room, users who have logged in to the same room can receive the message, the message is unreliable.
- Use cases: Generally used in scenarios where there is a large number of messages sent and received in the room and the reliability of the messages is not required, such as live barrage.
- When to call: After calling [loginRoom] to log in to the room.
- Related callbacks: The room barrage message can be received through [onIMRecvBarrageMessage].
- Related APIs: Broadcast messages can be sent through the [sendBroadcastMessage] function, and custom command can be sent through the [sendCustomCommand] function.
- Available since: 1.5.0
- Restrictions: The frequency of sending barrage messages in the same room cannot be higher than 20 messages/s. For restrictions on the use of this function, please contact ZEGO technical support.
sendCustomCommand
public void sendCustomCommand(String roomID, String command, ArrayList<ZegoUser> toUserList, IZegoIMSendCustomCommandCallback callback)ZegoExpressEngine.javaParameters
| 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. |
| toUserList | ArrayList<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 |
| callback | IZegoIMSendCustomCommandCallback | Send a notification of the signaling result. Required: No. Caution: Passing [null] means not receiving callback notifications. |
Details
Send point-to-point signaling to other users who have logged into the same room, and the message is reliable.
- Use cases: Generally used for remote control signaling or message sending between users.
- When to call: After calling [loginRoom] to log in to the room.
- Related callbacks: The room custom command can be received through [onIMRecvCustomCommand].
- Related APIs: Broadcast messages can be sent through the [sendBroadcastMessage] function, and barrage messages can be sent through the [sendBarrageMessage] function.
- Privacy reminder: Please do not fill in sensitive user information in this interface, including but not limited to mobile phone number, ID number, passport number, real name, etc.
- Available since: 1.2.1
- Restrictions: The frequency of sending barrage messages in the same room cannot be higher than 20 messages/s. For restrictions on the use of this function, please contact ZEGO technical support.
sendTransparentMessage
public void sendTransparentMessage(String roomID, ZegoRoomSendTransparentMessage message, IZegoRoomSendTransparentMessageCallback callback)ZegoExpressEngine.javaParameters
| 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 '%'. |
| message | ZegoRoomSendTransparentMessage | ZegoRoomSendTransparentMessage |
| callback | IZegoRoomSendTransparentMessageCallback | Send a notification of the signaling result. Required: No. Caution: Passing [null] means not receiving callback notifications. |
Details
Send point-to-point signaling to other users who have logged into the same room.
- Use cases: Generally used for remote control signaling or message sending between users.
- When to call: After calling [loginRoom] to log in to the room.
- Related callbacks: When sending a message, Mode is specified for ZegoRoomTransparentMessageModeOnlyClient or ZegoRoomTransparentMessageModeClientAndServer can pass [onRecvRoomTransparentMessage] received sends the message content.
- Privacy reminder: Please do not fill in sensitive user information in this interface, including but not limited to mobile phone number, ID number, passport number, real name, etc.
- Available since: 1.2.1
- Restrictions: The frequency of sending barrage messages in the same room cannot be higher than 20 messages/s. For restrictions on the use of this function, please contact ZEGO technical support.
createMediaPlayer
public ZegoMediaPlayer createMediaPlayer()ZegoExpressEngine.javaCreates 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 void destroyMediaPlayer(ZegoMediaPlayer mediaPlayer)ZegoExpressEngine.javaParameters
| 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 ZegoAudioEffectPlayer createAudioEffectPlayer()ZegoExpressEngine.javaCreates 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.
audio effect player instance, null will be returned when the maximum number is exceeded.
destroyAudioEffectPlayer
public void destroyAudioEffectPlayer(ZegoAudioEffectPlayer audioEffectPlayer)ZegoExpressEngine.javaParameters
| 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: None.
createMediaDataPublisher
public ZegoMediaDataPublisher createMediaDataPublisher()ZegoExpressEngine.javaDevelopers can use this interface to create ZegoMediaDataPublisher objects to push local media resource files to implement server-side streaming scenarios, such as AI classrooms.
- Use cases: Often used in server-side publishing stream scenarios, such as AI classrooms.
- When to call: After calling the [createEngine] function to create an engine.
- Caution: It returns the instance object of the main publish channel. It will return the instance object if it already exists. This function is only available in ZegoExpressVideo SDK!
- Available since: 2.17.0
Media data publisher instance.
createMediaDataPublisher
public ZegoMediaDataPublisher createMediaDataPublisher(ZegoMediaDataPublisherConfig config)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| config | ZegoMediaDataPublisherConfig | Config the media data publisher. |
Details
Developers can use this interface to create ZegoMediaDataPublisher objects to push local media resource files to implement server-side streaming scenarios, such as AI classrooms.
- Use cases: Often used in server-side publishing stream scenarios, such as AI classrooms.
- When to call: After calling the [createEngine] function to create an engine.
- Caution: It returns the instance object of the specified publish channel. It will return the instance object if it already exists. This function is only available in ZegoExpressVideo SDK!
- Available since: 3.4.0
Return
Media data publisher instance.
destroyMediaDataPublisher
public void destroyMediaDataPublisher(ZegoMediaDataPublisher mediaDataPublisher)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| mediaDataPublisher | ZegoMediaDataPublisher | The media data publisher instance object to be destroyed |
Details
Destroys a media data publisher instance.
- Use cases: Often used in server-side publishing stream scenarios, such as AI classrooms.
- When to call: After calling the [createEngine] function to create an engine. This function is only available in ZegoExpressVideo SDK!
- Available since: 2.17.0
startRecordingCapturedData
public void startRecordingCapturedData(ZegoDataRecordConfig config, int channel)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| config | ZegoDataRecordConfig | Record config. |
| channel | int | 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: None.
stopRecordingCapturedData
public void stopRecordingCapturedData(int channel)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| channel | int | Publishing stream channel. |
Details
Stops recording locally captured audio or video.
- When to call: After [startRecordingCapturedData].
- Available since: 1.10.0
- Restrictions: None.
setDataRecordEventHandler
public void setDataRecordEventHandler(IZegoDataRecordEventHandler eventHandler)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| eventHandler | IZegoDataRecordEventHandler | Data record event handler. |
Details
Implemente the functions of ZegoDataRecordEventHandler to get notified when recode state and process changed.
- When to call: After [createEngine].
- Available since: 1.10.0
- Restrictions: None.
startPerformanceMonitor
public void startPerformanceMonitor(int millisecond)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| millisecond | int | Monitoring time period(in milliseconds), the value range is [1000, 10000]. Default value is 2000 ms. |
Details
Start system performance monitoring, monitor system or App's CPU usage and memory usage. Support set the monitoring interval.
- Use cases: Monitor system performance can help user quickly locate and solve performance problems and improve user experience.
- When to call: It needs to be called after [createEngine].
- Related callbacks: After starting monitoring, you can receive system performance status via [onPerformanceStatusUpdate] callback. [onPerformanceStatusUpdate] callback notification period is the value set by millisecond parameter.
- Related APIs: Call [stopPerformanceMonitor] to stop system performance monitoring.
- Available since: 1.19.0
- Restrictions: None.
stopPerformanceMonitor
public void stopPerformanceMonitor()ZegoExpressEngine.javaStop system performance monitoring. After the monitoring is stopped, the [onPerformanceStatusUpdate] callback will not triggered.
- Use cases: Monitor system performance can help user quickly locate and solve performance problems and improve user experience.
- When to call: It needs to be called after [createEngine].
- Related APIs: Call [startPerformanceMonitor] to start system performance monitoring.
- Available since: 1.19.0
- Restrictions: None.
startNetworkProbe
public void startNetworkProbe(ZegoNetworkProbeConfig config, IZegoNetworkProbeResultCallback callback)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| config | ZegoNetworkProbeConfig | network probe config. |
| callback | IZegoNetworkProbeResultCallback | Network probe result callback. |
Details
Some local network problems may cause audio and video calls to fail. Using this function to probe the network protocols, assist in locating and solving related network problems.
- Use cases: Before pushing and pulling the stream, detect and locate some possible network problems.
- When to call: It needs to be called after [createEngine].
- Caution: The SDK detects http, tcp, and udp in sequence internally. If the probe fails in the middle, the subsequent detection will not continue. Therefore, when reading the values in the probe result, please pay attention to check if the value is null. Network probe may take a long time. Developers can call [stopNetworkProbe] to stop network probe if needed. It is not recommended to start network probe during publishing/playing stream.
- Related APIs: Call [stopNetworkProbe] to stop network probe.
- Available since: 2.3.0
- Restrictions: The SDK will not perform multiple network probe at the same time, that is, if the network probe is in progress, the SDK will ignore subsequent calls of this function.
stopNetworkProbe
public void stopNetworkProbe()ZegoExpressEngine.javaStop network probe.
- Use cases: Before pushing and pulling the stream, detect and locate some possible network problems.
- When to call: It needs to be called after [createEngine].
- Related APIs: Call [startNetworkProbe] to start network probe.
- Available since: 2.3.0
- Restrictions: None.
testNetworkConnectivity
public void testNetworkConnectivity(IZegoTestNetworkConnectivityCallback callback)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| callback | IZegoTestNetworkConnectivityCallback | Network connectivity test result callback notification. |
Details
Test network connectivity.
startNetworkSpeedTest
public void startNetworkSpeedTest(ZegoNetworkSpeedTestConfig config)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| config | ZegoNetworkSpeedTestConfig | Network speed test configuration. |
Details
This function supports uplink/downlink network speed test when the network can be connected.
- Use cases: This function can be used to detect whether the network environment is suitable for pushing/pulling streams with specified bitrates.
- When to call: It needs to be called after [loginRoom]. If you call [startPublishingStream]/[startPlayingStream] while speed testing, the speed test will automatically stop.
- Caution: Developers can register [onNetworkSpeedTestQualityUpdate] callback to get the speed test result, which will be triggered every 3 seconds. If an error occurs during the speed test process, [onNetworkSpeedTestError] callback will be triggered. If this function is repeatedly called multiple times, the last functioh call's configuration will be used.
- Related APIs: Call [stopNetworkSpeedTest] to stop network speed test.
- Available since: 1.20.0
- Restrictions: The default maximum allowable test time for a single network speed test is 30 seconds.
startNetworkSpeedTest
public void startNetworkSpeedTest(ZegoNetworkSpeedTestConfig config, int interval)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| config | ZegoNetworkSpeedTestConfig | Network speed test configuration. |
| interval | int | Interval of network speed test. In milliseconds, default is 3000 ms. |
Details
This function supports uplink/downlink network speed test when the network can be connected.
- Use cases: This function can be used to detect whether the network environment is suitable for pushing/pulling streams with specified bitrates.
- When to call: It needs to be called after [loginRoom]. If you call [startPublishingStream]/[startPlayingStream] while speed testing, the speed test will automatically stop.
- Caution: Developers can register [onNetworkSpeedTestQualityUpdate] callback to get the speed test result, which will be triggered every 3 seconds. If an error occurs during the speed test process, [onNetworkSpeedTestError] callback will be triggered. If this function is repeatedly called multiple times, the last functioh call's configuration will be used.
- Related APIs: Call [stopNetworkSpeedTest] to stop network speed test.
- Available since: 1.20.0
- Restrictions: The default maximum allowable test time for a single network speed test is 30 seconds.
stopNetworkSpeedTest
public void stopNetworkSpeedTest()ZegoExpressEngine.javaStop network speed test.
- Use cases: This function can be used to detect whether the network environment is suitable for pushing/pulling streams with specified bitrates.
- When to call: It needs to be called after [createEngine].
- Caution: After the network speed test stopped, [onNetworkSpeedTestQualityUpdate] callback will not be triggered.
- Related APIs: Call [startNetworkSpeedTest] to start network speed test.
- Available since: 1.20.0
- Restrictions: None.
getNetworkTimeInfo
public ZegoNetworkTimeInfo getNetworkTimeInfo()ZegoExpressEngine.javaObtain synchronization network time(NTP), including timestamp and maximum deviation.
- Use cases: When performing multi-terminal synchronization behaviors, network time synchronization is required.
- When to call: It needs to be called after [createEngine].
- Available since: 2.9.0
- Restrictions: None.
startDumpData
public void startDumpData(ZegoDumpDataConfig config)ZegoExpressEngine.javaParameters
| 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 void stopDumpData()ZegoExpressEngine.javaStop dumping data.
- Use cases: This is a debugging tool. When there is a problem with audio capturing, 3A processing, or other environment processing during publish, you can dump the audio data and upload it to the ZEGO server for further analysis.
- When to call: It needs to be called after [startDumpData].
- Caution: It will trigger the [onUploadDumpData] callback.
- Available since: 3.10.0
- Restrictions: None.
uploadDumpData
public void uploadDumpData()ZegoExpressEngine.javaUpload dumped data to the ZEGO server.
- Use cases: This is a debugging tool. When there is a problem with audio capturing, 3A processing, or other environment processing during publish, you can dump the audio data and upload it to the ZEGO server for further analysis.
- When to call: It needs to be called after [stopDumpData].
- Caution: It will trigger the [onUploadDumpData] callback when dump data uploaded.
- Available since: 3.10.0
- Restrictions: None.
removeDumpData
public void removeDumpData()ZegoExpressEngine.javaRemove dumped data.
- Use cases: This is a debugging tool. When there is a problem with audio capturing, 3A processing, or other environment processing during publish, you can dump the audio data and upload it to the ZEGO server for further analysis.
- When to call: It needs to be called after [stopDumpData]. If the dump data is to be uploaded to the ZEGO server, it should be deleted after the upload is successful.
- Available since: 3.10.0
- Restrictions: None.
enableCustomVideoRender
public void enableCustomVideoRender(boolean enable, ZegoCustomVideoRenderConfig config)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| enable | boolean | 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. This function is only available in ZegoExpressVideo SDK!
- Available since: 1.9.0
setCustomVideoRenderHandler
public void setCustomVideoRenderHandler(IZegoCustomVideoRenderHandler handler)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| handler | IZegoCustomVideoRenderHandler | Custom video render handler |
Details
Custom video rendering, where the developer is responsible for rendering the video data onto the UI components. With the change callback set, a callback that throws video data to the developer will be triggered when the developer calls startPreview, startPublishingStream, and startPlayingStream. Use case: Use beauty features or apps that use a cross-platform UI framework (for example, Qt requires a complex hierarchical UI to achieve high-experience interaction) or game engine (e.g. Unity, Unreal Engine, Cocos)
- When to call: After [createEngine].
- Related callbacks: [onCapturedVideoFrameRawData] local preview video frame data callback, [onRemoteVideoFrameRawData] remote playing stream video frame data callback. This function is only available in ZegoExpressVideo SDK!
- Available since: 1.9.0
enableCapturedVideoCustomVideoRender
public void enableCapturedVideoCustomVideoRender(boolean enable, ZegoPublishChannel channel)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| enable | boolean | enable or disable |
| channel | ZegoPublishChannel | publish channel |
Details
enable or disable custom video rendering of captured video during publish. Use case: Use beauty features or apps that use a cross-platform UI framework (for example, Qt requires a complex hierarchical UI to achieve high-experience interaction) or game engine (e.g. Unity, Unreal Engine, Cocos)
- Default value: After [enableCustomVideoRender] enables custom video rendering, all captured videos will be used as custom video data.
- When to call: After [enableCustomVideoRender] enables custom video rendering, call [enableCapturedVideoCustomVideoRender] to config whether the specified channel used custom video render or not.
- Caution: You can call this API only after [enableCustomVideoRender] enables custom video rendering.Custom video rendering can be used in conjunction with custom video capture, but when both are enabled, the local capture frame callback for custom video rendering will no longer be called back, you should directly use the captured video frame from the custom video capture source.
- Related callbacks: Call [setCustomVideoRenderHandler] to set the callback to get video frame data. [onCapturedVideoFrameRawData] local preview video frame data callback, [onRemoteVideoFrameRawData] remote playing stream video frame data callback. This function is only available in ZegoExpressVideo SDK!
- Available since: 3.13.0
enableRemoteVideoCustomVideoRender
public void enableRemoteVideoCustomVideoRender(boolean enable, String streamID)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| enable | boolean | enable or disable |
| streamID | String | Stream ID. |
Details
enable or disable custom video rendering during playback. Use case: Use beauty features or apps that use a cross-platform UI framework (for example, Qt requires a complex hierarchical UI to achieve high-experience interaction) or game engine (e.g. Unity, Unreal Engine, Cocos)
- Default value: After [enableCustomVideoRender] enables custom video rendering, all remote playback videos will be used as custom video data.
- When to call: After [enableCustomVideoRender] enables custom video rendering, call [enableRemoteVideoCustomVideoRender] to config whether the specified stream used custom video render or not.
- Caution: You can call this API only after [enableCustomVideoRender] enables custom video rendering.
- Related callbacks: Call [setCustomVideoRenderHandler] to set the callback to get video frame data. [onCapturedVideoFrameRawData] local preview video frame data callback, [onRemoteVideoFrameRawData] remote playing stream video frame data callback. This function is only available in ZegoExpressVideo SDK!
- Available since: 3.13.0
enableCustomVideoCapture
public void enableCustomVideoCapture(boolean enable, ZegoCustomVideoCaptureConfig config)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| enable | boolean | enable or disable |
| config | ZegoCustomVideoCaptureConfig | custom video capture config |
Details
If the value of enable is true, the video collection function is enabled. If the value of enable is false, the video collection function is disabled. Use case: The App developed by the developer uses the beauty SDK of a third-party beauty manufacturer to broadcast non-camera collected data.
- Default value: When this function is not called, custom video collection is disabled by default.
- When to call: After [createEngine], call [startPreview], [startPublishingStream], [createRealTimeSequentialDataManager], and call [logoutRoom] to modify the configuration.
- Caution: Custom video rendering can be used in conjunction with custom video capture, but when both are enabled, the local capture frame callback for custom video rendering will no longer be triggered, and the developer should directly capture the captured video frame from the custom video capture source.
- Related callbacks: When developers to open a custom collection, by calling [setCustomVideoCaptureHandler] can be set up to receive a custom collection start-stop event notification. This function is only available in ZegoExpressVideo SDK!
- Available since: 1.9.0
enableCustomVideoCapture
public void enableCustomVideoCapture(boolean enable, ZegoCustomVideoCaptureConfig config, int channel)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| enable | boolean | enable or disable |
| config | ZegoCustomVideoCaptureConfig | custom video capture config |
| channel | int | 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. This function is only available in ZegoExpressVideo SDK!
- Available since: 1.9.0
setCustomVideoCaptureHandler
public void setCustomVideoCaptureHandler(IZegoCustomVideoCaptureHandler handler)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| handler | IZegoCustomVideoCaptureHandler | Custom video capture handler |
Details
Example Set the callback for custom video capture. That is, the developer is responsible for collecting video data, and sends the collected video data to the SDK for coding and pushing the video data to the ZEGO RTC server. Use case: This feature is typically used by developers using third-party beauty features or livestreaming of games.
- When to call: After [createEngine] .
- Caution: In the case of customized video collection, the SDK will not start the camera to collect video data, and developers need to collect video data from the video collection source. A callback notifying the developer that it can start sending video data is triggered when the developer calls [startPreview] to start pushing the stream to [startPublishingStream]. A callback notifying the developer that it can stop sending video data is triggered when [stopPreview] and [stopPublishingStream].
- Related callbacks: [onStart] Starts collection, and [onStop] stops collection. This function is only available in ZegoExpressVideo SDK!
- Available since: 1.9.0
sendCustomVideoCaptureRawData
public void sendCustomVideoCaptureRawData(ByteBuffer data, int dataLength, ZegoVideoFrameParam params, long referenceTimeMillisecond)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| data | ByteBuffer | video frame data |
| dataLength | int | video frame data length |
| params | ZegoVideoFrameParam | video frame param |
| referenceTimeMillisecond | long | video frame reference time, UNIX timestamp, in milliseconds. |
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]. This function is only available in ZegoExpressVideo SDK!
- Available since: 1.9.0
sendCustomVideoCaptureRawData
public void sendCustomVideoCaptureRawData(ByteBuffer data, int dataLength, ZegoVideoFrameParam params, long referenceTimeMillisecond, int channel)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| data | ByteBuffer | video frame data |
| dataLength | int | video frame data length |
| params | ZegoVideoFrameParam | video frame param |
| referenceTimeMillisecond | long | video frame reference time, UNIX timestamp, in milliseconds. |
| channel | int | 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]. This function is only available in ZegoExpressVideo SDK!
- Available since: 1.9.0
sendCustomVideoCaptureEncodedData
public void sendCustomVideoCaptureEncodedData(ByteBuffer data, int dataLength, ZegoVideoEncodedFrameParam params, long referenceTimeMillisecond, ZegoPublishChannel channel)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| data | ByteBuffer | video frame encoded data |
| dataLength | int | video frame data length |
| params | ZegoVideoEncodedFrameParam | video frame param |
| referenceTimeMillisecond | long | video frame reference time, UNIX timestamp, in milliseconds. |
| channel | ZegoPublishChannel | Publishing stream channel |
Details
Send custom captured video frame type CVPixelBuffer data to the SDK.
- When to call: After receiving the [onStart] notification, the developer starts the call after the collection logic starts and ends the call after the [onStop] notification.
- Caution: It is recommended to make a GOP every 2s; each I frame must carry SPS and PPS which should be placed at the front of the data; the SPS, PPS and I frame need to be combined into one frame for transmission. Before calling this API, you need to ensure that the parameter type specified when calling [enableCustomVideoCapture] is [EncodedData]
- Related APIs: [enableCustomVideoCapture], [setCustomVideoCaptureHandler]. This function is only available in ZegoExpressVideo SDK!
- Available since: 1.9.0
setCustomVideoCaptureFillMode
public void setCustomVideoCaptureFillMode(ZegoViewMode mode)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| mode | ZegoViewMode | View mode |
Details
When the custom video collection function is enabled, you can use this interface to set the video zooming and filling mode.
- Use cases: If the customized collection resolution and SDK coding resolution are inconsistent, THE SDK will process the video frame according to the fill mode and adjust it to the coding resolution.
- When to call: Before [sendCustomVideoCaptureRawData], [sendCustomVideoCaptureTextureData], [sendCustomVideoCapturePixelBuffer], [sendCustomVideoCaptureEncodedData]. This function is only available in ZegoExpressVideo SDK!
- Available since: 1.10.0
setCustomVideoCaptureFillMode
public void setCustomVideoCaptureFillMode(ZegoViewMode mode, int channel)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| mode | ZegoViewMode | View mode |
| channel | int | Publishing stream channel |
Details
When the custom video collection function is enabled, you can use this interface to set the video zooming and filling mode.
- Use cases: If the customized collection resolution and SDK coding resolution are inconsistent, THE SDK will process the video frame according to the fill mode and adjust it to the coding resolution.
- When to call: Before [sendCustomVideoCaptureRawData], [sendCustomVideoCaptureTextureData], [sendCustomVideoCapturePixelBuffer], [sendCustomVideoCaptureEncodedData]. This function is only available in ZegoExpressVideo SDK!
- Available since: 1.10.0
setCustomVideoCaptureDeviceState
public void setCustomVideoCaptureDeviceState(boolean isEnable, ZegoRemoteDeviceState state, int channel)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| isEnable | boolean | Whether the device is enable. |
| state | ZegoRemoteDeviceState | The device state. |
| channel | int | Publishing stream channel |
Details
User can set the video device state of custom video capture (for the specified channel) through this function.
- When to call: After the callback [onStart] is received.
- Available since: 2.15.0.
- Restrictions: None. Related Callbacks: The remote user that play stream of local user publishing stream can receive state update notification by monitoring [onRemoteCameraStateUpdate] callbacks. This function is only available in ZegoExpressVideo SDK!
setCustomVideoCaptureTransformMatrix
public void setCustomVideoCaptureTransformMatrix(float[] matrix, int channel)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| matrix | float[] | 4x4 transformation matrix. |
| channel | int | Publishing stream channel. |
Details
You can set the video transform matrix of custom video capture (for the specified channel) through this function. The transformation matrix can include rotation, flipping, and scaling. It is recommended for developers with some OpenGL development experience.
- When to call: After the callback [onStart] is received.
- References: Please refer to the documentation https://docs.zegocloud.com/article/4054 for details.
- Related APIs: [setCustomVideoCaptureRotation].
- Caution: When both the interfaces [setCustomVideoCaptureTransformMatrix] and [setCustomVideoCaptureRotation] are called, the first step is to execute the [setCustomVideoCaptureTransformMatrix] before the [setCustomVideoCaptureRotation]. This function is only available in ZegoExpressVideo SDK!
- Available since: 2.14.0.
- Restrictions: This function takes effect only when the custom acquisition type is Texture2D.
setCustomVideoCaptureRegionOfInterest
public void setCustomVideoCaptureRegionOfInterest(ArrayList<ZegoRoiRect> rectList, int channel)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| rectList | ArrayList<ZegoRoiRect> | ROI rectangle area list, currently supports up to 6 areas. |
| channel | int | Publish channel |
Details
You can set the video encoder's region of interest rectangle areas of custom video capture (for the specified channel) through this function.
- When to call: After the callback [onStart] is received.
- Caution: This function is currently an experimental feature, please contact ZEGO technical support before using it. This function is only available in ZegoExpressVideo SDK!
- Available since: 2.16.0.
- Restrictions: Currently, only certain video encoders support this function, please contact ZEGO technical support before using it.
enableCustomAudioCaptureProcessing
public void enableCustomAudioCaptureProcessing(boolean enable, ZegoCustomAudioProcessConfig config)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| enable | boolean | Whether to enable local capture custom audio processing. |
| config | ZegoCustomAudioProcessConfig | Custom audio processing configuration. |
Details
Enable custom audio processing(before ear return), developers can receive locally collected audio frames through [onProcessCapturedAudioData], and can modify the audio data.
- Use cases: If the developer wants to implement special functions (such as voice change, bel canto, etc.) through custom processing after the audio data is collected or before the remote audio data is drawn for rendering.
- When to call: It needs to be called before [startPublishingStream], [startPlayingStream], [startPreview], [createMediaPlayer], [createAudioEffectPlayer] and [createRealTimeSequentialDataManager] to be effective.
- Available since: 1.13.0
- Restrictions: None.
enableCustomAudioCaptureProcessingAfterHeadphoneMonitor
public void enableCustomAudioCaptureProcessingAfterHeadphoneMonitor(boolean enable, ZegoCustomAudioProcessConfig config)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| enable | boolean | Whether to enable local capture custom audio processing. |
| config | ZegoCustomAudioProcessConfig | Custom audio processing configuration. |
Details
Enable custom audio processing(after ear return), developers can receive locally collected audio frames through [onProcessCapturedAudioData], and can modify the audio data.
- Use cases: If the developer wants to implement special functions (such as voice change, bel canto, etc.) through custom processing after the audio data is collected or before the remote audio data is drawn for rendering.
- When to call: It needs to be called before [startPublishingStream], [startPlayingStream], [startPreview], [createMediaPlayer], [createAudioEffectPlayer] and [createRealTimeSequentialDataManager] to be effective.
- Available since: 1.13.0
- Restrictions: None.
enableCustomAudioRemoteProcessing
public void enableCustomAudioRemoteProcessing(boolean enable, ZegoCustomAudioProcessConfig config)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| enable | boolean | Whether to enable custom audio processing for remote playing stream. |
| config | ZegoCustomAudioProcessConfig | Custom audio processing configuration. |
Details
Enable remote streaming custom audio processing, developers can receive remote streaming audio frames through [onProcessRemoteAudioData], and can modify the audio data.
- Use cases: If the developer wants to implement special functions (such as voice change, bel canto, etc.) through custom processing before pulling the remote audio data for rendering.
- When to call: It needs to be called before [startPublishingStream], [startPlayingStream], [startPreview], [createMediaPlayer], [createAudioEffectPlayer] and [createRealTimeSequentialDataManager] to be effective.
- Available since: 1.13.0
- Restrictions: None.
enableCustomAudioPlaybackProcessing
public void enableCustomAudioPlaybackProcessing(boolean enable, ZegoCustomAudioProcessConfig config)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| enable | boolean | Whether to enable custom audio processing for SDK playback audio data. |
| config | ZegoCustomAudioProcessConfig | Custom audio processing configuration. |
Details
Enable remote streaming custom audio processing, developers can receive remote streaming audio frames through [onProcessPlaybackAudioData], and can modify the audio data.
- Use cases: If the developer wants to implement special functions (such as voice change, bel canto, etc.) through custom processing after collecting audio data.
- When to call: It needs to be called before [startPublishingStream], [startPlayingStream], [startPreview], [createMediaPlayer], [createAudioEffectPlayer] and [createRealTimeSequentialDataManager] to be effective.
- Available since: 1.13.0
- Restrictions: None.
setCustomAudioProcessHandler
public void setCustomAudioProcessHandler(IZegoCustomAudioProcessHandler handler)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| handler | IZegoCustomAudioProcessHandler | Callback handler for custom audio processing. |
Details
When the custom audio processing is enabled, the custom audio processing callback is set through this function, and the developer can modify the processed audio frame data in the callback.
- Use cases: If the developer wants to implement special functions (such as voice change, bel canto, etc.) through custom processing after the audio data is collected or before the remote audio data is drawn for rendering.
- When to call: After creating the engine.
- Available since: 1.13.0
- Restrictions: None.
startAudioDataObserver
public void startAudioDataObserver(int observerBitMask, ZegoAudioFrameParam param)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| observerBitMask | int | 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.
stopAudioDataObserver
public void stopAudioDataObserver()ZegoExpressEngine.javaDisable audio data observering.
- Use cases: When develop need to monitor the original audio.
- When to call: After calling [startAudioDataObserver] to start audio data monitoring.
- Available since: 1.1.0
setAudioDataHandler
public void setAudioDataHandler(IZegoAudioDataHandler handler)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| handler | IZegoAudioDataHandler | Audio data handler for receive audio data. |
Details
This function can be called to receive audio data thrown by SDK bypass.
- Use cases: When the developer needs to obtain the audio data of the remote user or the data collected by the local microphone for other purposes (such as pure audio recording, pure audio third-party monitoring, pure audio real-time analysis).
- When to call: After creating the engine.
- Related APIs: Turn on the audio data monitoring call [startAudioDataObserver], turn off the audio data monitoring call [stopAudioDataObserver].
- Caution: The format of the thrown audio data is pcm. The SDK still controls the collection and playback of the sound device. This function is to copy a copy of the data collected or played inside the SDK for use by the developer.
- Available since: 1.1.0
- Restrictions: The set callback needs to be effective after calling [startAudioDataObserver] and is in the push or pull state.
enableCustomAudioIO
public void enableCustomAudioIO(boolean enable, ZegoCustomAudioConfig config)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| enable | boolean | Whether to enable custom audio IO, default is false. |
| config | ZegoCustomAudioConfig | Custom audio IO config. |
Details
Enable custom audio IO function, support PCM, AAC format data.
- Use cases: If the developer wants to implement special functions (such as voice change, bel canto, etc.) through custom processing after the audio data is collected or before the remote audio data is drawn for rendering.
- When to call: It needs to be called before [startPublishingStream], [startPlayingStream], [startPreview], [createMediaPlayer], [createAudioEffectPlayer] and [createRealTimeSequentialDataManager] to be effective.
- Available since: 1.10.0
- Restrictions: None.
enableCustomAudioIO
public void enableCustomAudioIO(boolean enable, ZegoCustomAudioConfig config, int channel)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| enable | boolean | Whether to enable custom audio IO, default is false. |
| config | ZegoCustomAudioConfig | Custom audio IO config. |
| channel | int | 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: None.
sendCustomAudioCaptureAACData
public void sendCustomAudioCaptureAACData(ByteBuffer data, int dataLength, int configLength, long referenceTimeMillisecond, int samples, ZegoAudioFrameParam param, int channel)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| data | ByteBuffer | AAC buffer data. Note that it must be a DirectByteBuffer, which can be constructed by allocateDirect(). |
| dataLength | int | The total length of the buffer data. |
| configLength | int | The length of AAC specific config (Note: The AAC encoded data length is 'encodedLength = dataLength - configLength').Value range: [0,64] |
| referenceTimeMillisecond | long | The UNIX timestamp of this AAC audio frame in millisecond. |
| samples | int | 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 | int | 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: None.
sendCustomAudioCapturePCMData
public void sendCustomAudioCapturePCMData(ByteBuffer data, int dataLength, ZegoAudioFrameParam param)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| data | ByteBuffer | PCM buffer data. Note that it must be a DirectByteBuffer, which can be constructed by allocateDirect(). |
| dataLength | int | The total length of the buffer data. |
| param | ZegoAudioFrameParam | The param of this PCM audio frame. |
Details
Sends the captured audio PCM data to the SDK.
- Use cases: 1.The customer needs to obtain input after acquisition from the existing audio stream, audio file, or customized acquisition system, and hand it over to the SDK for transmission. 2.Customers have their own requirements for special sound processing for PCM input sources. After the sound processing, the input will be sent to the SDK for transmission.
- When to call: After [enableCustomAudioIO] and publishing stream successfully.
- Related APIs: Enable the custom audio IO function [enableCustomAudioIO], and start the push stream [startPublishingStream].
- Available since: 1.10.0
- Restrictions: None.
sendCustomAudioCapturePCMData
public void sendCustomAudioCapturePCMData(ByteBuffer data, int dataLength, ZegoAudioFrameParam param, int channel)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| data | ByteBuffer | PCM buffer data. Note that it must be a DirectByteBuffer, which can be constructed by allocateDirect(). |
| dataLength | int | The total length of the buffer data. |
| param | ZegoAudioFrameParam | The param of this PCM audio frame. |
| channel | int | 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: None.
fetchCustomAudioRenderPCMData
public void fetchCustomAudioRenderPCMData(ByteBuffer data, int dataLength, ZegoAudioFrameParam param)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| data | ByteBuffer | 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 | int | 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: None.
createRangeAudio
public ZegoRangeAudio createRangeAudio()ZegoExpressEngine.javaCreates 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.
range audio instance, null will be returned when the maximum number is exceeded.
destroyRangeAudio
public void destroyRangeAudio(ZegoRangeAudio rangeAudio)ZegoExpressEngine.javaParameters
| Name | Type | Description |
|---|---|---|
| rangeAudio | ZegoRangeAudio | The range audio instance object to be destroyed. |
Details
Destroys a range audio instance.
- Available since: 2.11.0
createCopyrightedMusic
public ZegoCopyrightedMusic createCopyrightedMusic()ZegoExpressEngine.javaCreates 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 void destroyCopyrightedMusic(ZegoCopyrightedMusic copyrightedMusic)ZegoExpressEngine.javaParameters
| 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
ZegoFontStyle
Font style.
Details
Font style configuration, can be used to configure font type, font size, font color, font transparency.
- Use cases: Set text watermark in manual stream mixing scene, such as Co-hosting.
Declared in entity/ZegoFontStyle.java
Properties
type
public ZegoFontType type- Required: False.
- Default value: Source han sans [ZegoFontTypeSourceHanSans]
size
public int size- Required: False.
- Default value: 24.
- Value range: [12,100].
color
public int color- Required: False.
- Default value: 16777215(white).
- Value range: [0,16777215].
transparency
public int transparency- Required: False.
- Default value: 0.
- Value range: [0,100], 100 is completely opaque, 0 is completely transparent.
border
public boolean border- Required: False.
- Default value: False.
- Value range: True/False.
borderColor
public int borderColor- Required: False.
- Default value: 0.
- Value range: [0,16777215].
Methods
ZegoFontStyle
public ZegoFontStyleentity/ZegoFontStyle.javaZegoLabelInfo
Label info.
Details
Font style configuration, can be used to configure font type, font si-e, font color, font transparency.
- Use cases: Set text watermark in manual stream mixing scene, such as Co-hosting.
Declared in entity/ZegoLabelInfo.java
Properties
text
public String text- Required: True.
- Value range: Maximum support for displaying 100 Chinese characters and 300 English characters.
left
public int left- Required: False.
- Default value: 0.
top
public int top- Required: False.
- Default value: 0.
font
Methods
ZegoLabelInfo
public ZegoLabelInfo(String text)entity/ZegoLabelInfo.javaZegoLogConfig
Log config.
Details
This parameter is required when calling [setlogconfig] to customize log configuration.
- Use cases: This configuration is required when you need to customize the log storage path or the maximum log file size.
- Caution: None.
Declared in entity/ZegoLogConfig.java
Properties
logPath
public String logPathUsed to customize the storage path of the log file.
- Use cases: This configuration is required when you need to customize the log storage path.
- Required: False.
- Default value: The default path of each platform is different, please refer to the official website document https://docs.zegocloud.com/faq/express_sdkLog.
- Caution: Developers need to ensure read and write permissions for files under this path.
logSize
public long logSizeUsed to customize the maximum log file size.
- Use cases: This configuration is required when you need to customize the upper limit of the log file size.
- Required: False.
- Default value: 5MB (5 * 1024 * 1024 Bytes).
- Value range: Minimum 1MB (1 * 1024 * 1024 Bytes), maximum 100M (100 * 1024 * 1024 Bytes), 0 means no need to write logs.
- Caution: The larger the upper limit of the log file size, the more log information it carries, but the log upload time will be longer.
logCount
public int logCountLog files count. Default is 3. Value range is [3, 20].
Methods
ZegoLogConfig
ZegoMediaDataPublisher
Declared in ZegoMediaDataPublisher.java
Methods
setEventHandler
public void setEventHandler(IZegoMediaDataPublisherEventHandler handler)ZegoMediaDataPublisher.javaParameters
| Name | Type | Description |
|---|---|---|
| handler | IZegoMediaDataPublisherEventHandler | The event handler |
Details
Set event callback handler for media data publisher.
- Use cases: Often used in server-side publishing stream scenarios, such as AI classrooms.
- When to call: After calling the [createMediaDataPublisher] function to create a media data publisher.
- Caution: This API used to be named [setMediaDataPublisherEventHandler] before version 3.8.0. Please refer to Upgrade guide v3.8.0+.
- Available since: 2.17.0
addMediaFilePath
public void addMediaFilePath(String path, boolean isClear)ZegoMediaDataPublisher.javaParameters
| Name | Type | Description |
|---|---|---|
| path | String | Local absolute path to the media file. |
| isClear | boolean | Whether to clear the publish queue. |
Details
Add media file to the publish queue. Currently, only mp4 / m4a / aac file are supported, and special conversion is required.
- Use cases: Often used in server-side publishing stream scenarios, such as AI classrooms.
- When to call: After calling the [createMediaDataPublisher] function to create a media data publisher.
- Caution: The mp4 file format must meet the following points:The video must be encoded as H.264 and cannot contain B frames, only I and P frames. The I frame interval is 2s, that is, a single GOP value is 2s; The frame rate, bit rate, and resolution of the video are consistent with the frame rate, bit rate, and resolution set by [setVideoConfig] before publishing stream; Audio encoding must be MPEG-4 AAC.
- Available since: 2.17.0
reset
public void reset()ZegoMediaDataPublisher.javaWhen you need to re-publish stream and do not need to continue publishing from the previous publish queue, you can call this function to reset this media data publisher's state.
- Use cases: Often used in server-side publishing stream scenarios, such as AI classrooms.
- Caution: When the developer calls [logoutRoom], the state is automatically reset.
- Available since: 2.17.0
setVideoSendDelayTime
public void setVideoSendDelayTime(int delayTime)ZegoMediaDataPublisher.javaParameters
| Name | Type | Description |
|---|---|---|
| delayTime | int | Video playback time.Required: Yes.Value range: [0, 100] ms. |
Details
When this value is set, when publishing video file stream, the SDK will permanently delay the video to the set time value before sending.
- Use cases: Mainly used to correct the fixed audio and picture asynchronous phenomenon that occurs during streaming.
- When to call: After calling the [createMediaDataPublisher] function to create a media data publisher.
- Available since: 2.17.0
seekTo
public void seekTo(long millisecond)ZegoMediaDataPublisher.javaParameters
| Name | Type | Description |
|---|---|---|
| millisecond | long | The timestamp of the start of streaming (relative to the timestamp of the file currently being published, the starting value is 0). the unit is milliseconds |
Details
Specify the starting point of the current video file publishing.
- When to call: Called at any point between [OnMediaDataPublisherFileOpen] and [OnMediaDataPublisherFileClose]. For example: this function can be called directly in the [OnMediaDataPublisherFileOpen] callback.
- Available since: 2.17.0
getTotalDuration
public long getTotalDuration()ZegoMediaDataPublisher.javaGet the total duration of the current file, in milliseconds.
- When to call: After [onMediaDataPublisherFileDataBegin] callback.
- Available since: 2.17.0
The total duration of the current file.
getCurrentDuration
public long getCurrentDuration()ZegoMediaDataPublisher.javaGet the playing progress of the current file, in milliseconds.
- When to call: After received the [onMediaDataPublisherFileDataBegin] callback.
- Available since: 2.17.0
The playing progress of the current file.
getIndex
public int getIndex()ZegoMediaDataPublisher.javaGet the channel index of the media data publisher.
- Available since: 3.4.0
ZegoMediaDataPublisherConfig
Used to config the media data publisher.
Details
Used to config the media data publisher when creating it.
Declared in entity/ZegoMediaDataPublisherConfig.java
Properties
channel
public int channelUsed to specify the publish channel index of publisher.
mode
ZegoMediaPlayer
Declared in ZegoMediaPlayer.java
Methods
setEventHandler
public void setEventHandler(IZegoMediaPlayerEventHandler handler)ZegoMediaPlayer.javaParameters
| Name | Type | Description |
|---|---|---|
| handler | IZegoMediaPlayerEventHandler | Event callback handler for media player |
Details
Listen to the event notification callback of the media player. Use Cases: You can change the media player UI widget according to the related event callback.
- When to call: After the [ZegoMediaPlayer] instance created.
- Caution: Calling this function will overwrite the callback set by the last call to this function.
- Available since: 2.1.0
- Restrictions: None.
setVideoHandler
public void setVideoHandler(IZegoMediaPlayerVideoHandler handler, ZegoVideoFrameFormat format)ZegoMediaPlayer.javaParameters
| Name | Type | Description |
|---|---|---|
| handler | IZegoMediaPlayerVideoHandler | 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: None.
setAudioHandler
public void setAudioHandler(IZegoMediaPlayerAudioHandler handler)ZegoMediaPlayer.javaParameters
| Name | Type | Description |
|---|---|---|
| handler | IZegoMediaPlayerAudioHandler | Audio data callback handler for media player |
Details
By setting this callback, the audio data of the media resource file played by the media player can be called back.
- When to call: After the [ZegoMediaPlayer] instance created.
- Caution: When you no longer need to get the audio data, please call this function again to clear the handler to stop the audio data callback.
- Available since: 2.1.0
- Restrictions: None.
loadResource
public void loadResource(String path, IZegoMediaPlayerLoadResourceCallback callback)ZegoMediaPlayer.javaParameters
| 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 | IZegoMediaPlayerLoadResourceCallback | 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.
Return
Callback result of loading media resource.
loadResourceWithPosition
public void loadResourceWithPosition(String path, long startPosition, IZegoMediaPlayerLoadResourceCallback callback)ZegoMediaPlayer.javaParameters
| 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 | IZegoMediaPlayerLoadResourceCallback | 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.
Return
Callback result of loading media resource.
loadResourceFromMediaData
public void loadResourceFromMediaData(byte[] mediaData, long startPosition, IZegoMediaPlayerLoadResourceCallback callback)ZegoMediaPlayer.javaParameters
| Name | Type | Description |
|---|---|---|
| mediaData | byte[] | Binary audio data. |
| startPosition | long | Position of starting playback, in milliseconds. |
| callback | IZegoMediaPlayerLoadResourceCallback | 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.
Return
Callback result of loading media resource.
loadCopyrightedMusicResourceWithPosition
public void loadCopyrightedMusicResourceWithPosition(String resourceID, long startPosition, IZegoMediaPlayerLoadResourceCallback callback)ZegoMediaPlayer.javaParameters
| Name | Type | Description |
|---|---|---|
| resourceID | String | The resource ID obtained from the copyrighted music module. |
| startPosition | long | The progress at which the playback started. |
| callback | IZegoMediaPlayerLoadResourceCallback | 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.
start
public void start()ZegoMediaPlayer.javaYou need to load resources before playing
stop
public void stop()ZegoMediaPlayer.javapause
public void pause()ZegoMediaPlayer.javaresume
public void resume()ZegoMediaPlayer.javaseekTo
public void seekTo(long millisecond, IZegoMediaPlayerSeekToCallback callback)ZegoMediaPlayer.javaParameters
| Name | Type | Description |
|---|---|---|
| millisecond | long | Point in time of specified playback progress |
| callback | IZegoMediaPlayerSeekToCallback | 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 void enableRepeat(boolean enable)ZegoMediaPlayer.java| Name | Type | Description |
|---|---|---|
| enable | boolean | repeat playback flag. The default is false. |
setPlaySpeed
public void setPlaySpeed(float speed)ZegoMediaPlayer.javaParameters
| 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 void enableAux(boolean enable)ZegoMediaPlayer.javaParameters
| Name | Type | Description |
|---|---|---|
| enable | boolean | Aux audio flag. The default is false. |
Details
This interface will only mix the media player sound into the main channel
muteLocal
public void muteLocal(boolean mute)ZegoMediaPlayer.javaParameters
| Name | Type | Description |
|---|---|---|
| mute | boolean | 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 void setVolume(int volume)ZegoMediaPlayer.java| Name | Type | Description |
|---|---|---|
| volume | int | The range is 0 ~ 200. The default is 60. |
setPlayVolume
public void setPlayVolume(int volume)ZegoMediaPlayer.java| Name | Type | Description |
|---|---|---|
| volume | int | The range is 0 ~ 200. The default is 60. |
setPublishVolume
public void setPublishVolume(int volume)ZegoMediaPlayer.java| Name | Type | Description |
|---|---|---|
| volume | int | The range is 0 ~ 200. The default is 60. |
setProgressInterval
public void setProgressInterval(long millisecond)ZegoMediaPlayer.javaParameters
| Name | Type | Description |
|---|---|---|
| millisecond | long | 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 int getPlayVolume()ZegoMediaPlayer.javacurrent volume
getPublishVolume
public int getPublishVolume()ZegoMediaPlayer.javacurrent volume
getTotalDuration
public long getTotalDuration()ZegoMediaPlayer.javaYou should load resource before invoking this function, otherwise the return value is 0
Unit is millisecond
getCurrentProgress
public long getCurrentProgress()ZegoMediaPlayer.javaYou should load resource before invoking this function, otherwise the return value is 0
current progress
getAudioTrackCount
public int getAudioTrackCount()ZegoMediaPlayer.javaNumber of audio tracks
setAudioTrackIndex
public void setAudioTrackIndex(int index)ZegoMediaPlayer.java| Name | Type | Description |
|---|---|---|
| index | int | Audio track index, the number of audio tracks can be obtained through the [getAudioTrackCount] function. |
getCurrentState
public ZegoMediaPlayerState getCurrentState()ZegoMediaPlayer.javacurrent state
getIndex
public int getIndex()ZegoMediaPlayer.javaGet media player index.
- When to call: It can be called after [createMediaPlayer].
- Restrictions: None.
Media player index.
enableAccurateSeek
public void enableAccurateSeek(boolean enable, ZegoAccurateSeekConfig config)ZegoMediaPlayer.javaParameters
| Name | Type | Description |
|---|---|---|
| enable | boolean | 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 void setNetWorkResourceMaxCache(int time, int size)ZegoMediaPlayer.javaParameters
| Name | Type | Description |
|---|---|---|
| time | int | 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 | int | 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 ZegoNetWorkResourceCache getNetWorkResourceCache()ZegoMediaPlayer.javaReturns the current cached information, including the length of time the data can be played and the size of the cached data.
setNetWorkBufferThreshold
public void setNetWorkBufferThreshold(int threshold)ZegoMediaPlayer.javaParameters
| Name | Type | Description |
|---|---|---|
| threshold | int | 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 void enableSoundLevelMonitor(boolean enable, int millisecond)ZegoMediaPlayer.javaParameters
| Name | Type | Description |
|---|---|---|
| enable | boolean | Whether to enable monitoring, true is enabled, false is disabled. |
| millisecond | int | 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 void enableFrequencySpectrumMonitor(boolean enable, int millisecond)ZegoMediaPlayer.javaParameters
| Name | Type | Description |
|---|---|---|
| enable | boolean | Whether to enable monitoring, true is enabled, false is disabled. |
| millisecond | int | 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.
setActiveAudioChannel
public void setActiveAudioChannel(ZegoMediaPlayerAudioChannel audioChannel)ZegoMediaPlayer.javaParameters
| Name | Type | Description |
|---|---|---|
| audioChannel | ZegoMediaPlayerAudioChannel | Playback channel, the default is ZegoMediaPlayerAudioChannelAll. |
Details
Set the playback channel.
- When to call: It can be called after the engine by [createEngine] has been initialized and the media player has been created by [createMediaPlayer].
- Available since: 2.20.0
- Restrictions: None.
clearView
public void clearView()ZegoMediaPlayer.javaClears the last frame of the playback control that remains on the control after playback ends.
- When to call: It can be called after the engine by [createEngine] has been initialized and the media player has been created by [createMediaPlayer].
- Available since: 2.20.0
- Restrictions: The interface call takes effect only when the media player ends playing.
getMediaInfo
public ZegoMediaPlayerMediaInfo getMediaInfo()ZegoMediaPlayer.javaGet meida information such as video resolution from media file.
- When to call: It can be called after the engine by [createEngine] has been initialized and the media player has been created by [createMediaPlayer].
- Available since: 3.6.0
- Restrictions: None.
getPlaybackStatistics
public ZegoMediaPlayerStatisticsInfo getPlaybackStatistics()ZegoMediaPlayer.javaGet current playback statistics to monitor whether decoding and rendering anomalies occur in the player.
- Use cases: Typically used in cloud-based media player scenarios.
- When to call: Invoke after the [loadResource] callback succeeds.
- Available since: 3.12.0
setVoiceChangerParam
public void setVoiceChangerParam(ZegoMediaPlayerAudioChannel audioChannel, ZegoVoiceChangerParam param)ZegoMediaPlayer.java| Name | Type | Description |
|---|---|---|
| audioChannel | ZegoMediaPlayerAudioChannel | The audio channel to be voice changed |
| param | ZegoVoiceChangerParam | Voice changer parameters |
ZegoMediaPlayerMediaInfo
Media Infomration of media file.
Details
Meida information such as video resolution of media file.
Declared in entity/ZegoMediaPlayerMediaInfo.java
Properties
width
public int widthVideo resolution width.
height
public int heightVideo resolution height.
frameRate
public int frameRateVideo frame rate.
Methods
ZegoMediaPlayerMediaInfo
public ZegoMediaPlayerMediaInfoentity/ZegoMediaPlayerMediaInfo.javaZegoMediaPlayerStatisticsInfo
Media player play statistics.
Details
Media player play statistics.
Declared in entity/ZegoMediaPlayerStatisticsInfo.java
Properties
videoSourceFps
public double videoSourceFpsVideo source fps.
videoDecodeFps
public double videoDecodeFpsVideo decode fps.
videoRenderFps
public double videoRenderFpsVideo render fps.
audioSourceFps
public double audioSourceFpsAudio source fps.
audioDecodeFps
public double audioDecodeFpsAudio decode fps.
audioRenderFps
public double audioRenderFpsAudio render fps.
Methods
ZegoMediaPlayerStatisticsInfo
entity/ZegoMediaPlayerStatisticsInfo.javaZegoMediaSideInfo
SEI Callback info.
Declared in entity/ZegoMediaSideInfo.java
Properties
streamID
public String streamIDStream ID.
SEIData
public ByteBuffer SEIDataSEI data
SEIDataLength
public int SEIDataLengthLength of the SEI data
timestampNs
public long timestampNstimestamp
moduleType
public int moduleTypeSEI source module. Please contact ZEGO technical support.
ZegoMixerAudioConfig
Mix stream audio configuration.
Details
Configure video frame rate, bitrate, and resolution for mixer task
Declared in entity/ZegoMixerAudioConfig.java
Properties
bitrate
public int bitrateAudio bitrate in kbps, default is 48 kbps, cannot be modified after starting a mixer task
channel
codecID
mixMode
public ZegoAudioMixMode mixModeMulti-channel audio stream mixing mode. If [ZegoAudioMixMode] is selected as [Focused], the SDK will select 4 input streams with [isAudioFocus] set as the focus voice highlight. If it is not selected or less than 4 channels are selected, it will automatically fill in 4 channels. On web platforms, this property does not take effect.
Methods
ZegoMixerAudioConfig
ZegoMixerImageInfo
Set the image information of a single input stream in the mux.
Details
Sets a picture for the content of a single input stream, which is used in place of the video, i.e. the video is not displayed when the picture is used. The layout layout in [ZegoMixerInput] for image multiplexing.
Use case: The developer needs to temporarily turn off the camera to display the image during the video connection to the microphone, or display the picture when the audio is connected to the microphone.
- Available since: 2.19.0
- Restrictions: Image size is limited to 1M.
Declared in entity/ZegoMixerImageInfo.java
Properties
url
public String urlThe image path, if not empty, the image will be displayed, otherwise, the video will be displayed. JPG and PNG formats are supported. There are 2 ways to use it: 1. URI: Provide the picture to ZEGO technical support for configuration. After the configuration is complete, the picture URI will be provided, for example: preset-id://xxx.jpg. 2. URL: Only HTTP protocol is supported.
displayMode
public int displayModeImage display mode. 0: Default. Use image to replace video content when url is not null. 1: Display image based on camera status. Display image when camera is turned off. Display video content when camera is turned on (no need to clear the url parameter). 2: Display image based on the input stream has video data or not. Display image when there is no video data in the input stream for 3 consecutive seconds. The default duration for judging that there is no video data is 3 seconds. If you need change this setting, please contact ZEGO technical support. Display video content when the input stream has video data.
Methods
ZegoMixerImageInfo
public ZegoMixerImageInfo(String url)entity/ZegoMixerImageInfo.javaZegoMixerImageInfo
public ZegoMixerImageInfo(String url, int displayMode)entity/ZegoMixerImageInfo.javaZegoMixerInput
Mixer input.
Details
Configure the mix stream input stream ID, type, and the layout
Declared in entity/ZegoMixerInput.java
Properties
streamID
public String streamID- Caution: You cannot include URL keywords, otherwise publishing stream and playing stream will fails. Only support numbers, English characters and '-', '_'.
contentType
layout
public ZegoRect layoutStream layout. When the mixed stream is an audio stream (that is, the ContentType parameter is set to the audio mixed stream type). Developers do not need to assign a value to this field, just use the SDK default.
soundLevelID
public int soundLevelIDIf enable soundLevel in mix stream task, an unique soundLevelID is need for every stream
volume
public int volumeInput stream volume, valid range [0, 200], default is 100.
isAudioFocus
public boolean isAudioFocusWhether the focus voice is enabled in the current input stream, the sound of this stream will be highlighted if enabled.
audioDirection
public int audioDirectionThe direction of the audio. Valid direction is between 0 to 360. Set -1 means disable. Default value is -1. On web platforms, this property does not take effect.
label
renderMode
imageInfo
cornerRadius
public int cornerRadiusVideo frame corner radius, in px.
- Required: False.
- Value range: Does not exceed the width and height of the video screen set by the [layout] parameter.
- Default value: 0.
advancedConfig
public HashMap<String, String> advancedConfigSet advanced configuration. Please contact ZEGO technical support. On web platforms, this property does not take effect.
blurInfo
Methods
ZegoMixerInput
public ZegoMixerInput(String streamID, ZegoMixerInputContentType contentType, ZegoRect layout)entity/ZegoMixerInput.javaZegoMixerOutput
Mixer output object, currently, a mixed-stream task only supports a maximum of four video streams with different resolutions.
Details
Configure mix stream output target URL or stream ID
Declared in entity/ZegoMixerOutput.java
Properties
target
public String targetMix stream output target, URL or stream ID, if set to be URL format, only RTMP URL surpported, for example rtmp://xxxxxxxx, addresses with two identical mixed-stream outputs cannot be passed in.
videoConfig
public ZegoMixerOutputVideoConfig videoConfigMix stream output video config. On web platforms, this property does not take effect.
targetRoom
public ZegoMixerOutputRoomInfo targetRoomSpecifies the room information for the output stream.
Methods
ZegoMixerOutput
setVideoConfig
public void setVideoConfig(ZegoMixerOutputVideoConfig config)entity/ZegoMixerOutput.javasetTargetRoom
public void setTargetRoom(ZegoMixerOutputRoomInfo info)entity/ZegoMixerOutput.javaZegoMixerOutputRoomInfo
Room information for the output stream in a mixed stream.
Details
Setting room information for a single output stream; the mixed output stream can be added to the specified room, allowing users in the room to receive notifications of increased stream in the room.
- Use cases: Manual mixed stream scenario, such as Co-hosting.
- Available since: 3.18.0
- Restrictions: Dynamic updates during mixed stream are not supported.
Declared in entity/ZegoMixerOutputRoomInfo.java
Properties
roomID
public String roomIDSpecifies the room ID of the output stream. You need to ensure that the room is already present when mixing starts.
userID
public String userIDSpecifies the user ID of the output stream. It is not recommended to use the same userID as the actual user in the room to avoid conflicts with the SDK's stream addition behavior.
Methods
ZegoMixerOutputRoomInfo
public ZegoMixerOutputRoomInfo(String roomID, String userID)entity/ZegoMixerOutputRoomInfo.javaZegoMixerOutputVideoConfig
Mix stream output video config object.
Details
Configure the video parameters, coding format and bitrate of mix stream output.
- Use cases: Manual mixed stream scenario, such as Co-hosting.
Declared in entity/ZegoMixerOutputVideoConfig.java
Properties
videoCodecID
public ZegoVideoCodecID videoCodecIDMix stream output video coding format, supporting H.264 and h.265 coding.
bitrate
public int bitrateMix stream output video bitrate in kbps. The default value is the bitrate configured in [ZegoMixerVideoConfig].
encodeProfile
public ZegoEncodeProfile encodeProfileMix stream video encode profile. Default value is [ZegoEncodeProfileDefault].
encodeLatency
public int encodeLatencyThe video encoding delay of mixed stream output, Valid value range [0, 2000], in milliseconds. The default value is 0.
enableLowBitrateHD
public boolean enableLowBitrateHDEnable high definition low bitrate. Default is false.
Methods
ZegoMixerOutputVideoConfig
public ZegoMixerOutputVideoConfigentity/ZegoMixerOutputVideoConfig.javaZegoMixerOutputVideoConfig
public ZegoMixerOutputVideoConfig(ZegoVideoCodecID codecID, int bitrate)entity/ZegoMixerOutputVideoConfig.javaZegoMixerOutputVideoConfig
public ZegoMixerOutputVideoConfig(ZegoVideoCodecID codecID, int bitrate, ZegoEncodeProfile profile, int encodeLatency)entity/ZegoMixerOutputVideoConfig.javaZegoMixerOutputVideoConfig
public ZegoMixerOutputVideoConfig(ZegoVideoCodecID codecID, int bitrate, ZegoEncodeProfile profile, int encodeLatency, boolean enableLowBitrateHD)entity/ZegoMixerOutputVideoConfig.javaZegoMixerTask
Mix stream task object.
Details
This class is the configuration class of the stream mixing task. When a stream mixing task is requested to the ZEGO RTC server, the configuration of the stream mixing task is required. This class describes the detailed configuration information of this stream mixing task.
Declared in entity/ZegoMixerTask.java
Properties
taskID
private String taskIDMix stream task ID
audioConfig
videoConfig
inputList
outputList
watermark
whiteboard
backgroundColor
public int backgroundColorMix stream background color, The color value corresponding to RGBA is 0xRRGGBBAA, and setting the transparency of the background color is currently not supported. The AA in 0xRRGGBBAA is 00. For example, select RGB as #87CEFA as the background color, this parameter passes 0x87CEFA00.
backgroundImageURL
public String backgroundImageURLMix stream background image URL
soundLevel
public boolean soundLevelEnable or disable sound level callback for the task. If enabled, then the remote player can get the soundLevel of every stream in the inputlist by [onMixerSoundLevelUpdate] callback.
streamAlignmentMode
private ZegoStreamAlignmentMode streamAlignmentModeThe stream mixing alignment mode
userData
public ByteBuffer userDataUser data, the length of user data should not be more than 1000 bytes,After setting, the streaming party can obtain the SEI content by listening to the callback of [onPlayerRecvSEI]. it must be created using the [ByteBuffer. Allocatedirect] function, otherwise the data cannot be transferred to the SDK.
userDataLength
public int userDataLengthUser data length, not greater than 1000. that only data with length will be read by SDK. If the length is greater than the actual length of data, the SDK will read the data according to the actual length of data.
advancedConfig
public HashMap<String, String> advancedConfigSet advanced configuration, such as specifying video encoding and others. If you need to use it, contact ZEGO technical support.
minPlayStreamBufferLength
public int minPlayStreamBufferLengthSets the lower limit of the interval range for the adaptive adjustment of the stream playing cache of the stream mixing server. In the real-time chorus KTV scenario, slight fluctuations in the network at the push end may cause the mixed stream to freeze. At this time, when the audience pulls the mixed stream, there is a high probability of the problem of freeze. By adjusting the lower limit of the interval range for the adaptive adjustment of the stream playing cache of the stream mixing server, it can optimize the freezing problem that occurs when playing mixing streams at the player end, but it will increase the delay. It is not set by default, that is, the server uses its own configuration values. It only takes effect for the new input stream setting, and does not take effect for the input stream that has already started mixing.Value Range: [0,10000], exceeding the maximum value will result in a failure of the stream mixing request. On web platforms, this property does not take effect.
mixImageCheckMode
public ZegoMixImageCheckMode mixImageCheckModeSet the mixed stream image check mode.
Methods
ZegoMixerTask
public ZegoMixerTask(String taskID)entity/ZegoMixerTask.javagetTaskID
public void String getTaskID()entity/ZegoMixerTask.javasetInputList
public void setInputList(ArrayList<ZegoMixerInput> inputList)entity/ZegoMixerTask.javasetOutputList
public void setOutputList(ArrayList<ZegoMixerOutput> outputList)entity/ZegoMixerTask.javasetAudioConfig
public void setAudioConfig(ZegoMixerAudioConfig config)entity/ZegoMixerTask.javasetVideoConfig
public void setVideoConfig(ZegoMixerVideoConfig config)entity/ZegoMixerTask.javasetBackgroundColor
public void setBackgroundColor(int backgroundColor)entity/ZegoMixerTask.javasetBackgroundImageURL
public void setBackgroundImageURL(String backgroundImageURL)entity/ZegoMixerTask.javasetWatermark
public void setWatermark(ZegoWatermark watermark)entity/ZegoMixerTask.javasetWhiteboard
public void setWhiteboard(ZegoMixerWhiteboard whiteboard)entity/ZegoMixerTask.javaenableSoundLevel
public void enableSoundLevel(boolean enable)entity/ZegoMixerTask.javasetStreamAlignmentMode
public void setStreamAlignmentMode(ZegoStreamAlignmentMode mode)entity/ZegoMixerTask.javasetUserData
public void setUserData(ByteBuffer data, int length)entity/ZegoMixerTask.javasetAdvancedConfig
public void setAdvancedConfig(HashMap<String, String> advancedConfig)entity/ZegoMixerTask.javasetMinPlayStreamBufferLength
public void setMinPlayStreamBufferLength(int minPlayStreamBufferLength)entity/ZegoMixerTask.javasetMixImageCheckMode
public void setMixImageCheckMode(ZegoMixImageCheckMode mixImageCheckMode)entity/ZegoMixerTask.javaZegoMixerVideoConfig
Mix stream video config object.
Details
Configure video frame rate, bitrate, and resolution for mixer task
Declared in entity/ZegoMixerVideoConfig.java
Properties
width
public int widthVideo resolution width
height
public int heightVideo resolution height
fps
public int fpsVideo FPS, cannot be modified after starting a mixer task
bitrate
public int bitrateVideo bitrate in kbps
quality
public int qualityVideo quality, this value is valid when the video rate control mode parameter is set to constant quality. The valid value ranges from 0 to 51. The default value is 23. If you want better video quality, lower the quality value based on 23 to test the adjustment. If you want a smaller file size, test the adjustment by increasing the high quality value at the base of 23. Take the file size under the value x as an example. The file size under the value x + 6 is half the size of the file size under the value x, and the file size under the value x-6 is twice the size of the file size under the value x. On web platforms, this property does not take effect.
rateControlMode
public ZegoVideoRateControlMode rateControlModeVideo bitrate control mode. On web platforms, this property does not take effect.
Methods
ZegoMixerVideoConfig
ZegoMixerVideoConfig
public ZegoMixerVideoConfig(int width, int height, int fps, int bitrate)entity/ZegoMixerVideoConfig.javaZegoMixerWhiteboard
Mixer whiteboard object.
Details
Configure the mix whiteboard ID, aspect ratio and the layout.
Declared in entity/ZegoMixerWhiteboard.java
Properties
whiteboardID
public long whiteboardIDWhiteboard ID.
horizontalRatio
public int horizontalRatioWhiteboard aspect ratio(width), the default aspect ratio is 16:9.
verticalRatio
public int verticalRatioWhiteboard aspect ratio(height), the default aspect ratio is 16:9.
isPPTAnimation
public boolean isPPTAnimationWhether the whiteboard will load dynamic PPT files or not, default value is false.
layout
zOrder
public int zOrderWhiteboard z-order.
backgroundColor
public int backgroundColorWhiteboard background color. Defaule is 0xF1F3F400 (gray). The color value corresponding to RGBA is 0xRRGGBBAA, and setting the transparency of the background color is currently not supported. The AA in 0xRRGGBBAA is 00. For example, select RGB as #87CEFA as the background color, this parameter passes 0x87CEFA00.F
Methods
ZegoMixerWhiteboard
ZegoNetWorkResourceCache
Media player network cache information
Declared in entity/ZegoNetWorkResourceCache.java
Properties
time
public int timeCached playable duration, unit ms
size
public int sizeCached playable size, unit byte
ZegoNetworkProbeConfig
Network probe config
Declared in entity/ZegoNetworkProbeConfig.java
Properties
enableTraceroute
public boolean enableTracerouteWhether do traceroute, enabling tranceRoute will significantly increase network detection time
ZegoNetworkProbeHttpResult
http probe result
Declared in entity/ZegoNetworkProbeHttpResult.java
Properties
errorCode
public int errorCodehttp probe errorCode, 0 means the connection is normal
requestCostTime
public int requestCostTimehttp request cost time, the unit is millisecond
ZegoNetworkProbeResult
Network probe result
Declared in entity/ZegoNetworkProbeResult.java
Properties
httpProbeResult
tcpProbeResult
udpProbeResult
tracerouteResult
ZegoNetworkProbeTcpResult
tcp probe result
Declared in entity/ZegoNetworkProbeTcpResult.java
Properties
errorCode
public int errorCodetcp probe errorCode, 0 means the connection is normal
rtt
public int rtttcp rtt, the unit is millisecond
connectCostTime
public int connectCostTimetcp connection cost time, the unit is millisecond
ZegoNetworkProbeTracerouteResult
traceroute result
Details
Jump up to 30 times. The traceroute result is for reference and does not represent the final network connection result. The priority is http, tcp, udp probe result.
Declared in entity/ZegoNetworkProbeTracerouteResult.java
Properties
errorCode
public int errorCodetraceroute error code, 0 means normal
tracerouteCostTime
public int tracerouteCostTimeTime consumed by trace route, the unit is millisecond
ZegoNetworkProbeUdpResult
udp probe result
Declared in entity/ZegoNetworkProbeUdpResult.java
Properties
errorCode
public int errorCodeudp probe errorCode, 0 means the connection is normal
rtt
public int rttThe total time that the SDK send udp data to server and receive a reply, the unit is millisecond
ZegoNetworkSpeedTestConfig
Network speed test config
Declared in entity/ZegoNetworkSpeedTestConfig.java
Properties
testUplink
public boolean testUplinkTest uplink or not
expectedUplinkBitrate
public int expectedUplinkBitrateThe unit is kbps. Recommended to use the bitrate in ZegoVideoConfig when call startPublishingStream to determine whether the network uplink environment is suitable.
testDownlink
public boolean testDownlinkTest downlink or not
expectedDownlinkBitrate
public int expectedDownlinkBitrateThe unit is kbps. Recommended to use the bitrate in ZegoVideoConfig when call startPublishingStream to determine whether the network downlink environment is suitable.
ZegoNetworkSpeedTestQuality
network speed test quality
Declared in entity/ZegoNetworkSpeedTestQuality.java
Properties
connectCost
public int connectCostTime to connect to the server, in milliseconds. During the speed test, if the network connection is disconnected, it will automatically initiate a reconnection, and this variable will be updated accordingly.
rtt
public int rttrtt, in milliseconds
packetLostRate
public double packetLostRatepacket lost rate. in percentage, 0.0 ~ 1.0
quality
ZegoNetworkTimeInfo
The NTP info
Declared in entity/ZegoNetworkTimeInfo.java
Properties
timestamp
public long timestampNetwork timestamp after synchronization, 0 indicates not yet synchronized
maxDeviation
public int maxDeviationThe max deviation
ZegoPerformanceStatus
System performance monitoring status
Declared in entity/ZegoPerformanceStatus.java
Properties
cpuUsageApp
public double cpuUsageAppCurrent CPU usage of the app, value range [0, 1]
cpuUsageSystem
public double cpuUsageSystemCurrent CPU usage of the system, value range [0, 1]
memoryUsageApp
public double memoryUsageAppCurrent memory usage of the app, value range [0, 1]
memoryUsageSystem
public double memoryUsageSystemCurrent memory usage of the system, value range [0, 1]
memoryUsedApp
public double memoryUsedAppCurrent memory used of the app, in MB
ZegoPlayStreamQuality
Played stream quality information.
Details
Audio and video parameters and network quality, etc.
Declared in entity/ZegoPlayStreamQuality.java
Properties
videoRecvFPS
public double videoRecvFPSVideo receiving frame rate. The unit of frame rate is f/s
videoDejitterFPS
public double videoDejitterFPSVideo dejitter frame rate. The unit of frame rate is f/s (Available since 1.17.0)
videoDecodeFPS
public double videoDecodeFPSVideo decoding frame rate. The unit of frame rate is f/s
videoRenderFPS
public double videoRenderFPSVideo rendering frame rate. The unit of frame rate is f/s
videoKBPS
public double videoKBPSVideo bit rate in kbps
videoBreakRate
public double videoBreakRateVideo break count, break count during the callback cycle (Available since 1.17.0)
audioRecvFPS
public double audioRecvFPSAudio receiving frame rate. The unit of frame rate is f/s
audioDejitterFPS
public double audioDejitterFPSAudio dejitter frame rate. The unit of frame rate is f/s (Available since 1.17.0)
audioDecodeFPS
public double audioDecodeFPSAudio decoding frame rate. The unit of frame rate is f/s
audioRenderFPS
public double audioRenderFPSAudio rendering frame rate. The unit of frame rate is f/s
audioKBPS
public double audioKBPSAudio bit rate in kbps
audioBreakRate
public double audioBreakRateAudio break count, break count during the callback cycle (Available since 1.17.0)
mos
public double mosThe audio quality of the playing stream determined by the audio MOS (Mean Opinion Score) measurement method, value range [-1, 5], where -1 means unknown, [0, 5] means valid score, the higher the score, the better the audio quality. For the subjective perception corresponding to the MOS value, please refer to https://docs.zegocloud.com/article/3720#4_4 (Available since 2.16.0)
rtt
public int rttServer to local delay, in milliseconds
packetLostRate
public double packetLostRatePacket loss rate, in percentage, 0.0 ~ 1.0
peerToPeerDelay
public int peerToPeerDelayDelay from peer to peer, in milliseconds
peerToPeerPacketLostRate
public double peerToPeerPacketLostRatePacket loss rate from peer to peer, in percentage, 0.0 ~ 1.0
level
delay
public int delayDelay after the data is received by the local end, in milliseconds
avTimestampDiff
public int avTimestampDiffThe difference between the video timestamp and the audio timestamp, used to reflect the synchronization of audio and video, in milliseconds. This value is less than 0 means the number of milliseconds that the video leads the audio, greater than 0 means the number of milliseconds that the video lags the audio, and 0 means no difference. When the absolute value is less than 200, it can basically be regarded as synchronized audio and video, when the absolute value is greater than 200 for 10 consecutive seconds, it can be regarded as abnormal (Available since 1.19.0)
isHardwareDecode
public boolean isHardwareDecodeWhether to enable hardware decoding
videoCodecID
totalRecvBytes
public double totalRecvBytesTotal number of bytes received, including audio, video, SEI
audioRecvBytes
public double audioRecvBytesNumber of audio bytes received
videoRecvBytes
public double videoRecvBytesNumber of video bytes received
audioCumulativeBreakCount
public int audioCumulativeBreakCountAccumulated audio break count (Available since 2.9.0)
audioCumulativeBreakTime
public int audioCumulativeBreakTimeAccumulated audio break time, in milliseconds (Available since 2.9.0)
audioCumulativeBreakRate
public double audioCumulativeBreakRateAccumulated audio break rate, in percentage, 0.0 ~ 100.0 (Available since 2.9.0)
audioCumulativeDecodeTime
public int audioCumulativeDecodeTimeAccumulated audio decode time, in milliseconds (Available since 2.9.0)
videoCumulativeBreakCount
public int videoCumulativeBreakCountAccumulated video break count (Available since 2.9.0)
videoCumulativeBreakTime
public int videoCumulativeBreakTimeAccumulated video break time, in milliseconds (Available since 2.9.0)
videoCumulativeBreakRate
public double videoCumulativeBreakRateAccumulated video break rate, in percentage, 0.0 ~ 1.0 (Available since 2.9.0)
videoCumulativeDecodeTime
public int videoCumulativeDecodeTimeAccumulated video decode time, in milliseconds (Available since 2.9.0)
muteVideo
public int muteVideoMute video (Available since 3.13.0)
muteAudio
public int muteAudioMute audio (Available since 3.13.0)
ZegoPlayerConfig
Advanced player configuration.
Details
Configure stream resource mode, CDN configuration and other advanced configurations.
Declared in entity/ZegoPlayerConfig.java
Properties
resourceMode
cdnConfig
public ZegoCDNConfig cdnConfigThe CDN configuration for playing stream. If set, the stream is play according to the URL instead of the streamID. After that, the streamID is only used as the ID of SDK internal callback.
roomID
public String roomIDThe Room ID. It only needs to be filled in the multi-room mode, which indicates which room this stream needs to be bound to. This parameter is ignored in single room mode.
videoCodecID
public ZegoVideoCodecID videoCodecIDThe video encoding type of the stream, please contact ZEGO technical support if you need to use it, otherwise this parameter can be ignored.
sourceResourceType
public ZegoResourceType sourceResourceTypeThe resource type of the source stream, please contact ZEGO technical support if you need to use it, otherwise this parameter can be ignored.
codecTemplateID
public int codecTemplateIDPreconfigured codec template ID, please contact ZEGO technical support if you need to use it, otherwise this parameter can be ignored.
resourceSwitchMode
public ZegoStreamResourceSwitchMode resourceSwitchModePlay resource switching strategy mode, the default is ZegoStreamResourceSwitchModeDefault
resourceWhenStopPublish
public ZegoStreamResourceType resourceWhenStopPublishPlay resource type when stop publish, the default is ZegoStreamResourceTypeDefault. This setting takes effect only if the user sets [resourceMode] to ZegoStreamResourceModeDefaut and [resourceSwitchMode] to ZegoStreamResourceSwitchModeDefault or ZegoStreamResourceSwitchModeSwitchToRTC.
adaptiveSwitch
public int adaptiveSwitchWhether to enable adaptive switching of streams, 1 means on, 0 means off. Valid only if [resourceMode] is ZegoStreamResourceModeOnlyL3. Please contact ZEGO technical support if you need to use it, otherwise this parameter can be ignored.
adaptiveTemplateIDList
public int[] adaptiveTemplateIDListStream adaptive transcoding template ID list. Please contact ZEGO technical support if you need to use it, otherwise this parameter can be ignored.
customResourceConfig
public ZegoCustomPlayerResourceConfig customResourceConfigPlay stream resource type configuration when [resourceMode] is ZegoStreamResourceModeCustom.
switchStreamConfig
public ZegoSwitchPlayingStreamConfig switchStreamConfigExtended parameters for the [switchPlayingStream] interface.
ZegoProxyInfo
Proxy config.
Details
Set proxy config.
Declared in entity/ZegoProxyInfo.java
Properties
ip
public String ipip. Under local proxy: local proxy ip configured by the developer. under cloud proxy: proxy ip provided by ZEGO (either hostname or ip will do).
port
public int portport. Under Local Proxy: Local proxy port configured by the developer. Under Cloud Proxy: Proxy port provided by ZEGO.
hostName
public String hostNamehostname.Under Local Proxy: Local proxy hostname configured by the developer. Under cloud proxy: proxy hostname provided by ZEGO. proxy hostname (either hostname or ip will do).
userName
public String userNameuserName.Under Local Proxy: the authentication username of the local Proxy configured by the developer, can be ignored if there is none. Under cloud proxy: can be ignored.
password
public String passwordpassword.Under local proxy: authentication password of local proxy configured by developer, can be ignored if there is none. Under cloud proxy: can be ignored.
Methods
ZegoProxyInfo
ZegoPublishDualStreamConfig
Dual stream info.
Declared in entity/ZegoPublishDualStreamConfig.java
Properties
streamType
encodeWidth
public int encodeWidthVideo resolution width to be adjusted
encodeHeight
public int encodeHeightVideo resolution height to be adjusted
fps
public int fpsVideo FPS to be adjusted
bitrate
public int bitrateVideo bitrate in kbps to be adjusted
ZegoPublishStreamQuality
Published stream quality information.
Details
Audio and video parameters and network quality, etc.
Declared in entity/ZegoPublishStreamQuality.java
Properties
videoCaptureFPS
public double videoCaptureFPSVideo capture frame rate. The unit of frame rate is f/s
videoEncodeFPS
public double videoEncodeFPSVideo encoding frame rate. The unit of frame rate is f/s
videoSendFPS
public double videoSendFPSVideo transmission frame rate. The unit of frame rate is f/s
videoKBPS
public double videoKBPSVideo bit rate in kbps
audioCaptureFPS
public double audioCaptureFPSAudio capture frame rate. The unit of frame rate is f/s
audioSendFPS
public double audioSendFPSAudio transmission frame rate. The unit of frame rate is f/s
audioKBPS
public double audioKBPSAudio bit rate in kbps
rtt
public int rttLocal to server delay, in milliseconds
packetLostRate
public double packetLostRatePacket loss rate, in percentage, 0.0 ~ 1.0
level
isHardwareEncode
public boolean isHardwareEncodeWhether to enable hardware encoding
videoCodecID
totalSendBytes
public double totalSendBytesTotal number of bytes sent, including audio, video, SEI
audioSendBytes
public double audioSendBytesNumber of audio bytes sent
videoSendBytes
public double videoSendBytesNumber of video bytes sent
audioTrafficControlRate
public int audioTrafficControlRateAudio traffic control ratio, in percentage, 0 ~ 100. A value of -1 indicates failed streaming. Higher values indicate greater traffic control impact.
videoTrafficControlRate
public int videoTrafficControlRateVideo traffic control ratio, in percentage, 0 ~ 100. A value of -1 indicates failed streaming. Higher values indicate greater traffic control impact.
ZegoPublisherConfig
Advanced publisher configuration.
Details
Configure room id
Declared in entity/ZegoPublisherConfig.java
Properties
roomID
public String roomIDThe Room ID, It is not necessary to pass in single room mode, but the ID of the corresponding room must be passed in multi-room mode
forceSynchronousNetworkTime
public int forceSynchronousNetworkTimeWhether to synchronize the network time when pushing streams. 1 is synchronized with 0 is not synchronized. And must be used with setStreamAlignmentProperty. It is used to align multiple streams at the mixed stream service or streaming end, such as the chorus scene of KTV.
streamCensorshipMode
public ZegoStreamCensorshipMode streamCensorshipModeWhen pushing a flow, review the pattern of the flow. By default, no audit is performed. If you want to use this function, contact ZEGO technical support.
streamCensorFlag
public int streamCensorFlagInspect flag. If you want to use this function, contact ZEGO technical support.
codecNegotiationType
public ZegoCapabilityNegotiationType codecNegotiationTypeCodec capability negotiation type. By default, no reference to the outcome of the capability negotiation. If you want to use this function, contact ZEGO technical support.
streamTitle
public String streamTitleStream title, a utf8 string with a maximum length of 255 bytes or less.
ZegoRangeAudio
Declared in ZegoRangeAudio.java
Methods
setEventHandler
public void setEventHandler(IZegoRangeAudioEventHandler handler)ZegoRangeAudio.javaParameters
| Name | Type | Description |
|---|---|---|
| handler | IZegoRangeAudioEventHandler | The object used to receive range audio callbacks. |
Details
Set the callback function of the range audio module, which can receive the callback notification of the microphone on state [onRangeAudioMicrophoneStateUpdate]. Use case: Used to monitor the connection status of the current microphone.
- When to call: After initializing the range audio [createRangeAudio].
- Available since: 2.11.0
setAudioReceiveRange
public void setAudioReceiveRange(float range)ZegoRangeAudio.javaParameters
| 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.
setPositionUpdateFrequency
public void setPositionUpdateFrequency(int frequency)ZegoRangeAudio.javaParameters
| Name | Type | Description |
|---|---|---|
| frequency | int | the frequency, the value must be greater than 15 ms. |
Details
Set the frequency of real-time update locations within the SDK min 15 ms. Use case: After setting the update position, the sensitivity of audio gradient is very high.
- Default value: 100 ms.
- When to call: After initializing the range audio [createRangeAudio].
- Available since: 2.21.0
setRangeAudioVolume
public void setRangeAudioVolume(int volume)ZegoRangeAudio.javaParameters
| 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
setStreamVocalRange
public void setStreamVocalRange(String streamID, float vocalRange)ZegoRangeAudio.javaParameters
| Name | Type | Description |
|---|---|---|
| streamID | String | play stream id |
| vocalRange | float | 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: 2.23.0
updateStreamPosition
public void updateStreamPosition(String streamID, float[] position)ZegoRangeAudio.javaParameters
| Name | Type | Description |
|---|---|---|
| streamID | String | play stream id. |
| 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. The three values represent the front, right, and top coordinate values in turn. |
Details
Set range voice volume. Use case: When the user calls [startPlayingStream] to pull another stream, call [setStreamVocalRange] to set the stream's voice position, then call this interface to set the stream's position, so that the stream also has the range voice effect.
- When to call: After initializing the range audio [createRangeAudio] and after [startPlayingStream].
- Available since: 2.23.0
updateSelfPosition
public void updateSelfPosition(float[] position, float[] axisForward, float[] axisRight, float[] axisUp)ZegoRangeAudio.javaParameters
| 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
updateAudioSource
public void updateAudioSource(String userID, float[] position)ZegoRangeAudio.javaParameters
| 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
enableSpatializer
public void enableSpatializer(boolean enable)ZegoRangeAudio.javaParameters
| Name | Type | Description |
|---|---|---|
| enable | boolean | 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
enableMicrophone
public void enableMicrophone(boolean enable)ZegoRangeAudio.javaParameters
| Name | Type | Description |
|---|---|---|
| enable | boolean | 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 void enableSpeaker(boolean enable)ZegoRangeAudio.javaParameters
| Name | Type | Description |
|---|---|---|
| enable | boolean | 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 void setRangeAudioMode(ZegoRangeAudioMode mode)ZegoRangeAudio.javaParameters
| 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 void setRangeAudioCustomMode(ZegoRangeAudioSpeakMode speakMode, ZegoRangeAudioListenMode listenMode)ZegoRangeAudio.javaParameters
| 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 void setTeamID(String teamID)ZegoRangeAudio.javaParameters
| 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 void muteUser(String userID, boolean mute)ZegoRangeAudio.javaParameters
| Name | Type | Description |
|---|---|---|
| userID | String | User ID. |
| mute | boolean | 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
ZegoRealTimeSequentialDataManager
Declared in ZegoRealTimeSequentialDataManager.java
Methods
setEventHandler
public void setEventHandler(IZegoRealTimeSequentialDataEventHandler handler)ZegoRealTimeSequentialDataManager.javaParameters
| Name | Type | Description |
|---|---|---|
| handler | IZegoRealTimeSequentialDataEventHandler | Event handler for real-time sequential data |
Details
Set up real-time sequential data callback to monitor callbacks such as sending data results, receiving data, etc.
- When to call: After create the [ZegoRealTimeSequentialDataManager] instance.
- Caution: Calling this function will overwrite the callback set by the last call to this function.
- Available since: 2.14.0
- Restrictions: None.
startBroadcasting
public void startBroadcasting(String streamID)ZegoRealTimeSequentialDataManager.javaParameters
| 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: None.
stopBroadcasting
public void stopBroadcasting(String streamID)ZegoRealTimeSequentialDataManager.javaParameters
| 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: None.
sendRealTimeSequentialData
public void sendRealTimeSequentialData(byte[] data, String streamID, IZegoRealTimeSequentialDataSentCallback callback)ZegoRealTimeSequentialDataManager.javaParameters
| Name | Type | Description |
|---|---|---|
| data | byte[] | The real-time sequential data to be sent. |
| streamID | String | The stream ID to which the real-time sequential data is sent. |
| callback | IZegoRealTimeSequentialDataSentCallback | 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: None.
startSubscribing
public void startSubscribing(String streamID)ZegoRealTimeSequentialDataManager.javaParameters
| 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: None.
stopSubscribing
public void stopSubscribing(String streamID)ZegoRealTimeSequentialDataManager.javaParameters
| 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: None.
getIndex
public int getIndex()ZegoRealTimeSequentialDataManager.javaIndex of the real-time sequential data manager.
ZegoRect
View related coordinates.
Declared in entity/ZegoRect.java
Properties
x
public int xThe horizontal offset from the top-left corner
y
public int yThe vertical offset from the top-left corner
width
public int widthThe width of the rectangle
height
public int heightThe height of the rectangle
Methods
ZegoRect
ZegoReverbAdvancedParam
Audio reverberation advanced parameters.
Details
Developers can use the SDK's built-in presets to change the parameters of the reverb.
Declared in entity/ZegoReverbAdvancedParam.java
Properties
roomSize
public float roomSizeRoom size(%), in the range [0.0, 1.0], to control the size of the "room" in which the reverb is generated, the larger the room, the stronger the reverb.
reverberance
public float reverberanceEcho(%), in the range [0.0, 100.0], to control the trailing length of the reverb.
damping
public float dampingReverb Damping(%), range [0.0, 100.0], controls the attenuation of the reverb, the higher the damping, the higher the attenuation.
wetOnly
public boolean wetOnlyonly wet
wetGain
public float wetGainwet gain(dB), range [-20.0, 10.0]
dryGain
public float dryGaindry gain(dB), range [-20.0, 10.0]
toneLow
public float toneLowTone Low. 100% by default
toneHigh
public float toneHighTone High. 100% by default
preDelay
public float preDelayPreDelay(ms), range [0.0, 200.0]
stereoWidth
public float stereoWidthStereo Width(%). 0% by default
Methods
ZegoReverbAdvancedParam
public ZegoReverbAdvancedParamentity/ZegoReverbAdvancedParam.javaZegoReverbEchoParam
Audio reverberation echo parameters.
Declared in entity/ZegoReverbEchoParam.java
Properties
inGain
public float inGainGain of input audio signal, in the range [0.0, 1.0]
outGain
public float outGainGain of output audio signal, in the range [0.0, 1.0]
numDelays
public int numDelaysNumber of echos, in the range [0, 7]
delay
public int[] delayRespective delay of echo signal, in milliseconds, in the range [0, 5000] ms
decay
public float[] decayRespective decay coefficient of echo signal, in the range [0.0, 1.0]
ZegoRoiRect
Coordinates used by the ROI function.
Declared in entity/ZegoRoiRect.java
Properties
x
public int xThe horizontal offset from the top-left corner
y
public int yThe vertical offset from the top-left corner
width
public int widthThe width of the rectangle
height
public int heightThe height of the rectangle
strength
public int strengthROI strength, currently supported value range is [0, 4], 0 is no effect, 4 is the strongest.
ZegoRoomConfig
Advanced room configuration.
Details
Configure maximum number of users in the room and authentication token, etc.
Declared in entity/ZegoRoomConfig.java
Properties
maxMemberCount
public int maxMemberCountThe maximum number of users in the room, Passing 0 means unlimited, the default is unlimited.
isUserStatusNotify
public boolean isUserStatusNotifyWhether to enable the user in and out of the room callback notification [onRoomUserUpdate], the default is off. If developers need to use ZEGO Room user notifications, make sure that each user who login sets this flag to true
token
public String tokenThe token issued by the developer's business server is used to ensure security. For the generation rules, please refer to Using Token Authentication, the default is an empty string, that is, no authentication. In versions 2.17.0 and above, if appSign is not passed in when calling the [createEngine] API to create an engine, or if appSign is empty, this parameter must be set for authentication when logging in to a room.
capabilityNegotiationTypes
public int capabilityNegotiationTypesThe bitmask marker for capability negotiation, refer to enum [ZegoRoomCapabilityNegotiationTypesBitMask], when this param converted to binary, 0b01 that means 1 << 0 for enable the capability negotiation of all user in the room, 0x10 that means 1 << 1 for enable the capability negotiation of publisher in the room. The masks can be combined to allow different types of capability negotiation.
roomType
public int roomTypeThe type of the room, generally, it can be ignored and set to 0.
Methods
ZegoRoomConfig
ZegoRoomExtraInfo
Room extra information.
Declared in entity/ZegoRoomExtraInfo.java
Properties
key
public String keyThe key of the room extra information.
value
public String valueThe value of the room extra information.
updateUser
public ZegoUser updateUserThe user who update the room extra information.Please do not fill in sensitive user information in this field, including but not limited to mobile phone number, ID number, passport number, real name, etc.
updateTime
public long updateTimeUpdate time of the room extra information, UNIX timestamp, in milliseconds.
ZegoRoomRecvTransparentMessage
Received a transparent message from the room.
Details
Room transparent message, including message content, sending user, sending type, sending mode
Declared in entity/ZegoRoomRecvTransparentMessage.java
Properties
sendUser
content
public byte[] contentMessage send content.
ZegoRoomSendTransparentMessage
Transparent message info.
Details
Room transparent message, including room id, message content, sending user, sending type, sending mode, timeout period
Declared in entity/ZegoRoomSendTransparentMessage.java
Properties
sendMode
sendType
content
public byte[] contentMessage send content.
recvUserList
public ArrayList<ZegoUser> recvUserListMessage receiver list, when sendType appointed ZegoRoomTransparentMessageModeOnlyServer don't fill in. When appointed ZegoRoomTransparentMessageModeClientAndServer or ZegoRoomTransparentMessageModeOnlyClient, empty room will be sent to all online users.
timeOut
public int timeOutsend message timeout, The default value is 10s.
ZegoRoomStreamList
Room stream list.
Details
Room stream list.
Declared in entity/ZegoRoomStreamList.java
Properties
publishStreamList
playStreamList
ZegoRtcStatsInfo
RTC Network Statistics
Declared in entity/ZegoRtcStatsInfo.java
Properties
totalTxBandwidth
public double totalTxBandwidthtotal upstream bandwidth, in kbps
avgTxRtt
public int avgTxRttupstream average rtt, in milliseconds
avgTxPacketLostRate
public double avgTxPacketLostRateupstream average packet lost rate. in percentage, 0.0 ~ 1.0
totalRxBandwidth
public double totalRxBandwidthtotal downlink bandwidth, in kbps
avgRxRtt
public int avgRxRttdownlink average rtt, in milliseconds
avgRxPacketLostRate
public double avgRxPacketLostRatedownlink average packet lost rate. in percentage, 0.0 ~ 1.0
avgPeerToPeerDelay
public int avgPeerToPeerDelayaverage peer to peer delay, in milliseconds
ZegoSEIConfig
SEI configuration
Details
Used to set the relevant configuration of the Supplemental Enhancement Information.
Declared in entity/ZegoSEIConfig.java
Properties
type
Methods
ZegoSEIConfig
ZegoSoundLevelConfig
Configuration for start sound level monitor.
Declared in entity/ZegoSoundLevelConfig.java
Properties
millisecond
public int millisecondMonitoring time period of the sound level, in milliseconds, has a value range of [100, 3000]. Default is 100 ms.
enableVAD
public boolean enableVADSet whether the sound level callback includes the VAD detection result.
ZegoSoundLevelInfo
Sound level info object.
Declared in entity/ZegoSoundLevelInfo.java
Properties
soundLevel
public float soundLevelSound level value.
vad
public int vadWhether the stream corresponding to StreamID contains voice, 0 means noise, 1 means normal voice. This value is valid only when the [enableVAD] parameter in the [ZegoSoundLevelConfig] configuration is set to true when calling [startSoundLevelMonitor].
ZegoStream
Stream object.
Details
Identify an stream object
Declared in entity/ZegoStream.java
Properties
user
public ZegoUser userUser object instance.Please do not fill in sensitive user information in this field, including but not limited to mobile phone number, ID number, passport number, real name, etc.
streamID
public String streamID- Caution: You cannot include URL keywords, otherwise publishing stream and playing stream will fails. Only support numbers, English characters and '-', '_'.
extraInfo
public String extraInfoStream extra info
ZegoStreamRelayCDNInfo
Relay to CDN info.
Details
Including the URL of the relaying CDN, relaying state, etc.
Declared in entity/ZegoStreamRelayCDNInfo.java
Properties
url
public String urlURL of publishing stream to CDN
state
updateReason
stateTime
public long stateTimeThe timestamp when the state changed, UNIX timestamp, in milliseconds.
ZegoSwitchPlayingStreamConfig
Extended parameters for the [switchPlayingStream] interface.
Details
Extended parameters for the [switchPlayingStream] interface.
Declared in entity/ZegoSwitchPlayingStreamConfig.java
Properties
switchType
switchTimeout
public int switchTimeoutSwitch the stream timeout, the unit is seconds.
ZegoTestNetworkConnectivityResult
test connectivity result
Declared in entity/ZegoTestNetworkConnectivityResult.java
Properties
connectCost
public int connectCostconnect cost
ZegoTrafficControlInfo
Externally encoded data traffic control information.
Declared in entity/ZegoTrafficControlInfo.java
Properties
width
public int widthVideo resolution width to be adjusted
height
public int heightVideo resolution height to be adjusted
fps
public int fpsVideo FPS to be adjusted
bitrate
public int bitrateVideo bitrate in kbps to be adjusted
ZegoUser
User object.
Details
Configure user ID and username to identify users in the room. that the userID must be unique under the same appID, otherwise, there will be mutual kicks when logging in to the room. It is strongly recommended that userID corresponds to the user ID of the business APP, that is, a userID and a real user are fixed and unique, and should not be passed to the SDK in a random userID. Because the unique and fixed userID allows ZEGO technicians to quickly locate online problems.
Declared in entity/ZegoUser.java
Properties
userID
public String userID- Privacy reminder: Please do not fill in sensitive user information in this field, including but not limited to mobile phone number, ID number, passport number, real name, etc.
- Caution: Only support numbers, English characters and '~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', '=', '-', '`', ';', '’', ',', '.', '<', '>', ''. Do not use '%' if you need to communicate with the Web SDK.
userName
public String userNameUser Name, a utf8 string with a maximum length of 256 bytes or less.Please do not fill in sensitive user information in this field, including but not limited to mobile phone number, ID number, passport number, real name, etc.
Methods
ZegoUser
ZegoUser
ZegoVideoConfig
Video config.
Details
Configure parameters used for publishing stream, such as bitrate, frame rate, and resolution. Developers should note that the width and height resolution of the mobile and desktop are opposite. For example, 360p, the resolution of the mobile is 360x640, and the desktop is 640x360. When using external capture, the capture and encoding resolution of RTC cannot be set to 0*0, otherwise, there will be no video data in the publishing stream in the entire engine life cycle.
Declared in entity/ZegoVideoConfig.java
Properties
captureWidth
public int captureWidthCapture resolution width, control the width of camera image acquisition. SDK requires this member to be set to an even number. Only the camera is not started and the custom video capture is not used, the setting is effective. For performance reasons, the SDK scales the video frame to the encoding resolution after capturing from camera and before rendering to the preview view. Therefore, the resolution of the preview image is the encoding resolution. If you need the resolution of the preview image to be this value, Please call [setCapturePipelineScaleMode] first to change the capture pipeline scale mode to [Post]
captureHeight
public int captureHeightCapture resolution height, control the height of camera image acquisition. SDK requires this member to be set to an even number. Only the camera is not started and the custom video capture is not used, the setting is effective. For performance reasons, the SDK scales the video frame to the encoding resolution after capturing from camera and before rendering to the preview view. Therefore, the resolution of the preview image is the encoding resolution. If you need the resolution of the preview image to be this value, Please call [setCapturePipelineScaleMode] first to change the capture pipeline scale mode to [Post]
encodeWidth
public int encodeWidthEncode resolution width, control the image width of the encoder when publishing stream. SDK requires this member to be set to an even number. The settings before and after publishing stream can be effective
encodeHeight
public int encodeHeightEncode resolution height, control the image height of the encoder when publishing stream. SDK requires this member to be set to an even number. The settings before and after publishing stream can be effective
fps
public int fpsFrame rate, control the frame rate of the camera and the frame rate of the encoder. Publishing stream set to 60 fps, playing stream to take effect need contact technical support
bitrate
public int bitrateBit rate in kbps. The settings before and after publishing stream can be effective. The SDK will automatically set the bit rate suitable for the scenario selected by the developer. If the bit rate manually set by the developer exceeds the reasonable range, the SDK will automatically process the bit rate according to the reasonable range. If you need to configure a high bit rate due to business needs, please contact ZEGO Business.
codecID
public ZegoVideoCodecID codecIDThe codec id to be used, the default value is [default]. Settings only take effect before publishing stream
keyFrameInterval
public int keyFrameInterval- Required: No.
- Default value: 2 seconds.
- Value range: [2, 5].
- Caution: The setting is only valid before pushing.
Methods
ZegoVideoConfig
public ZegoVideoConfig(ZegoVideoConfigPreset preset)entity/ZegoVideoConfig.javaZegoVideoConfig
public ZegoVideoConfigentity/ZegoVideoConfig.java360p, 15fps, 600kbps
setCaptureResolution
public void setCaptureResolution(int width, int height)entity/ZegoVideoConfig.javasetEncodeResolution
public void setEncodeResolution(int width, int height)entity/ZegoVideoConfig.javasetVideoFPS
public void setVideoFPS(int fps)entity/ZegoVideoConfig.javasetVideoBitrate
public void setVideoBitrate(int bitrate)entity/ZegoVideoConfig.javasetCodecID
public void setCodecID(ZegoVideoCodecID codecID)entity/ZegoVideoConfig.javaZegoVideoEncodedFrameParam
Object for video encoded frame fieldeter.
Details
Including video encoded frame format, width and height, etc.
Declared in entity/ZegoVideoEncodedFrameParam.java
Properties
format
isKeyFrame
public boolean isKeyFrameWhether it is a keyframe
rotation
public int rotationVideo frame counterclockwise rotation angle
width
public int widthVideo frame width
height
public int heightVideo frame height
SEIData
public ByteBuffer SEIDataSEI data (Optional, if you don't need to send SEI, set it to null. Deprecated, use [sendSEI] instead). Useful when set format as [AVCC] or [AnnexB]
SEIDataLength
public int SEIDataLengthLength of the SEI data (Optional, if you don't need to send SEI, set it to 0. Deprecated, use [sendSEI] instead). Useful when set format as [AVCC] or [AnnexB]
isExternalClock
public boolean isExternalClockWhether to use the external timestamp completely. The default is false. When set to false, the SDK will adjust based on the timestamps of the audio frame and video frame to ensure audio-video synchronization. When set to true, the SDK does not adjust the timestamp and uses the external timestamp completely.
ZegoVideoFrameParam
Object for video frame fieldeter.
Details
Including video frame format, width and height, etc.
Declared in entity/ZegoVideoFrameParam.java
Properties
format
strides
final public int[] stridesNumber of bytes per line (for example: BGRA only needs to consider strides [0], I420 needs to consider strides [0,1,2])
width
public int widthVideo frame width. When use custom video capture, the video data meeting the 32-bit alignment can obtain the maximum performance. Taking BGRA as an example, width * 4 is expected to be multiple of 32.
height
public int heightVideo frame height
rotation
public int rotationThe rotation direction of the video frame, the SDK rotates clockwise
ZegoVoiceChangerParam
Voice changer parameter.
Details
Developer can use the built-in presets of the SDK to change the parameters of the voice changer.
Declared in entity/ZegoVoiceChangerParam.java
Properties
pitch
public float pitchPitch parameter, value range [-12.0, 12.0], the larger the value, the sharper the sound, set it to 0.0 to turn off. that on v2.18.0 and older version, the value range is [-8.0, 8.0].
Methods
ZegoVoiceChangerParam
ZegoWatermark
Watermark object.
Details
Configure a watermark image URL and the layout of the watermark in the screen.
Declared in entity/ZegoWatermark.java
Properties
imageURL
public String imageURLThe path of the watermark image. Support local file absolute path (file://xxx), Asset resource path (asset://xxx) and Android URI path (String path = "uri://" + uri.toString();). The format supports png, jpg. The maximum length is less than 512 bytes.
layout
Methods
ZegoWatermark
public ZegoWatermark(String imageURL, ZegoRect layout)entity/ZegoWatermark.java