\hypertarget{classagora_1_1media_1_1_i_media_engine}{}\doxysection{agora\+::media\+::I\+Media\+Engine Class Reference}
\label{classagora_1_1media_1_1_i_media_engine}\index{agora::media::IMediaEngine@{agora::media::IMediaEngine}}


{\ttfamily \#include $<$I\+Agora\+Media\+Engine.\+h$>$}

\doxysubsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
virtual int \mbox{\hyperlink{classagora_1_1media_1_1_i_media_engine_ae46ca0d20789787aaab2fb268a524100}{register\+Audio\+Frame\+Observer}} (\mbox{\hyperlink{classagora_1_1media_1_1_i_audio_frame_observer}{I\+Audio\+Frame\+Observer}} $\ast$observer)=0
\begin{DoxyCompactList}\small\item\em Registers an audio frame observer object. \end{DoxyCompactList}\item 
virtual int \mbox{\hyperlink{classagora_1_1media_1_1_i_media_engine_a5eee4dfd1fd46e4a865feba163f3c5de}{register\+Video\+Frame\+Observer}} (\mbox{\hyperlink{classagora_1_1media_1_1_i_video_frame_observer}{I\+Video\+Frame\+Observer}} $\ast$observer)=0
\begin{DoxyCompactList}\small\item\em Registers a raw video frame observer object. \end{DoxyCompactList}\item 
virtual int \mbox{\hyperlink{classagora_1_1media_1_1_i_media_engine_a3f18b30ad8b5332bcee99c2146876c83}{register\+Video\+Encoded\+Frame\+Observer}} (\mbox{\hyperlink{classagora_1_1media_1_1_i_video_encoded_frame_observer}{I\+Video\+Encoded\+Frame\+Observer}} $\ast$observer)=0
\begin{DoxyCompactList}\small\item\em Registers a receiver object for the encoded video image. \end{DoxyCompactList}\item 
virtual int \mbox{\hyperlink{classagora_1_1media_1_1_i_media_engine_a373016642bf01cf22004522da6c36789}{register\+Face\+Info\+Observer}} (\mbox{\hyperlink{classagora_1_1media_1_1_i_face_info_observer}{I\+Face\+Info\+Observer}} $\ast$observer)=0
\begin{DoxyCompactList}\small\item\em Registers or unregisters a facial information observer. \end{DoxyCompactList}\item 
virtual int \mbox{\hyperlink{classagora_1_1media_1_1_i_media_engine_a880ff35d3559a15965aa55837b05579a}{push\+Audio\+Frame}} (\mbox{\hyperlink{structagora_1_1media_1_1_i_audio_frame_observer_base_1_1_audio_frame}{I\+Audio\+Frame\+Observer\+Base\+::\+Audio\+Frame}} $\ast$frame, rtc\+::track\+\_\+id\+\_\+t track\+Id=0)=0
\begin{DoxyCompactList}\small\item\em Pushes the external audio frame. \end{DoxyCompactList}\item 
virtual int \mbox{\hyperlink{classagora_1_1media_1_1_i_media_engine_ab40a4f31f73f3a775a5ea18dfeb25479}{pull\+Audio\+Frame}} (\mbox{\hyperlink{structagora_1_1media_1_1_i_audio_frame_observer_base_1_1_audio_frame}{I\+Audio\+Frame\+Observer\+Base\+::\+Audio\+Frame}} $\ast$frame)=0
\begin{DoxyCompactList}\small\item\em Pulls the remote audio data. \end{DoxyCompactList}\item 
virtual int \mbox{\hyperlink{classagora_1_1media_1_1_i_media_engine_a334e09a78fbdeb7cee691b15afa38b53}{set\+External\+Video\+Source}} (bool enabled, bool use\+Texture, E\+X\+T\+E\+R\+N\+A\+L\+\_\+\+V\+I\+D\+E\+O\+\_\+\+S\+O\+U\+R\+C\+E\+\_\+\+T\+Y\+PE source\+Type=V\+I\+D\+E\+O\+\_\+\+F\+R\+A\+ME, \mbox{\hyperlink{structagora_1_1rtc_1_1_sender_options}{rtc\+::\+Sender\+Options}} encoded\+Video\+Option=\mbox{\hyperlink{structagora_1_1rtc_1_1_sender_options}{rtc\+::\+Sender\+Options}}())=0
\begin{DoxyCompactList}\small\item\em Configures the external video source. \end{DoxyCompactList}\item 
virtual int \mbox{\hyperlink{classagora_1_1media_1_1_i_media_engine_a9d8ffc684390f54f2258ddad1a8b69c8}{set\+External\+Audio\+Source}} (bool enabled, int sample\+Rate, int channels, bool local\+Playback=false, bool publish=true) \+\_\+\+\_\+deprecated=0
\begin{DoxyCompactList}\small\item\em Sets the external audio source parameters. \end{DoxyCompactList}\item 
virtual rtc\+::track\+\_\+id\+\_\+t \mbox{\hyperlink{classagora_1_1media_1_1_i_media_engine_adb9b0203cf06756db5357ea806058ab0}{create\+Custom\+Audio\+Track}} (rtc\+::\+A\+U\+D\+I\+O\+\_\+\+T\+R\+A\+C\+K\+\_\+\+T\+Y\+PE track\+Type, const \mbox{\hyperlink{structagora_1_1rtc_1_1_audio_track_config}{rtc\+::\+Audio\+Track\+Config}} \&config)=0
\begin{DoxyCompactList}\small\item\em Creates a custom audio track. \end{DoxyCompactList}\item 
virtual int \mbox{\hyperlink{classagora_1_1media_1_1_i_media_engine_a11110e2c6005ef61b929198aedb9076d}{destroy\+Custom\+Audio\+Track}} (rtc\+::track\+\_\+id\+\_\+t track\+Id)=0
\begin{DoxyCompactList}\small\item\em Destroys the specified audio track. \end{DoxyCompactList}\item 
virtual int \mbox{\hyperlink{classagora_1_1media_1_1_i_media_engine_a82123ecb70f84c772ef84fa4ee16fba9}{set\+External\+Audio\+Sink}} (bool enabled, int sample\+Rate, int channels)=0
\begin{DoxyCompactList}\small\item\em Sets the external audio sink. \end{DoxyCompactList}\item 
virtual int \mbox{\hyperlink{classagora_1_1media_1_1_i_media_engine_aed022bc54436117acc5cd3e1fffc2bba}{enable\+Custom\+Audio\+Local\+Playback}} (rtc\+::track\+\_\+id\+\_\+t track\+Id, bool enabled)=0
\item 
virtual int \mbox{\hyperlink{classagora_1_1media_1_1_i_media_engine_a3e847e920dcdb1f5c61cfdbb86f4f7c4}{push\+Video\+Frame}} (\mbox{\hyperlink{structagora_1_1media_1_1base_1_1_external_video_frame}{base\+::\+External\+Video\+Frame}} $\ast$frame, unsigned int video\+Track\+Id=0)=0
\begin{DoxyCompactList}\small\item\em Pushes the external raw video frame to the S\+DK through video tracks. \end{DoxyCompactList}\item 
virtual int \mbox{\hyperlink{classagora_1_1media_1_1_i_media_engine_ae2b717dafdf9245d70caf5a2ecd2f9be}{push\+Encoded\+Video\+Image}} (const unsigned char $\ast$image\+Buffer, size\+\_\+t length, const \mbox{\hyperlink{structagora_1_1rtc_1_1_encoded_video_frame_info}{agora\+::rtc\+::\+Encoded\+Video\+Frame\+Info}} \&video\+Encoded\+Frame\+Info, unsigned int video\+Track\+Id=0)=0
\item 
virtual int \mbox{\hyperlink{classagora_1_1media_1_1_i_media_engine_a17df8dbc9b56bf4ecd8cac32a7b0bb2a}{add\+Video\+Frame\+Renderer}} (\mbox{\hyperlink{classagora_1_1media_1_1_i_video_frame_observer}{I\+Video\+Frame\+Observer}} $\ast$renderer)=0
\item 
virtual int \mbox{\hyperlink{classagora_1_1media_1_1_i_media_engine_a3a41f7d0bc2ce4d3461113b9cccba336}{remove\+Video\+Frame\+Renderer}} (\mbox{\hyperlink{classagora_1_1media_1_1_i_video_frame_observer}{I\+Video\+Frame\+Observer}} $\ast$renderer)=0
\item 
\mbox{\Hypertarget{classagora_1_1media_1_1_i_media_engine_affbdaa2ba63c318b382f551f0e466224}\label{classagora_1_1media_1_1_i_media_engine_affbdaa2ba63c318b382f551f0e466224}} 
virtual void {\bfseries release} ()=0
\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
The \mbox{\hyperlink{classagora_1_1media_1_1_i_media_engine}{I\+Media\+Engine}} class. 

\doxysubsection{Member Function Documentation}
\mbox{\Hypertarget{classagora_1_1media_1_1_i_media_engine_ae46ca0d20789787aaab2fb268a524100}\label{classagora_1_1media_1_1_i_media_engine_ae46ca0d20789787aaab2fb268a524100}} 
\index{agora::media::IMediaEngine@{agora::media::IMediaEngine}!registerAudioFrameObserver@{registerAudioFrameObserver}}
\index{registerAudioFrameObserver@{registerAudioFrameObserver}!agora::media::IMediaEngine@{agora::media::IMediaEngine}}
\doxysubsubsection{\texorpdfstring{registerAudioFrameObserver()}{registerAudioFrameObserver()}}
{\footnotesize\ttfamily virtual int agora\+::media\+::\+I\+Media\+Engine\+::register\+Audio\+Frame\+Observer (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{classagora_1_1media_1_1_i_audio_frame_observer}{I\+Audio\+Frame\+Observer}} $\ast$}]{observer }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [pure virtual]}}



