ZegoCustomAudioSource
2026-08-04
ZegoCustomAudioSource
Declared in ZegoCustomAudioSource.java
Methods
getIndex
getIndex
public int getIndex()Get custom audio source instance index.
Declared in
ZegoCustomAudioSource.javaCustom audio source instance index.
startCapture
startCapture
public int startCapture()Start custom audio source capture.
Declared in
ZegoCustomAudioSource.javaStart custom audio source capture.
- Use cases: Typically used in educational scenarios that require switching between different audio capture sources.
- When to call: After the custom audio source is created by [createCustomAudioSource].
- Caution: ZegoCustomAudioSource can only be used as a mix source, not as the main capture source.
- Available since: 3.25.0
- Restrictions: None.
The result of the API call.
stopCapture
stopCapture
public int stopCapture()Stop custom audio source capture.
Declared in
ZegoCustomAudioSource.javaStop custom audio source capture.
- Use cases: Typically used in educational scenarios that require switching between different audio capture sources.
- When to call: After the custom audio source is created by [createCustomAudioSource].
- Caution: ZegoCustomAudioSource can only be used as a mix source, not as the main capture source.
- Available since: 3.25.0
- Restrictions: None.
The result of the API call.
enableAEC
enableAEC
public int enableAEC(boolean enable)Enable custom audio source echo cancellation.
Declared in
ZegoCustomAudioSource.javaParameters
| Name | Type | Description |
|---|---|---|
| enable | boolean | Whether to enable echo cancellation. |
Details
Enable custom audio source echo cancellation.
- Use cases: Typically used in educational scenarios that require switching between different audio capture sources.
- When to call: After the custom audio source is created by [createCustomAudioSource].
- Caution: ZegoCustomAudioSource can only be used as a mix source, not as the main capture source.
- Available since: 3.25.0
- Restrictions: None.
Return
The result of the API call.
setVolume
setVolume
public int setVolume(int volume)Set custom audio source volume.
Declared in
ZegoCustomAudioSource.javaParameters
| Name | Type | Description |
|---|---|---|
| volume | int | Volume, the range is 0 ~ 100. |
Details
Set the volume of the custom audio source.
- Use cases: Typically used in scenarios that require switching between different audio capture sources.
- When to call: After the custom audio source is created by [createCustomAudioSource].
- Caution: ZegoCustomAudioSource can only be used as a mix source, not as the main capture source.
- Available since: 3.25.0
- Restrictions: The volume range is 0 ~ 100.
Return
The result of the API call.
mute
mute
public int mute(boolean mute)Mute or unmute the custom audio source.
Declared in
ZegoCustomAudioSource.javaParameters
| Name | Type | Description |
|---|---|---|
| mute | boolean | Whether to mute the custom audio source. |
Details
Mute or unmute the audio data of the custom audio source.
- Use cases: Typically used in scenarios that require switching between different audio capture sources.
- When to call: After the custom audio source is created by [createCustomAudioSource].
- Caution: ZegoCustomAudioSource can only be used as a mix source, not as the main capture source.
- Available since: 3.25.0
- Restrictions: None.
Return
The result of the API call.
pushAudioFrame
pushAudioFrame
public int pushAudioFrame(ByteBuffer data, int dataLength, ZegoAudioFrameParam param)Push audio frame to the custom audio source.
Declared in
ZegoCustomAudioSource.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
Push audio frame to the custom audio source.
- Use cases: Typically used when developers manage audio data capture themselves and input audio frames to a specified custom audio source.
- When to call: After the custom audio source is created by [createCustomAudioSource].
- Caution: ZegoCustomAudioSource can only be used as a mix source, not as the main capture source.
- Available since: 3.25.0
- Restrictions: None.
Return
The result of the API call.
