Agora C++ API Reference for All Platforms

Loading...
Searching...
No Matches
Public Member Functions | List of all members
agora::media::base::IMediaPlayerCustomDataProvider Class Referenceabstract

`#include <AgoraMediaPlayerTypes.h>`

## Public Member Functions
virtual int | onReadData (unsigned char *buffer, int bufferSize)=0
virtual int64_t | onSeek (int64_t offset, int whence)=0
virtual | ~IMediaPlayerCustomDataProvider ()

## 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.

## Constructor & Destructor Documentation

## ◆ ~IMediaPlayerCustomDataProvider()

virtual agora::media::base::IMediaPlayerCustomDataProvider::~IMediaPlayerCustomDataProvider | ( |  | ) |
| inline virtual

## Member Function Documentation

## ◆ onReadData()

virtual int agora::media::base::IMediaPlayerCustomDataProvider::onReadData | ( | unsigned char * | buffer,
|  | int | bufferSize )
| pure virtual

The player requests to read the data callback, you need to fill the specified length of data into the buffer.

Parameters

  buffer | the buffer pointer that you need to fill data.
  bufferSize | the bufferSize need to fill of the buffer pointer.

Returns
  you need return offset value if succeed. return 0 if failed.

## ◆ onSeek()

virtual int64_t agora::media::base::IMediaPlayerCustomDataProvider::onSeek | ( | int64_t | offset,
|  | int | whence )
| pure virtual

The Player seek event callback, you need to operate the corresponding stream seek operation, You can refer to the definition of lseek() at https://man7.org/linux/man-pages/man2/lseek.2.html.

Parameters

  offset | the value of seek offset.
  whence | the postion of start seeking, the directive whence as follows: 0 - SEEK_SET : The file offset is set to offset bytes. 1 - SEEK_CUR : The file offset is set to its current location plus offset bytes. 2 - SEEK_END : The file offset is set to the size of the file plus offset bytes. 65536 - AVSEEK_SIZE : Optional. Passing this as the "whence" parameter to a seek function causes it to return the filesize without seeking anywhere.

Returns
  whence == 65536, return filesize if you need. whence >= 0 && whence < 3 , return offset value if succeed. return -1 if failed.