Registers an audio frame observer object. 

Call this method to register an audio frame observer object (register a callback). When you need the S\+DK to trigger the {\ttfamily on\+Mixed\+Audio\+Frame}, {\ttfamily on\+Record\+Audio\+Frame}, {\ttfamily on\+Playback\+Audio\+Frame}, {\ttfamily on\+Playback\+Audio\+Frame\+Before\+Mixing} or {\ttfamily on\+Ear\+Monitoring\+Audio\+Frame} callback, you need to use this method to register the callbacks. Call timing\+: Call this method before joining a channel.


\begin{DoxyParams}{Parameters}
{\em observer} & The observer instance. See {\ttfamily \mbox{\hyperlink{classagora_1_1media_1_1_i_audio_frame_observer}{I\+Audio\+Frame\+Observer}}}. Set the value as N\+U\+LL to release the instance. Agora recommends calling this method after receiving {\ttfamily on\+Leave\+Channel} to release the audio observer object.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}

\begin{DoxyItemize}
\item 0\+: Success.
\item $<$ 0\+: Failure. 
\end{DoxyItemize}
\end{DoxyReturn}
\mbox{\Hypertarget{classagora_1_1media_1_1_i_media_engine_a5eee4dfd1fd46e4a865feba163f3c5de}\label{classagora_1_1media_1_1_i_media_engine_a5eee4dfd1fd46e4a865feba163f3c5de}} 
\index{agora::media::IMediaEngine@{agora::media::IMediaEngine}!registerVideoFrameObserver@{registerVideoFrameObserver}}
\index{registerVideoFrameObserver@{registerVideoFrameObserver}!agora::media::IMediaEngine@{agora::media::IMediaEngine}}
\doxysubsubsection{\texorpdfstring{registerVideoFrameObserver()}{registerVideoFrameObserver()}}
{\footnotesize\ttfamily virtual int agora\+::media\+::\+I\+Media\+Engine\+::register\+Video\+Frame\+Observer (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{classagora_1_1media_1_1_i_video_frame_observer}{I\+Video\+Frame\+Observer}} $\ast$}]{observer }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [pure virtual]}}



