setPlaybackAudioFrameParameters abstract method
Future<void>
setPlaybackAudioFrameParameters({
- required int sampleRate,
- required int channel,
- required RawAudioFrameOpModeType mode,
- required int samplesPerCall,
Sets the format of the raw audio data for playback.
The SDK calculates the sampling interval using the samplesPerCall, sampleRate, and channel parameters in this method. The formula is: sampling interval = samplesPerCall / (sampleRate × channel). Ensure the sampling interval is no less than 0.01 seconds. The SDK triggers the onPlaybackAudioFrame callback based on this interval.
sampleRateThe sample rate (Hz) of the audio data. You can set it to 8000, 16000, 24000, 32000, 44100, or 48000.channelThe number of audio channels. You can set it to 1 or 2: 1: Mono. 2: Stereo.modeThe usage mode of the audio frame. See RawAudioFrameOpModeType.samplesPerCallThe number of audio samples per call. Typically 1024 in scenarios like RTMP streaming.
Returns This method returns no value if the call succeeds. If the method call fails, it throws an AgoraRtcException, which you need to catch and handle. See Error Codes for details and troubleshooting suggestions. < 0: Failure. See Error Codes for details and troubleshooting suggestions.
Implementation
Future<void> setPlaybackAudioFrameParameters(
{required int sampleRate,
required int channel,
required RawAudioFrameOpModeType mode,
required int samplesPerCall});