\hypertarget{classagora_1_1rtc_1_1_i_media_recorder}{}\doxysection{agora\+::rtc\+::I\+Media\+Recorder Class Reference}
\label{classagora_1_1rtc_1_1_i_media_recorder}\index{agora::rtc::IMediaRecorder@{agora::rtc::IMediaRecorder}}
Inheritance diagram for agora\+::rtc\+::I\+Media\+Recorder\+:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=3.000000cm]{classagora_1_1rtc_1_1_i_media_recorder}
\end{center}
\end{figure}
\doxysubsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
virtual int \mbox{\hyperlink{classagora_1_1rtc_1_1_i_media_recorder_a2e5a752eb9818b5c4ac5db9155c0385e}{set\+Media\+Recorder\+Observer}} (\mbox{\hyperlink{classagora_1_1media_1_1_i_media_recorder_observer}{media\+::\+I\+Media\+Recorder\+Observer}} $\ast$callback)=0
\begin{DoxyCompactList}\small\item\em Registers the {\ttfamily I\+Media\+Recorder\+Observer} observer. \end{DoxyCompactList}\item 
virtual int \mbox{\hyperlink{classagora_1_1rtc_1_1_i_media_recorder_a2366c1f1cdf8874cc20f99a089b35a58}{start\+Recording}} (const \mbox{\hyperlink{structagora_1_1media_1_1_media_recorder_configuration}{media\+::\+Media\+Recorder\+Configuration}} \&config)=0
\begin{DoxyCompactList}\small\item\em Starts audio and video stream recording. \end{DoxyCompactList}\item 
virtual int \mbox{\hyperlink{classagora_1_1rtc_1_1_i_media_recorder_a43e40d02689a01308938d5147b9648c7}{stop\+Recording}} ()=0
\begin{DoxyCompactList}\small\item\em Stops audio and video stream recording. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Member Function Documentation}
\mbox{\Hypertarget{classagora_1_1rtc_1_1_i_media_recorder_a2e5a752eb9818b5c4ac5db9155c0385e}\label{classagora_1_1rtc_1_1_i_media_recorder_a2e5a752eb9818b5c4ac5db9155c0385e}} 
\index{agora::rtc::IMediaRecorder@{agora::rtc::IMediaRecorder}!setMediaRecorderObserver@{setMediaRecorderObserver}}
\index{setMediaRecorderObserver@{setMediaRecorderObserver}!agora::rtc::IMediaRecorder@{agora::rtc::IMediaRecorder}}
\doxysubsubsection{\texorpdfstring{setMediaRecorderObserver()}{setMediaRecorderObserver()}}
{\footnotesize\ttfamily virtual int agora\+::rtc\+::\+I\+Media\+Recorder\+::set\+Media\+Recorder\+Observer (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{classagora_1_1media_1_1_i_media_recorder_observer}{media\+::\+I\+Media\+Recorder\+Observer}} $\ast$}]{callback }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [pure virtual]}}



Registers the {\ttfamily I\+Media\+Recorder\+Observer} observer. 

\begin{DoxySince}{Since}
v4.\+0.\+0
\end{DoxySince}
This method sets the callback for audio and video recording, so the app can be notified of recording status and information during the recording process. Before calling this method, make sure that\+:
\begin{DoxyItemize}
\item The {\ttfamily \mbox{\hyperlink{classagora_1_1rtc_1_1_i_rtc_engine}{I\+Rtc\+Engine}}} object has been created and initialized.
\item The media recorder object has been created using {\ttfamily create\+Media\+Recorder}.
\end{DoxyItemize}


\begin{DoxyParams}{Parameters}
{\em callback} & Callback for audio and video stream recording. See {\ttfamily I\+Media\+Recorder\+Observer}.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}

\begin{DoxyItemize}
\item 0\+: Success.
\item $<$ 0\+: Failure. See {\ttfamily Error Codes} for details and resolution suggestions. 
\end{DoxyItemize}
\end{DoxyReturn}
\mbox{\Hypertarget{classagora_1_1rtc_1_1_i_media_recorder_a2366c1f1cdf8874cc20f99a089b35a58}\label{classagora_1_1rtc_1_1_i_media_recorder_a2366c1f1cdf8874cc20f99a089b35a58}} 
\index{agora::rtc::IMediaRecorder@{agora::rtc::IMediaRecorder}!startRecording@{startRecording}}
\index{startRecording@{startRecording}!agora::rtc::IMediaRecorder@{agora::rtc::IMediaRecorder}}
\doxysubsubsection{\texorpdfstring{startRecording()}{startRecording()}}
{\footnotesize\ttfamily virtual int agora\+::rtc\+::\+I\+Media\+Recorder\+::start\+Recording (\begin{DoxyParamCaption}\item[{const \mbox{\hyperlink{structagora_1_1media_1_1_media_recorder_configuration}{media\+::\+Media\+Recorder\+Configuration}} \&}]{config }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [pure virtual]}}



Starts audio and video stream recording. 