Registers a raw video frame observer object. 

If you want to observe raw video frames (such as Y\+UV or R\+G\+BA format), Agora recommends that you implement one {\ttfamily \mbox{\hyperlink{classagora_1_1media_1_1_i_video_frame_observer}{I\+Video\+Frame\+Observer}}} class with this method. When calling this method to register a video observer, you can register callbacks in the {\ttfamily \mbox{\hyperlink{classagora_1_1media_1_1_i_video_frame_observer}{I\+Video\+Frame\+Observer}}} class as needed. After you successfully register the video frame observer, the S\+DK triggers the registered callbacks each time a video frame is received. Applicable scenarios\+: After registering the raw video observer, you can use the obtained raw video data in various video pre-\/processing scenarios, such as virtual backgrounds and image enhacement by yourself. Call timing\+: Call this method before joining a channel.

\begin{DoxyNote}{Note}
When handling the video data returned in the callbacks, pay attention to the changes in the {\ttfamily width} and {\ttfamily height} parameters, which may be adapted under the following circumstances\+:
\begin{DoxyItemize}
\item When network conditions deteriorate, the video resolution decreases incrementally.
\item If the user adjusts the video profile, the resolution of the video returned in the callbacks also changes.
\end{DoxyItemize}
\end{DoxyNote}

\begin{DoxyParams}{Parameters}
{\em observer} & The observer instance. See {\ttfamily \mbox{\hyperlink{classagora_1_1media_1_1_i_video_frame_observer}{I\+Video\+Frame\+Observer}}}. To release the instance, set the value as N\+U\+LL.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}

\begin{DoxyItemize}
\item 0\+: Success.
\item $<$ 0\+: Failure. 
\end{DoxyItemize}
\end{DoxyReturn}
\mbox{\Hypertarget{classagora_1_1media_1_1_i_media_engine_a3f18b30ad8b5332bcee99c2146876c83}\label{classagora_1_1media_1_1_i_media_engine_a3f18b30ad8b5332bcee99c2146876c83}} 
\index{agora::media::IMediaEngine@{agora::media::IMediaEngine}!registerVideoEncodedFrameObserver@{registerVideoEncodedFrameObserver}}
\index{registerVideoEncodedFrameObserver@{registerVideoEncodedFrameObserver}!agora::media::IMediaEngine@{agora::media::IMediaEngine}}
\doxysubsubsection{\texorpdfstring{registerVideoEncodedFrameObserver()}{registerVideoEncodedFrameObserver()}}
{\footnotesize\ttfamily virtual int agora\+::media\+::\+I\+Media\+Engine\+::register\+Video\+Encoded\+Frame\+Observer (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{classagora_1_1media_1_1_i_video_encoded_frame_observer}{I\+Video\+Encoded\+Frame\+Observer}} $\ast$}]{observer }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [pure virtual]}}



Registers a receiver object for the encoded video image. 

If you only want to observe encoded video frames (such as H.\+264 format) without decoding and rendering the video, Agora recommends that you implement one {\ttfamily \mbox{\hyperlink{classagora_1_1media_1_1_i_video_encoded_frame_observer}{I\+Video\+Encoded\+Frame\+Observer}}} class through this method.

\begin{DoxyNote}{Note}
Call this method before joining a channel.
\end{DoxyNote}

\begin{DoxyParams}{Parameters}
{\em observer} & The video frame observer object. See {\ttfamily \mbox{\hyperlink{classagora_1_1media_1_1_i_video_encoded_frame_observer}{I\+Video\+Encoded\+Frame\+Observer}}}.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}

\begin{DoxyItemize}
\item 0\+: Success.
\item $<$ 0\+: Failure. 
\end{DoxyItemize}
\end{DoxyReturn}
\mbox{\Hypertarget{classagora_1_1media_1_1_i_media_engine_a373016642bf01cf22004522da6c36789}\label{classagora_1_1media_1_1_i_media_engine_a373016642bf01cf22004522da6c36789}} 
\index{agora::media::IMediaEngine@{agora::media::IMediaEngine}!registerFaceInfoObserver@{registerFaceInfoObserver}}
\index{registerFaceInfoObserver@{registerFaceInfoObserver}!agora::media::IMediaEngine@{agora::media::IMediaEngine}}
\doxysubsubsection{\texorpdfstring{registerFaceInfoObserver()}{registerFaceInfoObserver()}}
{\footnotesize\ttfamily virtual int agora\+::media\+::\+I\+Media\+Engine\+::register\+Face\+Info\+Observer (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{classagora_1_1media_1_1_i_face_info_observer}{I\+Face\+Info\+Observer}} $\ast$}]{observer }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [pure virtual]}}



Registers or unregisters a facial information observer. 

You can call this method to register the {\ttfamily on\+Face\+Info} callback to receive the facial information processed by Agora speech driven extension. When calling this method to register a facial information observer, you can register callbacks in the {\ttfamily \mbox{\hyperlink{classagora_1_1media_1_1_i_face_info_observer}{I\+Face\+Info\+Observer}}} class as needed. After successfully registering the facial information observer, the S\+DK triggers the callback you have registered when it captures the facial information converted by the speech driven extension. Applicable scenarios\+: Facial information processed by the Agora speech driven extension is BS (Blend Shape) data that complies with A\+Rkit standards. You can further process the BS data using third-\/party 3D rendering engines, such as driving avatar to make mouth movements corresponding to speech.

\begin{DoxyNote}{Note}

\begin{DoxyItemize}
\item Call this method before joining a channel.
\item Before calling this method, you need to make sure that the speech driven extension has been enabled by calling {\ttfamily enable\+Extension}.
\end{DoxyItemize}
\end{DoxyNote}

