isEnded method

Future<bool> isEnded()

True once the worker has decoded the last packet AND the device has played everything it wrote.

Implementation

Future<bool> isEnded() async {
  if (_closed) return true;
  if (_sink.ring.availableFrames > 0) return false;
  try {
    final stats = await _worker.request<Object?>('stats');
    return ((stats! as Map<String, Object?>)['eof'] as bool?) ?? false;
  } on Object {
    return false;
  }
}