\begin{DoxySince}{Since}
v4.\+0.\+0
\end{DoxySince}
This method starts recording audio and video streams. The Agora S\+DK supports recording both local and remote users\textquotesingle{} audio and video streams simultaneously. Before starting the recording, make sure that\+:
\begin{DoxyItemize}
\item You have created the media recorder object using {\ttfamily create\+Media\+Recorder}.
\item You have registered a recorder observer using {\ttfamily set\+Media\+Recorder\+Observer} to listen for recording callbacks.
\item You have joined a channel. This method supports recording the following data\+:
\item Audio captured from the microphone in A\+AC encoding format.
\item Video captured from the camera in H.\+264 or H.\+265 encoding format. After recording starts, if the video resolution changes during recording, the S\+DK stops the recording. If the audio sample rate or number of channels changes, the S\+DK continues recording and generates a single M\+P4 file. A recording file is only successfully generated when a recordable audio or video stream is detected. If there is no recordable stream, or if the stream is interrupted for more than 5 seconds during recording, the S\+DK stops the recording and triggers the {\ttfamily on\+Recorder\+State\+Changed} ({\ttfamily R\+E\+C\+O\+R\+D\+E\+R\+\_\+\+S\+T\+A\+T\+E\+\_\+\+E\+R\+R\+OR, R\+E\+C\+O\+R\+D\+E\+R\+\_\+\+R\+E\+A\+S\+O\+N\+\_\+\+N\+O\+\_\+\+S\+T\+R\+E\+AM}) callback.
\end{DoxyItemize}

\begin{DoxyNote}{Note}

\begin{DoxyItemize}
\item If you want to record local audio and video streams, make sure the local user role is set to broadcaster before starting recording.
\item If you want to record remote audio and video streams, make sure you have subscribed to the remote user\textquotesingle{}s streams before starting recording.
\end{DoxyItemize}
\end{DoxyNote}

\begin{DoxyParams}{Parameters}
{\em config} & Audio and video stream recording configuration. See {\ttfamily Media\+Recorder\+Configuration}.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}

\begin{DoxyItemize}
\item 0\+: Success.
\item $<$ 0\+: Failure. See {\ttfamily Error Codes} for details and resolution suggestions.
\begin{DoxyItemize}
\item -\/2\+: Invalid parameter. Please ensure that\+:
\begin{DoxyItemize}
\item The specified recording file path is correct and writable.
\item The specified recording file format is correct.
\item The maximum recording duration is set correctly.
\end{DoxyItemize}
\item -\/4\+: {\ttfamily \mbox{\hyperlink{classagora_1_1rtc_1_1_i_rtc_engine}{I\+Rtc\+Engine}}} is in a state that does not support this operation. This may be because a recording is already in progress or has stopped due to an error.
\item -\/7\+: {\ttfamily \mbox{\hyperlink{classagora_1_1rtc_1_1_i_rtc_engine}{I\+Rtc\+Engine}}} is not initialized when this method is called. Please make sure the {\ttfamily \mbox{\hyperlink{classagora_1_1rtc_1_1_i_media_recorder}{I\+Media\+Recorder}}} object has been created before calling this method. 
\end{DoxyItemize}
\end{DoxyItemize}
\end{DoxyReturn}
\mbox{\Hypertarget{classagora_1_1rtc_1_1_i_media_recorder_a43e40d02689a01308938d5147b9648c7}\label{classagora_1_1rtc_1_1_i_media_recorder_a43e40d02689a01308938d5147b9648c7}} 
\index{agora::rtc::IMediaRecorder@{agora::rtc::IMediaRecorder}!stopRecording@{stopRecording}}
\index{stopRecording@{stopRecording}!agora::rtc::IMediaRecorder@{agora::rtc::IMediaRecorder}}
\doxysubsubsection{\texorpdfstring{stopRecording()}{stopRecording()}}
{\footnotesize\ttfamily virtual int agora\+::rtc\+::\+I\+Media\+Recorder\+::stop\+Recording (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [pure virtual]}}



Stops audio and video stream recording. 

\begin{DoxySince}{Since}
v4.\+0.\+0
\end{DoxySince}
\begin{DoxyNote}{Note}
After calling {\ttfamily start\+Recording}, you must call this method to stop the recording; otherwise, the generated recording file may not play properly.
\end{DoxyNote}
\begin{DoxyReturn}{Returns}

\begin{DoxyItemize}
\item 0\+: Success.
\item $<$ 0\+: Failure\+:
\begin{DoxyItemize}
\item -\/7\+: {\ttfamily \mbox{\hyperlink{classagora_1_1rtc_1_1_i_rtc_engine}{I\+Rtc\+Engine}}} is not initialized when this method is called. Please make sure the {\ttfamily \mbox{\hyperlink{classagora_1_1rtc_1_1_i_media_recorder}{I\+Media\+Recorder}}} object has been created before calling this method. 
\end{DoxyItemize}
\end{DoxyItemize}
\end{DoxyReturn}