\begin{DoxyParams}{Parameters}
{\em observer} & Facial information observer, see {\ttfamily \mbox{\hyperlink{classagora_1_1media_1_1_i_face_info_observer}{I\+Face\+Info\+Observer}}}. If you need to unregister a facial information observer, pass in N\+U\+LL.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}

\begin{DoxyItemize}
\item 0\+: Success.
\item $<$ 0\+: Failure. 
\end{DoxyItemize}
\end{DoxyReturn}
\mbox{\Hypertarget{classagora_1_1media_1_1_i_media_engine_a880ff35d3559a15965aa55837b05579a}\label{classagora_1_1media_1_1_i_media_engine_a880ff35d3559a15965aa55837b05579a}} 
\index{agora::media::IMediaEngine@{agora::media::IMediaEngine}!pushAudioFrame@{pushAudioFrame}}
\index{pushAudioFrame@{pushAudioFrame}!agora::media::IMediaEngine@{agora::media::IMediaEngine}}
\doxysubsubsection{\texorpdfstring{pushAudioFrame()}{pushAudioFrame()}}
{\footnotesize\ttfamily virtual int agora\+::media\+::\+I\+Media\+Engine\+::push\+Audio\+Frame (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{structagora_1_1media_1_1_i_audio_frame_observer_base_1_1_audio_frame}{I\+Audio\+Frame\+Observer\+Base\+::\+Audio\+Frame}} $\ast$}]{frame,  }\item[{rtc\+::track\+\_\+id\+\_\+t}]{track\+Id = {\ttfamily 0} }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [pure virtual]}}



Pushes the external audio frame. 

Call this method to push external audio frames through the audio track. Call timing\+: Before calling this method to push external audio data, perform the following steps\+:1. Call {\ttfamily create\+Custom\+Audio\+Track} to create a custom audio track and get the audio track ID.
\begin{DoxyEnumerate}
\item Call {\ttfamily join\+Channel(const char$\ast$ token, const char$\ast$ channel\+Id, uid\+\_\+t uid, const Channel\+Media\+Options\& options)} to join the channel. In {\ttfamily Channel\+Media\+Options}, set {\ttfamily publish\+Custom\+Audio\+Track\+Id} to the audio track ID that you want to publish, and set {\ttfamily publish\+Custom\+Audio\+Track} to {\ttfamily true}.
\end{DoxyEnumerate}


\begin{DoxyParams}{Parameters}
{\em frame} & The external audio frame. See {\ttfamily Audio\+Frame}. \\
\hline
{\em track\+Id} & The audio track ID. If you want to publish a custom external audio source, set this parameter to the ID of the corresponding custom audio track you want to publish.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}

\begin{DoxyItemize}
\item 0\+: Success.
\item $<$ 0\+: Failure. 
\end{DoxyItemize}
\end{DoxyReturn}
\mbox{\Hypertarget{classagora_1_1media_1_1_i_media_engine_ab40a4f31f73f3a775a5ea18dfeb25479}\label{classagora_1_1media_1_1_i_media_engine_ab40a4f31f73f3a775a5ea18dfeb25479}} 
\index{agora::media::IMediaEngine@{agora::media::IMediaEngine}!pullAudioFrame@{pullAudioFrame}}
\index{pullAudioFrame@{pullAudioFrame}!agora::media::IMediaEngine@{agora::media::IMediaEngine}}
\doxysubsubsection{\texorpdfstring{pullAudioFrame()}{pullAudioFrame()}}
{\footnotesize\ttfamily virtual int agora\+::media\+::\+I\+Media\+Engine\+::pull\+Audio\+Frame (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{structagora_1_1media_1_1_i_audio_frame_observer_base_1_1_audio_frame}{I\+Audio\+Frame\+Observer\+Base\+::\+Audio\+Frame}} $\ast$}]{frame }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [pure virtual]}}



Pulls the remote audio data. 

After a successful call of this method, the app pulls the decoded and mixed audio data for playback. Call timing\+: Call this method after joining a channel. Before calling this method, call {\ttfamily set\+External\+Audio\+Sink} {\ttfamily (enabled\+: true)} to notify the app to enable and set the external audio rendering.

\begin{DoxyNote}{Note}
Both this method and the {\ttfamily on\+Playback\+Audio\+Frame} callback can be used to get audio data after remote mixing. After calling {\ttfamily set\+External\+Audio\+Sink} to enable external audio rendering, the app will no longer be able to obtain data from the {\ttfamily on\+Playback\+Audio\+Frame} callback. Therefore, you should choose between this method and the {\ttfamily on\+Playback\+Audio\+Frame} callback based on your actual business requirements. The specific distinctions between them are as follows\+:
\begin{DoxyItemize}
\item After calling this method, the app automatically pulls the audio data from the S\+DK. By setting the audio data parameters, the S\+DK adjusts the frame buffer to help the app handle latency, effectively avoiding audio playback jitter.
\item After registering the {\ttfamily on\+Playback\+Audio\+Frame} callback, the S\+DK sends the audio data to the app through the callback. Any delay in processing the audio frames may result in audio jitter. This method is only used for retrieving audio data after remote mixing. If you need to get audio data from different audio processing stages such as capture and playback, you can register the corresponding callbacks by calling {\ttfamily register\+Audio\+Frame\+Observer}.
\end{DoxyItemize}
\end{DoxyNote}

\begin{DoxyParams}{Parameters}
{\em frame} & Pointers to {\ttfamily Audio\+Frame}.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}

