\hypertarget{classagora_1_1media_1_1base_1_1_i_media_player_custom_data_provider}{}\doxysection{agora\+::media\+::base\+::I\+Media\+Player\+Custom\+Data\+Provider Class Reference}
\label{classagora_1_1media_1_1base_1_1_i_media_player_custom_data_provider}\index{agora::media::base::IMediaPlayerCustomDataProvider@{agora::media::base::IMediaPlayerCustomDataProvider}}


{\ttfamily \#include $<$Agora\+Media\+Player\+Types.\+h$>$}

\doxysubsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
virtual int \mbox{\hyperlink{classagora_1_1media_1_1base_1_1_i_media_player_custom_data_provider_abbc1b16e00175269c7f21f9e8cb13a38}{on\+Read\+Data}} (unsigned char $\ast$buffer, int buffer\+Size)=0
\begin{DoxyCompactList}\small\item\em Occurs when the S\+DK reads the media resource data. \end{DoxyCompactList}\item 
virtual int64\+\_\+t \mbox{\hyperlink{classagora_1_1media_1_1base_1_1_i_media_player_custom_data_provider_a239a0ee3039f4c5df636738924ef0bb5}{on\+Seek}} (int64\+\_\+t offset, int whence)=0
\begin{DoxyCompactList}\small\item\em Occurs when the S\+DK seeks the media resource data. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
The custom data source provides a data stream input callback, and the player will continue to call back this interface, requesting the user to fill in the data that needs to be played. 

\doxysubsection{Member Function Documentation}
\mbox{\Hypertarget{classagora_1_1media_1_1base_1_1_i_media_player_custom_data_provider_abbc1b16e00175269c7f21f9e8cb13a38}\label{classagora_1_1media_1_1base_1_1_i_media_player_custom_data_provider_abbc1b16e00175269c7f21f9e8cb13a38}} 
\index{agora::media::base::IMediaPlayerCustomDataProvider@{agora::media::base::IMediaPlayerCustomDataProvider}!onReadData@{onReadData}}
\index{onReadData@{onReadData}!agora::media::base::IMediaPlayerCustomDataProvider@{agora::media::base::IMediaPlayerCustomDataProvider}}
\doxysubsubsection{\texorpdfstring{onReadData()}{onReadData()}}
{\footnotesize\ttfamily virtual int agora\+::media\+::base\+::\+I\+Media\+Player\+Custom\+Data\+Provider\+::on\+Read\+Data (\begin{DoxyParamCaption}\item[{unsigned char $\ast$}]{buffer,  }\item[{int}]{buffer\+Size }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [pure virtual]}}



Occurs when the S\+DK reads the media resource data. 

When you call the {\ttfamily open\+With\+Media\+Source} method to open a media resource, the S\+DK triggers this callback and request you to pass in the buffer of the media resource data.


\begin{DoxyParams}{Parameters}
{\em buffer} & An input parameter. Data buffer (bytes). Write the {\ttfamily buffer\+Size} data reported by the S\+DK into this parameter. \\
\hline
{\em buffer\+Size} & The length of the data buffer (bytes).\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}

\begin{DoxyItemize}
\item If the data is read successfully, pass in the length of the data (bytes) you actually read in the return value.
\item If reading the data fails, pass in 0 in the return value. 
\end{DoxyItemize}
\end{DoxyReturn}
\mbox{\Hypertarget{classagora_1_1media_1_1base_1_1_i_media_player_custom_data_provider_a239a0ee3039f4c5df636738924ef0bb5}\label{classagora_1_1media_1_1base_1_1_i_media_player_custom_data_provider_a239a0ee3039f4c5df636738924ef0bb5}} 
\index{agora::media::base::IMediaPlayerCustomDataProvider@{agora::media::base::IMediaPlayerCustomDataProvider}!onSeek@{onSeek}}
\index{onSeek@{onSeek}!agora::media::base::IMediaPlayerCustomDataProvider@{agora::media::base::IMediaPlayerCustomDataProvider}}
\doxysubsubsection{\texorpdfstring{onSeek()}{onSeek()}}
{\footnotesize\ttfamily virtual int64\+\_\+t agora\+::media\+::base\+::\+I\+Media\+Player\+Custom\+Data\+Provider\+::on\+Seek (\begin{DoxyParamCaption}\item[{int64\+\_\+t}]{offset,  }\item[{int}]{whence }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [pure virtual]}}



Occurs when the S\+DK seeks the media resource data. 

When you call the {\ttfamily open\+With\+Media\+Source} or {\ttfamily open} method to open a custom media resource, the S\+DK triggers this callback to request the specified location in the media resource.


\begin{DoxyParams}{Parameters}
{\em offset} & An input parameter. The offset of the target position relative to the starting point, in bytes. The value can be positive or negative. \\
\hline
{\em whence} & An input parameter. The starting point. You can set it as one of the following values\+:
\begin{DoxyItemize}
\item 0\+: The starting point is the head of the data, and the actual data offset after seeking is {\ttfamily offset}.
\item 1\+: The starting point is the current position, and the actual data offset after seeking is the current position plus {\ttfamily offset}.
\item 2\+: The starting point is the end of the data, and the actual data offset after seeking is the whole data length plus {\ttfamily offset}.
\item 65536\+: Do not perform position seeking, return the file size. Agora recommends that you use this parameter value when playing pure audio files such as M\+P3 and W\+AV.
\end{DoxyItemize}\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}

\begin{DoxyItemize}
\item When {\ttfamily whence} is {\ttfamily 65536}, the media file size is returned.
\item When {\ttfamily whence} is {\ttfamily 0}, {\ttfamily 1}, or {\ttfamily 2}, the actual data offset after the seeking is returned.
\item -\/1\+: Seeking failed. 
\end{DoxyItemize}
\end{DoxyReturn}
