onReadData method

FutureOr<int> onReadData(
  1. ByteBuffer buffer,
  2. int bufferSize
)

@valid since 3.53 @detail callback @author songxiaomeng.19 @brief 调用 openWithCustomSource{@link #IMediaPlayer#openWithCustomSource} 接口播放用户传入的内存音频数据时,会触发此回调,用户需要写入音频数据。 @param buffer 内存地址。在该地址中写入音频数据,写入音频数据的大小不超过 bufferSize 中填入的数值。支持的音频数据格式有: mp3,aac,m4a,3gp,wav。 @param bufferSize 音频数据大小,单位为字节。如果你想停止播放内存音频数据,可在 bufferSize 中填入小于或等于 0 的数,此时 SDK 会停止调用此接口。 @return 返回实际读取的音频数据大小。 @note 若 openWithCustomSource{@link #IMediaPlayer#openWithCustomSource} 接口调用失败,请在 buffer 和 bufferSize 两个参数中填入 0。 此时 SDK 会停止调用此接口。

Implementation

FutureOr<int> onReadData(ByteBuffer buffer, int bufferSize) async {
  throw UnimplementedError();
}