\begin{DoxyItemize}
\item 0\+: Success.
\item $<$ 0\+: Failure. 
\end{DoxyItemize}
\end{DoxyReturn}
\mbox{\Hypertarget{classagora_1_1media_1_1_i_media_engine_a334e09a78fbdeb7cee691b15afa38b53}\label{classagora_1_1media_1_1_i_media_engine_a334e09a78fbdeb7cee691b15afa38b53}} 
\index{agora::media::IMediaEngine@{agora::media::IMediaEngine}!setExternalVideoSource@{setExternalVideoSource}}
\index{setExternalVideoSource@{setExternalVideoSource}!agora::media::IMediaEngine@{agora::media::IMediaEngine}}
\doxysubsubsection{\texorpdfstring{setExternalVideoSource()}{setExternalVideoSource()}}
{\footnotesize\ttfamily virtual int agora\+::media\+::\+I\+Media\+Engine\+::set\+External\+Video\+Source (\begin{DoxyParamCaption}\item[{bool}]{enabled,  }\item[{bool}]{use\+Texture,  }\item[{E\+X\+T\+E\+R\+N\+A\+L\+\_\+\+V\+I\+D\+E\+O\+\_\+\+S\+O\+U\+R\+C\+E\+\_\+\+T\+Y\+PE}]{source\+Type = {\ttfamily VIDEO\+\_\+FRAME},  }\item[{\mbox{\hyperlink{structagora_1_1rtc_1_1_sender_options}{rtc\+::\+Sender\+Options}}}]{encoded\+Video\+Option = {\ttfamily \mbox{\hyperlink{structagora_1_1rtc_1_1_sender_options}{rtc\+::\+Sender\+Options}}()} }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [pure virtual]}}



Configures the external video source. 

After calling this method to enable an external video source, you can call {\ttfamily push\+Video\+Frame} to push external video data to the S\+DK. Call timing\+: Call this method before joining a channel.

\begin{DoxyNote}{Note}
Dynamic switching of video sources is not supported within the channel. To switch from an external video source to an internal video source, you must first leave the channel, call this method to disable the external video source, and then rejoin the channel.
\end{DoxyNote}

\begin{DoxyParams}{Parameters}
{\em enabled} & Whether to use the external video source\+:
\begin{DoxyItemize}
\item {\ttfamily true}\+: Use the external video source. The S\+DK prepares to accept the external video frame.
\item {\ttfamily false}\+: (Default) Do not use the external video source. 
\end{DoxyItemize}\\
\hline
{\em use\+Texture} & Whether to use the external video frame in the Texture format.
\begin{DoxyItemize}
\item {\ttfamily true}\+: Use the external video frame in the Texture format.
\item {\ttfamily false}\+: (Default) Do not use the external video frame in the Texture format. 
\end{DoxyItemize}\\
\hline
{\em source\+Type} & Whether the external video frame is encoded. See {\ttfamily E\+X\+T\+E\+R\+N\+A\+L\+\_\+\+V\+I\+D\+E\+O\+\_\+\+S\+O\+U\+R\+C\+E\+\_\+\+T\+Y\+PE}. \\
\hline
{\em encoded\+Video\+Option} & Video encoding options. This parameter needs to be set if {\ttfamily source\+Type} is {\ttfamily E\+N\+C\+O\+D\+E\+D\+\_\+\+V\+I\+D\+E\+O\+\_\+\+F\+R\+A\+ME}. To set this parameter, contact {\ttfamily technical support}.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}

\begin{DoxyItemize}
\item 0\+: Success.
\item $<$ 0\+: Failure. 
\end{DoxyItemize}
\end{DoxyReturn}
\mbox{\Hypertarget{classagora_1_1media_1_1_i_media_engine_a9d8ffc684390f54f2258ddad1a8b69c8}\label{classagora_1_1media_1_1_i_media_engine_a9d8ffc684390f54f2258ddad1a8b69c8}} 
\index{agora::media::IMediaEngine@{agora::media::IMediaEngine}!setExternalAudioSource@{setExternalAudioSource}}
\index{setExternalAudioSource@{setExternalAudioSource}!agora::media::IMediaEngine@{agora::media::IMediaEngine}}
\doxysubsubsection{\texorpdfstring{setExternalAudioSource()}{setExternalAudioSource()}}
{\footnotesize\ttfamily virtual int agora\+::media\+::\+I\+Media\+Engine\+::set\+External\+Audio\+Source (\begin{DoxyParamCaption}\item[{bool}]{enabled,  }\item[{int}]{sample\+Rate,  }\item[{int}]{channels,  }\item[{bool}]{local\+Playback = {\ttfamily false},  }\item[{bool}]{publish = {\ttfamily true} }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [pure virtual]}}



Sets the external audio source parameters. 

\begin{DoxyRefDesc}{Deprecated}
\item[\mbox{\hyperlink{deprecated__deprecated000028}{Deprecated}}]This method is deprecated. Use create\+Custom\+Audio\+Track(rtc\+::\+A\+U\+D\+I\+O\+\_\+\+T\+R\+A\+C\+K\+\_\+\+T\+Y\+PE track\+Type, const \mbox{\hyperlink{structagora_1_1rtc_1_1_audio_track_config}{rtc\+::\+Audio\+Track\+Config}}\& config) instead.\end{DoxyRefDesc}


Call timing\+: Call this method before joining a channel.


\begin{DoxyParams}{Parameters}
{\em enabled} & Whether to enable the external audio source\+:
\begin{DoxyItemize}
\item {\ttfamily true}\+: Enable the external audio source.
\item {\ttfamily false}\+: (Default) Disable the external audio source. 
\end{DoxyItemize}\\
\hline
{\em sample\+Rate} & The sample rate (Hz) of the external audio source which can be set as {\ttfamily 8000}, {\ttfamily 16000}, {\ttfamily 32000}, {\ttfamily 44100}, or {\ttfamily 48000}. \\
\hline
{\em channels} & The number of channels of the external audio source, which can be set as {\ttfamily 1} (Mono) or {\ttfamily 2} (Stereo). \\
\hline
{\em local\+Playback} & Whether to play the external audio source\+:
\begin{DoxyItemize}
\item {\ttfamily true}\+: Play the external audio source.
\item {\ttfamily false}\+: (Default) Do not play the external source. 
\end{DoxyItemize}\\
\hline
{\em publish} & Whether to publish audio to the remote users\+:
\begin{DoxyItemize}
\item {\ttfamily true}\+: (Default) Publish audio to the remote users.
\item {\ttfamily false}\+: Do not publish audio to the remote users.
\end{DoxyItemize}\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}

