On this page

ZegoCustomAudioSource

2026-08-04

ZegoCustomAudioSource

Declared in ZegoCustomAudioSource.java

Methods

getIndex

getIndex
public int getIndex()
Get custom audio source instance index.
Declared in ZegoCustomAudioSource.java

Custom audio source instance index.

startCapture

startCapture
public int startCapture()
Start custom audio source capture.
Declared in ZegoCustomAudioSource.java

Start 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.java

Stop 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.java

Parameters

NameTypeDescription
enablebooleanWhether 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.java

Parameters

NameTypeDescription
volumeintVolume, 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.java

Parameters

NameTypeDescription
mutebooleanWhether 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.java

Parameters

NameTypeDescription
dataByteBufferPCM buffer data. Note that it must be a DirectByteBuffer, which can be constructed by allocateDirect().
dataLengthintThe total length of the buffer data.
paramZegoAudioFrameParamThe 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.

Previous

zegocustomaudioprocessconfig

Next

zegocustomplayerresourceconfig

On this page

Back to top