Agora C++ API Reference for All Platforms
Public Member Functions | List of all members
agora::rtc::IMediaRecorderEX Class Referenceabstract

Inherits agora::rtc::IAVDataObserver, agora::media::IAudioFrameObserverBase, 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::IMediaRecorderObserver *observer)=0
 
virtual void setSysVersion (int sys_version)=0
 
bool onRecordAudioFrame (const char *channelId, AudioFrame &audioFrame) override
 
bool onPlaybackAudioFrame (const char *channelId, AudioFrame &audioFrame) override
 
bool onMixedAudioFrame (const char *channelId, AudioFrame &audioFrame) override
 
bool onEarMonitoringAudioFrame (AudioFrame &audioFrame) override
 
bool onPlaybackAudioFrameBeforeMixing (const char *channelId, user_id_t userId, AudioFrame &audioFrame) override
 
int getObservedAudioFramePosition () override
 
AudioParams getPlaybackAudioParams () override
 
AudioParams getRecordAudioParams () override
 
AudioParams getMixedAudioParams () override
 
AudioParams getEarMonitoringAudioParams () override
 
virtual bool onEncodedVideoFrameReceived (rtc::uid_t uid, const uint8_t *imageBuffer, size_t length, const rtc::EncodedVideoFrameInfo &videoEncodedFrameInfo) 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::IAudioFrameObserverBase
virtual ~IAudioFrameObserverBase ()
 
- Public Member Functions inherited from agora::media::IVideoEncodedFrameObserver
virtual ~IVideoEncodedFrameObserver ()
 

Additional Inherited Members

- Public Types inherited from agora::rtc::IAVDataObserver
enum  AVDATA_TYPE { AVDATA_UNKNOWN = 0, AVDATA_VIDEO = 1, AVDATA_AUDIO = 2 }
 
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::IMediaRecorderObserver observer)
pure virtual

◆ setSysVersion()

virtual void agora::rtc::IMediaRecorderEX::setSysVersion ( int  sys_version)
pure virtual

◆ onRecordAudioFrame()

bool agora::rtc::IMediaRecorderEX::onRecordAudioFrame ( const char *  channelId,
AudioFrame audioFrame 
)
inlineoverridevirtual

Occurs when the recorded audio frame is received.

Parameters
channelIdThe channel name
audioFrameThe reference to the audio frame: AudioFrame.
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.

Implements agora::media::IAudioFrameObserverBase.

◆ onPlaybackAudioFrame()

bool agora::rtc::IMediaRecorderEX::onPlaybackAudioFrame ( const char *  channelId,
AudioFrame audioFrame 
)
inlineoverridevirtual

Occurs when the playback audio frame is received.

Parameters
channelIdThe channel name
audioFrameThe reference to the audio frame: AudioFrame.
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.

Implements agora::media::IAudioFrameObserverBase.

◆ onMixedAudioFrame()

bool agora::rtc::IMediaRecorderEX::onMixedAudioFrame ( const char *  channelId,
AudioFrame audioFrame 
)
inlineoverridevirtual

Occurs when the mixed audio data is received.

Parameters
channelIdThe channel name
audioFrameThe reference to the audio frame: AudioFrame.
Returns
  • true: The mixed audio data is valid and is encoded and sent.
  • false: The mixed audio data is invalid and is not encoded or sent.

Implements agora::media::IAudioFrameObserverBase.

◆ onEarMonitoringAudioFrame()

bool agora::rtc::IMediaRecorderEX::onEarMonitoringAudioFrame ( AudioFrame audioFrame)
inlineoverridevirtual

Occurs when the ear monitoring audio frame is received.

Parameters
audioFrameThe reference to the audio frame: AudioFrame.
Returns
  • true: The ear monitoring audio data is valid and is encoded and sent.
  • false: The ear monitoring audio data is invalid and is not encoded or sent.

Implements agora::media::IAudioFrameObserverBase.

◆ onPlaybackAudioFrameBeforeMixing()

bool agora::rtc::IMediaRecorderEX::onPlaybackAudioFrameBeforeMixing ( const char *  channelId,
user_id_t  userId,
AudioFrame audioFrame 
)
inlineoverridevirtual

Occurs when the before-mixing playback audio frame is received.

Parameters
channelIdThe channel name
userIdID of the remote user.
audioFrameThe reference to the audio frame: AudioFrame.
Returns
  • true: The before-mixing playback audio frame is valid and is encoded and sent.
  • false: The before-mixing playback audio frame is invalid and is not encoded or sent.

Reimplemented from agora::media::IAudioFrameObserverBase.