\begin{DoxyItemize}
\item 0\+: Success.
\item $<$ 0\+: Failure. 
\end{DoxyItemize}
\end{DoxyReturn}
\mbox{\Hypertarget{classagora_1_1media_1_1_i_media_engine_adb9b0203cf06756db5357ea806058ab0}\label{classagora_1_1media_1_1_i_media_engine_adb9b0203cf06756db5357ea806058ab0}} 
\index{agora::media::IMediaEngine@{agora::media::IMediaEngine}!createCustomAudioTrack@{createCustomAudioTrack}}
\index{createCustomAudioTrack@{createCustomAudioTrack}!agora::media::IMediaEngine@{agora::media::IMediaEngine}}
\doxysubsubsection{\texorpdfstring{createCustomAudioTrack()}{createCustomAudioTrack()}}
{\footnotesize\ttfamily virtual rtc\+::track\+\_\+id\+\_\+t agora\+::media\+::\+I\+Media\+Engine\+::create\+Custom\+Audio\+Track (\begin{DoxyParamCaption}\item[{rtc\+::\+A\+U\+D\+I\+O\+\_\+\+T\+R\+A\+C\+K\+\_\+\+T\+Y\+PE}]{track\+Type,  }\item[{const \mbox{\hyperlink{structagora_1_1rtc_1_1_audio_track_config}{rtc\+::\+Audio\+Track\+Config}} \&}]{config }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [pure virtual]}}



Creates a custom audio track. 

To publish a custom audio source, see the following steps\+:1. Call this method to create a custom audio track and get the audio track ID.
\begin{DoxyEnumerate}
\item Call {\ttfamily join\+Channel(const char$\ast$ token, const char$\ast$ channel\+Id, uid\+\_\+t uid, const Channel\+Media\+Options\& options)} to join the channel. In {\ttfamily Channel\+Media\+Options}, set {\ttfamily publish\+Custom\+Audio\+Track\+Id} to the audio track ID that you want to publish, and set {\ttfamily publish\+Custom\+Audio\+Track} to {\ttfamily true}.
\item Call {\ttfamily push\+Audio\+Frame} and specify {\ttfamily track\+Id} as the audio track ID set in step 2. You can then publish the corresponding custom audio source in the channel.
\end{DoxyEnumerate}

\begin{DoxyNote}{Note}
Call this method before joining a channel.
\end{DoxyNote}

\begin{DoxyParams}{Parameters}
{\em track\+Type} & The type of the custom audio track. See {\ttfamily A\+U\+D\+I\+O\+\_\+\+T\+R\+A\+C\+K\+\_\+\+T\+Y\+PE}.Attention\+: If {\ttfamily A\+U\+D\+I\+O\+\_\+\+T\+R\+A\+C\+K\+\_\+\+D\+I\+R\+E\+CT} is specified for this parameter, you must set {\ttfamily publish\+Microphone\+Track} to {\ttfamily false} in {\ttfamily Channel\+Media\+Options} when calling {\ttfamily join\+Channel(const char$\ast$ token, const char$\ast$ channel\+Id, uid\+\_\+t uid, const Channel\+Media\+Options\& options)} to join the channel; otherwise, joining the channel fails and returns the error code -\/2. \\
\hline
{\em config} & The configuration of the custom audio track. See {\ttfamily Audio\+Track\+Config}.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}

\begin{DoxyItemize}
\item If the method call is successful, the audio track ID is returned as the unique identifier of the audio track.
\item If the method call fails, 0xffffffff is returned. 
\end{DoxyItemize}
\end{DoxyReturn}
\mbox{\Hypertarget{classagora_1_1media_1_1_i_media_engine_a11110e2c6005ef61b929198aedb9076d}\label{classagora_1_1media_1_1_i_media_engine_a11110e2c6005ef61b929198aedb9076d}} 
\index{agora::media::IMediaEngine@{agora::media::IMediaEngine}!destroyCustomAudioTrack@{destroyCustomAudioTrack}}
\index{destroyCustomAudioTrack@{destroyCustomAudioTrack}!agora::media::IMediaEngine@{agora::media::IMediaEngine}}
\doxysubsubsection{\texorpdfstring{destroyCustomAudioTrack()}{destroyCustomAudioTrack()}}
{\footnotesize\ttfamily virtual int agora\+::media\+::\+I\+Media\+Engine\+::destroy\+Custom\+Audio\+Track (\begin{DoxyParamCaption}\item[{rtc\+::track\+\_\+id\+\_\+t}]{track\+Id }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [pure virtual]}}



Destroys the specified audio track. 


\begin{DoxyParams}{Parameters}
{\em track\+Id} & The custom audio track ID returned in {\ttfamily create\+Custom\+Audio\+Track}.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}

\begin{DoxyItemize}
\item 0\+: Success.
\item $<$ 0\+: Failure. 
\end{DoxyItemize}
\end{DoxyReturn}
\mbox{\Hypertarget{classagora_1_1media_1_1_i_media_engine_a82123ecb70f84c772ef84fa4ee16fba9}\label{classagora_1_1media_1_1_i_media_engine_a82123ecb70f84c772ef84fa4ee16fba9}} 
\index{agora::media::IMediaEngine@{agora::media::IMediaEngine}!setExternalAudioSink@{setExternalAudioSink}}
\index{setExternalAudioSink@{setExternalAudioSink}!agora::media::IMediaEngine@{agora::media::IMediaEngine}}
\doxysubsubsection{\texorpdfstring{setExternalAudioSink()}{setExternalAudioSink()}}
{\footnotesize\ttfamily virtual int agora\+::media\+::\+I\+Media\+Engine\+::set\+External\+Audio\+Sink (\begin{DoxyParamCaption}\item[{bool}]{enabled,  }\item[{int}]{sample\+Rate,  }\item[{int}]{channels }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [pure virtual]}}



