Encoded Audio Data
registerAudioEncodedFrameObserver
Registers an observer for encoded audio data.
public abstract int registerAudioEncodedFrameObserver(AudioEncodedFrameObserverConfig config, IAudioEncodedFrameObserver observer);
startAudioRecording to configure the recording type and quality of the audio file, but using both is not recommended. Only the method called last takes effect.Parameters
- config
- Configuration for the encoded audio observer. See AudioEncodedFrameObserverConfig.
- observer
- The observer for encoded audio data. See IAudioEncodedFrameObserver.
Return Values
- 0: Success.
- < 0: Failure.
onMixedAudioEncodedFrame
Callback for mixed encoded audio data of the local and all remote users.
public abstract void onMixedAudioEncodedFrame(ByteBuffer buffer, int samplesPerChannel, int channels, int samplesPerSec, int codecType);
After calling registerAudioEncodedFrameObserver and setting the audio configuration to AUDIO_ENCODED_FRAME_OBSERVER_POSITION_MIXED, you can use this callback to retrieve mixed encoded audio data.
Parameters
- buffer
- Audio buffer.
- samplesPerChannel
- Number of samples per channel.
- channels
- Number of channels:
- 1: Mono.
- 2: Stereo. If stereo, the data is interleaved.
- samplesPerSec
- Recording sample rate (Hz).
- codecType
- Audio codec type:
- 1: OPUS.
- 8: LC-AAC.
- 9: HE-AAC.
- 11: HE-AAC v2.
onPlaybackAudioEncodedFrame
Callback for retrieving encoded audio data of all remote users.
public abstract void onPlaybackAudioEncodedFrame(ByteBuffer buffer, int samplesPerChannel, int channels, int samplesPerSec, int codecType);
After calling registerAudioEncodedFrameObserver and setting the encoded audio to AUDIO_ENCODED_FRAME_OBSERVER_POSITION_PLAYBACK, you can use this callback to retrieve encoded audio data of all remote users.
Trigger Timing
This callback is triggered when encoded audio data of remote users is received.
Parameters
- buffer
- Audio buffer.
- samplesPerChannel
- Number of samples per channel.
- channels
- Number of channels:
- 1: Mono.
- 2: Stereo. If stereo, the data is interleaved.
- samplesPerSec
- Recording sample rate (Hz).
- codecType
- Audio codec type:
1: OPUS.8: LC-AAC.9: HE-AAC.11: HE-AAC v2.
onRecordAudioEncodedFrame
Callback for encoded audio data of the local user.
public abstract void onRecordAudioEncodedFrame(ByteBuffer buffer, int samplesPerChannel, int channels, int samplesPerSec, int codecType);
After calling registerAudioEncodedFrameObserver and setting the encoded audio to AUDIO_ENCODED_FRAME_OBSERVER_POSITION_MIC, you can use this callback to retrieve the encoded audio data of the local user.
Parameters
- buffer
- Audio buffer.
- samplesPerChannel
- Number of samples per channel in the audio frame.
- channels
- Number of channels:
- 1: Mono.
- 2: Stereo. If stereo, the data is interleaved.
- samplesPerSec
- Recording sample rate (Hz).
- codecType
- Audio codec type:
1: OPUS.8: LC-AAC.9: HE-AAC.11: HE-AAC v2.