◆ getObservedAudioFramePosition()

int agora::rtc::IMediaRecorderEX::getObservedAudioFramePosition ( )
inlineoverridevirtual

Sets the frame position for the audio observer.

Returns
A bit mask that controls the frame position of the audio observer.
Note
- Use '|' (the OR operator) to observe multiple frame positions.

After you successfully register the audio observer, the SDK triggers this callback each time it receives a audio frame. You can determine which position to observe by setting the return value. The SDK provides 4 positions for observer. Each position corresponds to a callback function:

  • AUDIO_FRAME_POSITION_PLAYBACK (1 << 0): The position for playback audio frame is received, which corresponds to the onPlaybackFrame callback.
  • AUDIO_FRAME_POSITION_RECORD (1 << 1): The position for record audio frame is received, which corresponds to the onRecordFrame callback.
  • AUDIO_FRAME_POSITION_MIXED (1 << 2): The position for mixed audio frame is received, which corresponds to the onMixedFrame callback.
  • AUDIO_FRAME_POSITION_BEFORE_MIXING (1 << 3): The position for playback audio frame before mixing is received, which corresponds to the onPlaybackFrameBeforeMixing callback.
    Returns
    The bit mask that controls the audio observation positions. See AUDIO_FRAME_POSITION.

Implements agora::media::IAudioFrameObserverBase.

◆ getPlaybackAudioParams()

AudioParams agora::rtc::IMediaRecorderEX::getPlaybackAudioParams ( )
inlineoverridevirtual

Sets the audio playback format Note**:

  • The SDK calculates the sample interval according to the AudioParams you set in the return value of this callback and triggers the onPlaybackAudioFrame callback at the calculated sample interval. Sample interval (seconds) = samplesPerCall/(sampleRate × channel). Ensure that the value of sample interval is equal to or greater than 0.01.
Returns
Sets the audio format. See AgoraAudioParams.

Implements agora::media::IAudioFrameObserverBase.

◆ getRecordAudioParams()

AudioParams agora::rtc::IMediaRecorderEX::getRecordAudioParams ( )
inlineoverridevirtual

Sets the audio recording format Note**:

  • The SDK calculates the sample interval according to the AudioParams you set in the return value of this callback and triggers the onRecordAudioFrame callback at the calculated sample interval. Sample interval (seconds) = samplesPerCall/(sampleRate × channel). Ensure that the value of sample interval is equal to or greater than 0.01.
Returns
Sets the audio format. See AgoraAudioParams.

Implements agora::media::IAudioFrameObserverBase.

◆ getMixedAudioParams()

AudioParams agora::rtc::IMediaRecorderEX::getMixedAudioParams ( )
inlineoverridevirtual

Sets the audio mixing format Note**:

  • The SDK calculates the sample interval according to the AudioParams you set in the return value of this callback and triggers the onMixedAudioFrame callback at the calculated sample interval. Sample interval (seconds) = samplesPerCall/(sampleRate × channel). Ensure that the value of sample interval is equal to or greater than 0.01.
Returns
Sets the audio format. See AgoraAudioParams.

Implements agora::media::IAudioFrameObserverBase.

◆ getEarMonitoringAudioParams()

AudioParams agora::rtc::IMediaRecorderEX::getEarMonitoringAudioParams ( )
inlineoverridevirtual

Sets the ear monitoring audio format Note**:

  • The SDK calculates the sample interval according to the AudioParams you set in the return value of this callback and triggers the onEarMonitoringAudioFrame callback at the calculated sample interval. Sample interval (seconds) = samplesPerCall/(sampleRate × channel). Ensure that the value of sample interval is equal to or greater than 0.01.
Returns
Sets the audio format. See AgoraAudioParams.

Implements agora::media::IAudioFrameObserverBase.

◆ onEncodedVideoFrameReceived()

virtual bool agora::rtc::IMediaRecorderEX::onEncodedVideoFrameReceived ( rtc::uid_t  uid,
const uint8_t *  imageBuffer,
size_t  length,
const rtc::EncodedVideoFrameInfo videoEncodedFrameInfo 
)
inlineoverridevirtual

Occurs each time the SDK receives an encoded video image.

Parameters
uidThe user id of remote user.
imageBufferThe pointer to the video image buffer.
lengthThe data length of the video image.
videoEncodedFrameInfoThe information of the encoded video frame: EncodedVideoFrameInfo.
Returns
Determines whether to accept encoded video image.
  • true: Accept.
  • false: Do not accept.

Implements agora::media::IVideoEncodedFrameObserver.