Sets the external audio sink. 

After enabling the external audio sink, you can call {\ttfamily pull\+Audio\+Frame} to pull remote audio frames. The app can process the remote audio and play it with the audio effects that you want. Applicable scenarios\+: This method applies to scenarios where you want to use external audio data for playback. Call timing\+: Call this method before joining a channel.

\begin{DoxyNote}{Note}
Once you enable the external audio sink, the app will not retrieve any audio data from the {\ttfamily on\+Playback\+Audio\+Frame} callback.
\end{DoxyNote}

\begin{DoxyParams}{Parameters}
{\em enabled} & Whether to enable or disable the external audio sink\+:
\begin{DoxyItemize}
\item {\ttfamily true}\+: Enables the external audio sink.
\item {\ttfamily false}\+: (Default) Disables the external audio sink. 
\end{DoxyItemize}\\
\hline
{\em sample\+Rate} & The sample rate (Hz) of the external audio sink, which can be set as 16000, 32000, 44100, or 48000. \\
\hline
{\em channels} & The number of audio channels of the external audio sink\+:
\begin{DoxyItemize}
\item 1\+: Mono.
\item 2\+: Stereo.
\end{DoxyItemize}\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}

\begin{DoxyItemize}
\item 0\+: Success.
\item $<$ 0\+: Failure. 
\end{DoxyItemize}
\end{DoxyReturn}
\mbox{\Hypertarget{classagora_1_1media_1_1_i_media_engine_aed022bc54436117acc5cd3e1fffc2bba}\label{classagora_1_1media_1_1_i_media_engine_aed022bc54436117acc5cd3e1fffc2bba}} 
\index{agora::media::IMediaEngine@{agora::media::IMediaEngine}!enableCustomAudioLocalPlayback@{enableCustomAudioLocalPlayback}}
\index{enableCustomAudioLocalPlayback@{enableCustomAudioLocalPlayback}!agora::media::IMediaEngine@{agora::media::IMediaEngine}}
\doxysubsubsection{\texorpdfstring{enableCustomAudioLocalPlayback()}{enableCustomAudioLocalPlayback()}}
{\footnotesize\ttfamily virtual int agora\+::media\+::\+I\+Media\+Engine\+::enable\+Custom\+Audio\+Local\+Playback (\begin{DoxyParamCaption}\item[{rtc\+::track\+\_\+id\+\_\+t}]{track\+Id,  }\item[{bool}]{enabled }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [pure virtual]}}

Sets the external audio track.

\begin{DoxyNote}{Note}
Ensure that you call this method before joining the channel.
\end{DoxyNote}

\begin{DoxyParams}{Parameters}
{\em track\+Id} & The custom audio track id. \\
\hline
{\em enabled} & Enable/\+Disables the local playback of external audio track\+:
\begin{DoxyItemize}
\item true\+: Enable local playback
\item false\+: Do not enable local playback 
\end{DoxyItemize}\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}

\begin{DoxyItemize}
\item 0\+: Success.
\item $<$ 0\+: Failure. 
\end{DoxyItemize}
\end{DoxyReturn}
\mbox{\Hypertarget{classagora_1_1media_1_1_i_media_engine_a3e847e920dcdb1f5c61cfdbb86f4f7c4}\label{classagora_1_1media_1_1_i_media_engine_a3e847e920dcdb1f5c61cfdbb86f4f7c4}} 
\index{agora::media::IMediaEngine@{agora::media::IMediaEngine}!pushVideoFrame@{pushVideoFrame}}
\index{pushVideoFrame@{pushVideoFrame}!agora::media::IMediaEngine@{agora::media::IMediaEngine}}
\doxysubsubsection{\texorpdfstring{pushVideoFrame()}{pushVideoFrame()}}
{\footnotesize\ttfamily virtual int agora\+::media\+::\+I\+Media\+Engine\+::push\+Video\+Frame (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{structagora_1_1media_1_1base_1_1_external_video_frame}{base\+::\+External\+Video\+Frame}} $\ast$}]{frame,  }\item[{unsigned int}]{video\+Track\+Id = {\ttfamily 0} }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [pure virtual]}}



Pushes the external raw video frame to the S\+DK through video tracks. 

To publish a custom video source, see the following steps\+:1. Call {\ttfamily create\+Custom\+Video\+Track} to create a video track and get the video track ID.
\begin{DoxyEnumerate}
\item Call {\ttfamily join\+Channel(const char$\ast$ token, const char$\ast$ channel\+Id, uid\+\_\+t uid, const Channel\+Media\+Options\& options)} to join the channel. In {\ttfamily Channel\+Media\+Options}, set {\ttfamily custom\+Video\+Track\+Id} to the video track ID that you want to publish, and set {\ttfamily publish\+Custom\+Video\+Track} to {\ttfamily true}.
\item Call this method and specify {\ttfamily video\+Track\+Id} as the video track ID set in step 2. You can then publish the corresponding custom video source in the channel. Applicable scenarios\+: The S\+DK supports the I\+D3\+D11\+Texture2D video format since v4.\+2.\+3, which is widely used in game scenarios. When you need to push this type of video frame to the S\+DK, call this method and set the {\ttfamily format} in the {\ttfamily frame} to {\ttfamily V\+I\+D\+E\+O\+\_\+\+T\+E\+X\+T\+U\+R\+E\+\_\+\+I\+D3\+D11\+T\+E\+X\+T\+U\+R\+E2D}, set the {\ttfamily d3d11\+\_\+texture\+\_\+2d} and {\ttfamily texture\+\_\+slice\+\_\+index} members, and set the format of the video frame to I\+D3\+D11\+Texture2D.
\end{DoxyEnumerate}

