\hypertarget{interfaceio_1_1agora_1_1mediaplayer_1_1_i_media_player_custom_data_provider}{}\doxysection{io.\+agora.\+mediaplayer.\+I\+Media\+Player\+Custom\+Data\+Provider Interface Reference}
\label{interfaceio_1_1agora_1_1mediaplayer_1_1_i_media_player_custom_data_provider}\index{io.agora.mediaplayer.IMediaPlayerCustomDataProvider@{io.agora.mediaplayer.IMediaPlayerCustomDataProvider}}
\doxysubsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
int \mbox{\hyperlink{interfaceio_1_1agora_1_1mediaplayer_1_1_i_media_player_custom_data_provider_aed1200962dbadfd57dc399fcac451c9f}{on\+Read\+Data}} (Byte\+Buffer buffer, int buffer\+Size)
\begin{DoxyCompactList}\small\item\em Occurs when the S\+DK reads the media resource data. \end{DoxyCompactList}\item 
long \mbox{\hyperlink{interfaceio_1_1agora_1_1mediaplayer_1_1_i_media_player_custom_data_provider_acd9779aff1bb58c992e82b3f590ef32f}{on\+Seek}} (long offset, int whence)
\begin{DoxyCompactList}\small\item\em Occurs when the S\+DK seeks the media resource data. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Member Function Documentation}
\mbox{\Hypertarget{interfaceio_1_1agora_1_1mediaplayer_1_1_i_media_player_custom_data_provider_aed1200962dbadfd57dc399fcac451c9f}\label{interfaceio_1_1agora_1_1mediaplayer_1_1_i_media_player_custom_data_provider_aed1200962dbadfd57dc399fcac451c9f}} 
\index{io.agora.mediaplayer.IMediaPlayerCustomDataProvider@{io.agora.mediaplayer.IMediaPlayerCustomDataProvider}!onReadData@{onReadData}}
\index{onReadData@{onReadData}!io.agora.mediaplayer.IMediaPlayerCustomDataProvider@{io.agora.mediaplayer.IMediaPlayerCustomDataProvider}}
\doxysubsubsection{\texorpdfstring{onReadData()}{onReadData()}}
{\footnotesize\ttfamily int io.\+agora.\+mediaplayer.\+I\+Media\+Player\+Custom\+Data\+Provider.\+on\+Read\+Data (\begin{DoxyParamCaption}\item[{Byte\+Buffer}]{buffer,  }\item[{int}]{buffer\+Size }\end{DoxyParamCaption})}



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{interfaceio_1_1agora_1_1mediaplayer_1_1_i_media_player_custom_data_provider_acd9779aff1bb58c992e82b3f590ef32f}\label{interfaceio_1_1agora_1_1mediaplayer_1_1_i_media_player_custom_data_provider_acd9779aff1bb58c992e82b3f590ef32f}} 
\index{io.agora.mediaplayer.IMediaPlayerCustomDataProvider@{io.agora.mediaplayer.IMediaPlayerCustomDataProvider}!onSeek@{onSeek}}
\index{onSeek@{onSeek}!io.agora.mediaplayer.IMediaPlayerCustomDataProvider@{io.agora.mediaplayer.IMediaPlayerCustomDataProvider}}
\doxysubsubsection{\texorpdfstring{onSeek()}{onSeek()}}
{\footnotesize\ttfamily long io.\+agora.\+mediaplayer.\+I\+Media\+Player\+Custom\+Data\+Provider.\+on\+Seek (\begin{DoxyParamCaption}\item[{long}]{offset,  }\item[{int}]{whence }\end{DoxyParamCaption})}



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

When you call the {\ttfamily open\+With\+Media\+Source} or {\ttfamily open(\+String url, long start\+Pos)} 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}
