AgoraAudioFrameDelegate
The audio frame observer.
You can call setAudioFrameDelegate to register or unregister the AgoraAudioFrameDelegate audio frame observer.
onEarMonitoringAudioFrame
Gets the in-ear monitoring audio frame.
- (BOOL)onEarMonitoringAudioFrame:(AgoraAudioFrame* _Nonnull)frame;
- Before joining the channel, you need to call the setAudioFrameDelegate to register audio observer object, that is, register the onEarMonitoringAudioFrame callback.
- In order to ensure that the obtained in-ear audio data meets the expectations, Agora recommends that you choose one of the following two methods to set the in-ear monitoring-ear audio data format:
- If you call setEarMonitoringAudioFrameParametersWithSampleRate to set the acquired audio data format, the SDK calculates the sampling interval according to the parameters in this method, and triggers the onEarMonitoringAudioFrame callback according to the sampling interval.
- If you set the acquired audio data format in the return value of the getEarMonitoringAudioParams callback, the SDK calculates the sampling interval according to the return value of the callback, and trigger the onEarMonitoringAudioFrame callback according to the sampling interval.
Parameters
- frame
- The raw audio data. See AgoraAudioFrame.
Returns
Reserved for future use.
onMixedAudioFrame
Retrieves the mixed captured and playback audio frame.
- (BOOL)onMixedAudioFrame:(AgoraAudioFrame* _Nonnull)frame;
- Before joining the channel, you need to call the setAudioFrameDelegate to register audio observer object, that is, register the onMixedAudioFrame callback.
- This callback only reports single-channel data.
- To ensure that the data format of mixed captured and playback audio frame meets the expectations, Agora recommends that you choose one of the following two ways to set the data format:
- If you call setMixedAudioFrameParametersWithSampleRate to set the audio data format, the SDK calculates the sampling interval according to the parameters in this method, and triggers the onMixedAudioFrame callback according to the sampling interval.
- If you set the audio data format in the return value of the getMixedAudioParams callback, the SDK calculates the sampling interval according to the return value of the callback, and triggers the onMixedAudioFrame callback according to the sampling interval.
Parameters
- frame
- The raw audio data. See AgoraAudioFrame.
Returns
Reserved for future use.
onPlaybackAudioFrame
Gets the raw audio frame for playback.
- (BOOL)onPlaybackAudioFrame:(AgoraAudioFrame* _Nonnull)frame;
- Before joining the channel, you need to call the setAudioFrameDelegate to register audio observer object, that is, register the onPlaybackAudioFrame callback.
- To ensure that the data format of audio frame for playback is as expected, Agora recommends that you choose one of the following two methods to set the audio data format:
- If you call setPlaybackAudioFrameParametersWithSampleRate to set the audio data format, the SDK calculates the sampling interval according to the parameters in this method, and triggers the onPlaybackAudioFrame callback according to the sampling interval.
- If you set the audio data format in the return value of the getPlaybackAudioParams callback, the SDK calculates the sampling interval according to the return value of the callback, and triggers the onPlaybackAudioFrame callback according to the sampling interval.
Parameters
- frame
- The raw audio data. See AgoraAudioFrame.
Returns
Reserved for future use.
onPlaybackAudioFrameBeforeMixing
Retrieves the audio frame of a specified user before mixing.
- (BOOL)onPlaybackAudioFrameBeforeMixing:(AgoraAudioFrame* _Nonnull)frame uid:(NSUInteger)uid;
Parameters
- uid
- The user ID of the specified user.
- frame
- The raw audio data. See AgoraAudioFrame.
Returns
Reserved for future use.
onRecordAudioFrame
Gets the captured audio frame.
- (BOOL)onRecordAudioFrame:(AgoraAudioFrame* _Nonnull)frame;
- Before joining the channel, you need to call the setAudioFrameDelegate to register audio observer object, that is, register the onRecordAudioFrame callback.
- To ensure that the data format of captured audio frame is as expected, Agora recommends that you choose one of the following two methods to set the audio data format:
- If you call setRecordingAudioFrameParametersWithSampleRate to set the acquired audio data format, the SDK calculates the sampling interval according to the parameters in this method, and triggers the onRecordAudioFrame callback according to the sampling interval.
- If you set the acquired audio data format in the return value of the getRecordAudioParams callback, the SDK calculates the sampling interval according to the return value of the callback, and trigger the onRecordAudioFrame callback according to the sampling interval.
Parameters
- frame
- The raw audio data. See AgoraAudioFrame.
Returns
Reserved for future use.
getRecordAudioParams
Sets the audio format for the onRecordAudioFrame callback.
- (AgoraAudioParams* _Nonnull)getRecordAudioParams NS_SWIFT_NAME(getRecordAudioParams());
You need to register the callback when calling the setAudioFrameDelegate method. After you successfully register the audio observer, the SDK triggers this callback, and you can set the audio format in the return value of this callback.
The SDK triggers the onRecordAudioFrame callback with the AgoraAudioParams calculated sampling interval you set in the return value. The calculation formula is Sample interval (sec) = samplePerCall/(sampleRate × channel).
Ensure that the sample interval ≥ 0.01 (s).
Returns
The captured audio data, see AgoraAudioParams.
getMixedAudioParams
Sets the audio format for the onMixedAudioFrame callback.
- (AgoraAudioParams* _Nonnull)getMixedAudioParams NS_SWIFT_NAME(getMixedAudioParams());
You need to register the callback when calling the setAudioFrameDelegate method. After you successfully register the audio observer, the SDK triggers this callback, and you can set the audio format in the return value of this callback.
The SDK triggers the onMixedAudioFrame callback with the AgoraAudioParams calculated sampling interval you set in the return value. The calculation formula is Sample interval (sec) = samplePerCall/(sampleRate × channel).
Ensure that the sample interval ≥ 0.01 (s).
Returns
The mixed captured and playback audio data. See AgoraAudioParams.
getPlaybackAudioParams
Sets the audio format for the onPlaybackAudioFrame callback.
- (AgoraAudioParams* _Nonnull)getPlaybackAudioParams NS_SWIFT_NAME(getPlaybackAudioParams());
You need to register the callback when calling the setAudioFrameDelegate method. After you successfully register the audio observer, the SDK triggers this callback, and you can set the audio format in the return value of this callback.
The SDK triggers the onPlaybackAudioFrame callback with the AgoraAudioParams calculated sampling interval you set in the return value. The calculation formula is Sample interval (sec) = samplePerCall/(sampleRate × channel).
Ensure that the sample interval ≥ 0.01 (s).
Returns
The audio data for playback, see AgoraAudioParams.
getEarMonitoringAudioParams
Sets the audio format for the onEarMonitoringAudioFrame callback.
- (AgoraAudioParams* _Nonnull)getEarMonitoringAudioParams NS_SWIFT_NAME(getEarMonitoringAudioParams());
- Since
- v4.0.1
You need to register the callback when calling the setAudioFrameDelegate method. After you successfully register the audio observer, the SDK triggers this callback, and you can set the audio format in the return value of this callback.
The SDK triggers the onEarMonitoringAudioFrame callback with the AgoraAudioParams calculated sampling interval you set in the return value. The calculation formula is Sample interval (sec) = samplePerCall/(sampleRate × channel).
Ensure that the sample interval ≥ 0.01 (s).
Returns
The audio data of in-ear monitoring, see AgoraAudioParams.