Agora RTC Objective-C API Reference  Refactor
Public Member Functions
IMediaRecorder Class Referenceabstract

Inherits RefCountInterface.

Inherited by IMediaRecorder2.

Public Member Functions

virtual int setMediaRecorderObserver (media::IMediaRecorderObserver *callback)=0
 
virtual int startRecording (const media::MediaRecorderConfiguration &config)=0
 
virtual int stopRecording ()=0
 

Constructor & Destructor Documentation

◆ ~IMediaRecorder()

virtual ~IMediaRecorder ( )
inlineprotectedvirtual

Member Function Documentation

◆ setMediaRecorderObserver()

virtual int setMediaRecorderObserver ( media::IMediaRecorderObserver callback)
pure virtual

Registers the IMediaRecorderObserver object.

Since
v4.0.0
Note
Call this method before the startRecording method.
Parameters
callbackThe callbacks for recording audio and video streams. See IMediaRecorderObserver.
Returns
  • 0(ERR_OK): Success.
  • < 0: Failure:

◆ startRecording()

virtual int startRecording ( const media::MediaRecorderConfiguration config)
pure virtual

Starts recording the local or remote audio and video.

Since
v4.0.0

After successfully calling createMediaRecorder to get the media recorder object , you can call this method to enable the recording of the local audio and video.

This method can record the following content:

  • The audio captured by the local microphone and encoded in AAC format.
  • The video captured by the local camera and encoded by the SDK.
  • The audio received from remote users and encoded in AAC format.
  • The video received from remote users.

The SDK can generate a recording file only when it detects the recordable audio and video streams; when there are no audio and video streams to be recorded or the audio and video streams are interrupted for more than five seconds, the SDK stops recording and triggers the onRecorderStateChanged (RECORDER_STATE_ERROR, RECORDER_ERROR_NO_STREAM) callback.

Note
Call this method after joining the channel.
Parameters
configThe recording configurations. See MediaRecorderConfiguration.
Returns
  • 0(ERR_OK): Success.
  • < 0: Failure:
    • -1(ERR_FAILED): IRtcEngine does not support the request because the remote user did not subscribe to the target channel or the media streams published by the local user during remote recording.
    • -2(ERR_INVALID_ARGUMENT): The parameter is invalid. Ensure the following:
      • The specified path of the recording file exists and is writable.
      • The specified format of the recording file is supported.
      • The maximum recording duration is correctly set.
      • During remote recording, ensure the user whose media streams you want record did join the channel.
    • -4(ERR_NOT_SUPPORTED): IRtcEngine does not support the request due to one of the following reasons:
      • The recording is ongoing.
      • The recording stops because an error occurs.
      • No IMediaRecorderObserver object is registered.

◆ stopRecording()

virtual int stopRecording ( )
pure virtual

Stops recording the audio and video.

Since
v4.0.0
Note
After calling startRecording, if you want to stop the recording, you must call stopRecording; otherwise, the generated recording files might not be playable.
Returns
  • 0(ERR_OK): Success.
  • < 0: Failure:

◆ AddRef()

virtual void AddRef ( ) const
pure virtualinherited

◆ Release()

virtual RefCountReleaseStatus Release ( ) const
pure virtualinherited

◆ HasOneRef()

virtual bool HasOneRef ( ) const
pure virtualinherited