onReadData
Callback triggered when the SDK reads media resource data.
virtual int onReadData(unsigned char *buffer, int bufferSize) = 0;
When you call the openWithMediaSource method to open a media resource, the SDK triggers this callback and requests you to provide a buffer for the media resource data.
Parameters
- buffer
- Output parameter indicating the data buffer (in bytes). You need to write data of size
bufferSizerequested by the SDK into this buffer. - bufferSize
- Length of the data buffer (in bytes).
Return Values
- If the data is read successfully, returns the actual number of bytes read.
- If the read fails, returns 0.