bufferedTimeRanges method

List<DurationRange> bufferedTimeRanges()

Implementation

List<DurationRange> bufferedTimeRanges() {
  const int n = 16;
  final cbytes = calloc<Int64>(2 * n);
  final count = _player.ref.bufferedTimeRanges.asFunction<
          int Function(Pointer<mdkPlayer>, Pointer<Int64>, int)>()(
      _player.ref.object, cbytes, n);
  var ret = <DurationRange>[];
  for (int i = 0; i < min(count, n); ++i) {
    ret.add(DurationRange(Duration(milliseconds: cbytes[2 * i].toInt()),
        Duration(milliseconds: cbytes[2 * i + 1].toInt())));
  }
  calloc.free(cbytes);
  return ret;
}