Agora C++ API Reference for All Platforms

Loading...
Searching...
No Matches
Public Member Functions | List of all members
agora::rtc::IMediaRecorderEx Class Referenceabstract

`#include <media_recorder_i.h>`

Inherits agora::rtc::IAVDataObserver, agora::media::IAudioFrameObserver, and agora::media::IVideoEncodedFrameObserver.

## Public Member Functions
virtual int | startRecording (const media::MediaRecorderConfiguration &config)=0
virtual int | stopRecording ()=0
virtual void | release ()=0
virtual void | setMediaRecorderObserver (media::IMediaRecorderObserverEx *observer)=0
virtual void | setSysVersion (int sys_version)=0
bool | onPlaybackAudioFrame (const char *channelId, AudioFrame &audioFrame) override
bool | onMixedAudioFrame (const char *channelId, AudioFrame &audioFrame) override
bool | onEarMonitoringAudioFrame (AudioFrame &audioFrame) override
AudioParams | getPlaybackAudioParams () override
AudioParams | getRecordAudioParams () override
AudioParams | getMixedAudioParams () override
AudioParams | getEarMonitoringAudioParams () override
Public Member Functions inherited from agora::rtc::IAVDataObserver
virtual | ~IAVDataObserver ()
virtual bool | onAVDataReady (const AVData &avdata)=0
Public Member Functions inherited from agora::media::IAudioFrameObserver
virtual bool | onPlaybackAudioFrameBeforeMixing (const char *channelId, rtc::uid_t uid, AudioFrame &audioFrame)=0
virtual bool | onPlaybackAudioFrameBeforeMixing (const char *channelId, base::user_id_t userId, AudioFrame &audioFrame)
Public Member Functions inherited from agora::media::IAudioFrameObserverBase
virtual | ~IAudioFrameObserverBase ()
virtual bool | onRecordAudioFrame (const char *channelId, AudioFrame &audioFrame)=0
virtual int | getObservedAudioFramePosition ()=0
Public Member Functions inherited from agora::media::IVideoEncodedFrameObserver
virtual bool | onEncodedVideoFrameReceived (const char *channelId, rtc::uid_t uid, const uint8_t *imageBuffer, size_t length, const rtc::EncodedVideoFrameInfo &videoEncodedFrameInfo)=0
virtual | ~IVideoEncodedFrameObserver ()

## Additional Inherited Members
Public Types inherited from agora::rtc::IAVDataObserver
enum | AVDATA_TYPE { AVDATA_UNKNOWN = 0 , AVDATA_VIDEO = 1 , AVDATA_AUDIO = 2 , AVDATA_AUDIO_MUTE = 3 }
enum | CODEC_VIDEO { CODEC_VIDEO_AVC = 0 , CODEC_VIDEO_HEVC = 1 , CODEC_VIDEO_VP8 = 2 }
enum | CODEC_AUDIO { CODEC_AUDIO_PCM = 0 , CODEC_AUDIO_AAC = 1 , CODEC_AUDIO_G722 = 2 }
Public Types inherited from agora::media::IAudioFrameObserverBase
enum | AUDIO_FRAME_TYPE { FRAME_TYPE_PCM16 = 0 }
enum | { MAX_HANDLE_TIME_CNT = 10 }
enum | AUDIO_FRAME_POSITION { AUDIO_FRAME_POSITION_NONE = 0x0000 , AUDIO_FRAME_POSITION_PLAYBACK = 0x0001 , AUDIO_FRAME_POSITION_RECORD = 0x0002 , AUDIO_FRAME_POSITION_MIXED = 0x0004 , AUDIO_FRAME_POSITION_BEFORE_MIXING = 0x0008 , AUDIO_FRAME_POSITION_EAR_MONITORING = 0x0010 }

## Member Function Documentation

## ◆ startRecording()

virtual int agora::rtc::IMediaRecorderEx::startRecording | ( | const media::MediaRecorderConfiguration & | config | ) |
| pure virtual

## ◆ stopRecording()

virtual int agora::rtc::IMediaRecorderEx::stopRecording | ( |  | ) |
| pure virtual

## ◆ release()

virtual void agora::rtc::IMediaRecorderEx::release | ( |  | ) |
| pure virtual

## ◆ setMediaRecorderObserver()

virtual void agora::rtc::IMediaRecorderEx::setMediaRecorderObserver | ( | media::IMediaRecorderObserverEx * | observer | ) |
| pure virtual

## ◆ setSysVersion()

virtual void agora::rtc::IMediaRecorderEx::setSysVersion | ( | int | sys_version | ) |
| pure virtual

## ◆ onPlaybackAudioFrame()

bool agora::rtc::IMediaRecorderEx::onPlaybackAudioFrame | ( | const char * | channelId,
|  | AudioFrame & | audioFrame )
| inline override virtual

Gets the raw audio frame for playback.

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:

- Method 1: After calling `setPlaybackAudioFrameParameters` to set the audio data format and `registerAudioFrameObserver` to register the audio frame observer object, the SDK calculates the sampling interval according to the parameters set in the methods, and triggers the `onPlaybackAudioFrame` callback according to the sampling interval.
- Method 2: After calling `registerAudioFrameObserver` to register the audio frame observer object, set the audio data format in the return value of the `getObservedAudioFramePosition` callback. The SDK then calculates the sampling interval according to the return value of the `getPlaybackAudioParams` callback, and triggers the `onPlaybackAudioFrame` callback according to the sampling interval.

Note
  The priority of method 1 is higher than that of method 2. If method 1 is used to set the audio data format, the setting of method 2 is invalid.

Parameters

  audioFrame | The raw audio data. See `AudioFrame`.
  channelId | The channel ID.

Returns
  Without practical meaning.

Implements agora::media::IAudioFrameObserverBase.

## ◆ onMixedAudioFrame()

bool agora::rtc::IMediaRecorderEx::onMixedAudioFrame | ( | const char * | channelId,
|  | AudioFrame & | audioFrame )
| inline override virtual

Retrieves the mixed captured and playback audio frame.

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:

- Method 1: After calling `setMixedAudioFrameParameters` to set the audio data format and `registerAudioFrameObserver` to register the audio frame observer object, the SDK calculates the sampling interval according to the parameters set in the methods, and triggers the `onMixedAudioFrame` callback according to the sampling interval.
- Method 2: After calling `registerAudioFrameObserver` to register the audio frame observer object, set the audio data format in the return value of the `getObservedAudioFramePosition` callback. The SDK then calculates the sampling interval according to the return value of the `getMixedAudioParams` callback, and triggers the `onMixedAudioFrame` callback according to the sampling interval.

Note
  The priority of method 1 is higher than that of method 2. If method 1 is used to set the audio data format, the setting of method 2 is invalid.

Parameters

  audioFrame | The raw audio data. See `AudioFrame`.
  channelId | The channel ID.

Returns
  Without practical meaning.

Implements agora::media::IAudioFrameObserverBase.

## ◆ onEarMonitoringAudioFrame()

bool agora::rtc::IMediaRecorderEx::onEarMonitoringAudioFrame | ( | AudioFrame & | audioFrame | ) |
| inline override virtual

Gets the in-ear monitoring audio frame.

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:

- Method 1: After calling `setEarMonitoringAudioFrameParameters` to set the audio data format and `registerAudioFrameObserver` to register the audio frame observer object, the SDK calculates the sampling interval according to the parameters set in the methods, and triggers the `onEarMonitoringAudioFrame` callback according to the sampling interval.
- Method 2: After calling `registerAudioFrameObserver` to register the audio frame observer object, set the audio data format in the return value of the `getObservedAudioFramePosition` callback. The SDK then calculates the sampling interval according to the return value of the `getEarMonitoringAudioParams` callback, and triggers the `onEarMonitoringAudioFrame` callback according to the sampling interval.

Note
  The priority of method 1 is higher than that of method 2. If method 1 is used to set the audio data format, the setting of method 2 is invalid.

Parameters

  audioFrame | The raw audio data. See `AudioFrame`.

Returns
  Without practical meaning.

Implements agora::media::IAudioFrameObserverBase.

## ◆ getPlaybackAudioParams()

AudioParams agora::rtc::IMediaRecorderEx::getPlaybackAudioParams | ( |  | ) |
| inline override virtual

Sets the audio format for the `onPlaybackAudioFrame` callback.

You need to register the callback when calling the `registerAudioFrameObserver` 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.

Note
  The SDK triggers the `onPlaybackAudioFrame` callback with the `AudioParams` 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 `AudioParams`.

Implements agora::media::IAudioFrameObserverBase.

## ◆ getRecordAudioParams()

AudioParams agora::rtc::IMediaRecorderEx::getRecordAudioParams | ( |  | ) |
| inline override virtual

Sets the audio format for the `onRecordAudioFrame` callback.

You need to register the callback when calling the `registerAudioFrameObserver` 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.

Note
  The SDK triggers the `onRecordAudioFrame` callback with the `AudioParams` 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 `AudioParams`.

Implements agora::media::IAudioFrameObserverBase.

## ◆ getMixedAudioParams()

AudioParams agora::rtc::IMediaRecorderEx::getMixedAudioParams | ( |  | ) |
| inline override virtual

Sets the audio format for the `onMixedAudioFrame` callback.

You need to register the callback when calling the `registerAudioFrameObserver` 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.

Note
  The SDK triggers the `onMixedAudioFrame` callback with the `AudioParams` 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 `AudioParams`.

Implements agora::media::IAudioFrameObserverBase.

## ◆ getEarMonitoringAudioParams()

AudioParams agora::rtc::IMediaRecorderEx::getEarMonitoringAudioParams | ( |  | ) |
| inline override virtual

Sets the audio format for the `onEarMonitoringAudioFrame` callback.

You need to register the callback when calling the `registerAudioFrameObserver` 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.

Note
  The SDK triggers the `onEarMonitoringAudioFrame` callback with the `AudioParams` 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 `AudioParams`.

Implements agora::media::IAudioFrameObserverBase.