Package io.agora.mediaplayer
Interface IMediaPlayerCustomDataProvider
public interface IMediaPlayerCustomDataProvider
-
Method Summary
Modifier and TypeMethodDescriptionintonReadData(ByteBuffer buffer, int bufferSize) longonSeek(long offset, int whence)
-
Method Details
-
onReadData
- Parameters:
buffer- An input parameter. Data buffer (bytes). Write the `bufferSize` data reported by the SDK into this parameter.bufferSize- The length of the data buffer (bytes).- Returns:
- - If the data is read successfully, pass in the length of the data (bytes) you actually read in the return value. - If reading the data fails, pass in 0 in the return value.
-
onSeek
long onSeek(long offset, int whence) - Parameters:
offset- An input parameter. The offset of the target position relative to the starting point, in bytes. The value can be positive or negative.whence- An input parameter. The starting point. You can set it as one of the following values: - 0: The starting point is the head of the data, and the actual data offset after seeking is `offset`. - 1: The starting point is the current position, and the actual data offset after seeking is the current position plus `offset`. - 2: The starting point is the end of the data, and the actual data offset after seeking is the whole data length plus `offset`. - 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 MP3 and WAV.- Returns:
- - When `whence` is `65536`, the media file size is returned. - When `whence` is `0`, `1`, or `2`, the actual data offset after the seeking is returned. - -1: Seeking failed.
-