\begin{DoxyNote}{Note}
If you only need to push one custom video source to the channel, you can directly call the {\ttfamily set\+External\+Video\+Source} method and the S\+DK will automatically create a video track with the {\ttfamily video\+Track\+Id} set to 0. D\+A\+N\+G\+ER\+: After calling this method, even if you stop pushing external video frames to the S\+DK, the custom video stream will still be counted as the video duration usage and incur charges. Agora recommends that you take appropriate measures based on the actual situation to avoid such video billing.
\begin{DoxyItemize}
\item If you no longer need to capture external video data, you can call {\ttfamily destroy\+Custom\+Video\+Track} to destroy the custom video track.
\item If you only want to use the external video data for local preview and not publish it in the channel, you can call {\ttfamily mute\+Local\+Video\+Stream} to cancel sending video stream or call {\ttfamily update\+Channel\+Media\+Options} to set {\ttfamily publish\+Custom\+Video\+Track} to {\ttfamily false}.
\end{DoxyItemize}
\end{DoxyNote}

\begin{DoxyParams}{Parameters}
{\em frame} & The external raw video frame to be pushed. See {\ttfamily External\+Video\+Frame}. \\
\hline
{\em video\+Track\+Id} & The video track ID returned by calling the {\ttfamily create\+Custom\+Video\+Track} method.\+Note\+: If you only need to push one custom video source, set {\ttfamily video\+Track\+Id} to 0.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}

\begin{DoxyItemize}
\item 0\+: Success.
\item $<$ 0\+: Failure. 
\end{DoxyItemize}
\end{DoxyReturn}
\mbox{\Hypertarget{classagora_1_1media_1_1_i_media_engine_ae2b717dafdf9245d70caf5a2ecd2f9be}\label{classagora_1_1media_1_1_i_media_engine_ae2b717dafdf9245d70caf5a2ecd2f9be}} 
\index{agora::media::IMediaEngine@{agora::media::IMediaEngine}!pushEncodedVideoImage@{pushEncodedVideoImage}}
\index{pushEncodedVideoImage@{pushEncodedVideoImage}!agora::media::IMediaEngine@{agora::media::IMediaEngine}}
\doxysubsubsection{\texorpdfstring{pushEncodedVideoImage()}{pushEncodedVideoImage()}}
{\footnotesize\ttfamily virtual int agora\+::media\+::\+I\+Media\+Engine\+::push\+Encoded\+Video\+Image (\begin{DoxyParamCaption}\item[{const unsigned char $\ast$}]{image\+Buffer,  }\item[{size\+\_\+t}]{length,  }\item[{const \mbox{\hyperlink{structagora_1_1rtc_1_1_encoded_video_frame_info}{agora\+::rtc\+::\+Encoded\+Video\+Frame\+Info}} \&}]{video\+Encoded\+Frame\+Info,  }\item[{unsigned int}]{video\+Track\+Id = {\ttfamily 0} }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [pure virtual]}}

Pushes the encoded video image to the app. 
\begin{DoxyParams}{Parameters}
{\em image\+Buffer} & A pointer to the video image. \\
\hline
{\em length} & The data length. \\
\hline
{\em video\+Encoded\+Frame\+Info} & The reference to the information of the encoded video frame\+: \mbox{\hyperlink{structagora_1_1rtc_1_1_encoded_video_frame_info}{Encoded\+Video\+Frame\+Info}}. \\
\hline
{\em video\+Track\+Id} & The id of the video track.
\begin{DoxyItemize}
\item 0\+: Success.
\item $<$ 0\+: Failure. 
\end{DoxyItemize}\\
\hline
\end{DoxyParams}
\mbox{\Hypertarget{classagora_1_1media_1_1_i_media_engine_a17df8dbc9b56bf4ecd8cac32a7b0bb2a}\label{classagora_1_1media_1_1_i_media_engine_a17df8dbc9b56bf4ecd8cac32a7b0bb2a}} 
\index{agora::media::IMediaEngine@{agora::media::IMediaEngine}!addVideoFrameRenderer@{addVideoFrameRenderer}}
\index{addVideoFrameRenderer@{addVideoFrameRenderer}!agora::media::IMediaEngine@{agora::media::IMediaEngine}}
\doxysubsubsection{\texorpdfstring{addVideoFrameRenderer()}{addVideoFrameRenderer()}}
{\footnotesize\ttfamily virtual int agora\+::media\+::\+I\+Media\+Engine\+::add\+Video\+Frame\+Renderer (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{classagora_1_1media_1_1_i_video_frame_observer}{I\+Video\+Frame\+Observer}} $\ast$}]{renderer }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [pure virtual]}}

@hide For internal usage only \mbox{\Hypertarget{classagora_1_1media_1_1_i_media_engine_a3a41f7d0bc2ce4d3461113b9cccba336}\label{classagora_1_1media_1_1_i_media_engine_a3a41f7d0bc2ce4d3461113b9cccba336}} 
\index{agora::media::IMediaEngine@{agora::media::IMediaEngine}!removeVideoFrameRenderer@{removeVideoFrameRenderer}}
\index{removeVideoFrameRenderer@{removeVideoFrameRenderer}!agora::media::IMediaEngine@{agora::media::IMediaEngine}}
\doxysubsubsection{\texorpdfstring{removeVideoFrameRenderer()}{removeVideoFrameRenderer()}}
{\footnotesize\ttfamily virtual int agora\+::media\+::\+I\+Media\+Engine\+::remove\+Video\+Frame\+Renderer (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{classagora_1_1media_1_1_i_video_frame_observer}{I\+Video\+Frame\+Observer}} $\ast$}]{renderer }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [pure virtual]}}

@hide For internal usage only 