Public Member Functions

abstract boolean onRecordFrame (byte[] samples, int numOfSamples, int bytesPerSample, int channels, int samplesPerSec)
 
abstract boolean onPlaybackFrame (byte[] samples, int numOfSamples, int bytesPerSample, int channels, int samplesPerSec)
 

Detailed Description

Callbacks of the raw audio data (IAudioFrameObserver).

Member Function Documentation

◆ onRecordFrame()

abstract boolean io.agora.rtc.IAudioFrameObserver.onRecordFrame ( byte []  samples,
int  numOfSamples,
int  bytesPerSample,
int  channels,
int  samplesPerSec 
)
abstract

Occurs when the recorded audio frame is received.

Parameters
samplesSample data of the frame.
numOfSamplesNumber of samples.
bytesPerSampleNumber of bytes per audio sample. For example, each PCM audio sample usually takes up 16 bits (2 bytes).
channelsNumber of audio channels. If the channel uses stereo, the data is interleaved.
  • 1: Mono.
  • 2: Stereo.
samplesPerSecSample rate of the audio frame. samplesPerCall = (int)(samplesPerSec × sampleInterval × numChannels), where sampleInterval ≥ 0.01 in seconds.
Returns
  • true: The recorded audio frame is valid and is encoded and sent.
  • false: The recorded audio frame is invalid and is not encoded or sent.

◆ onPlaybackFrame()

abstract boolean io.agora.rtc.IAudioFrameObserver.onPlaybackFrame ( byte []  samples,
int  numOfSamples,
int  bytesPerSample,
int  channels,
int  samplesPerSec 
)
abstract

Occurs when the playback audio frame is received.

Parameters
samplesSample data of the frame.
numOfSamplesNumber of samples.
bytesPerSampleNumber of bytes per audio sample. For example, each PCM audio sample usually takes up 16 bits (2 bytes).
channelsNumber of audio channels. If the channel uses stereo, the data is interleaved.
  • 1: Mono.
  • 2: Stereo.
samplesPerSecSample rate of the audio frame. samplesPerCall = (int)(samplesPerSec × sampleInterval × numChannels), where sampleInterval ≥ 0.01 in seconds.
Returns
  • true: The playback audio frame is valid and is encoded and sent.
  • false: The playback audio frame is invalid and is not encoded or sent.