suspend method

Future<void> suspend()

Suspends the audio thread: it stops calling the worklet, so it stops consuming.

This is the whole of pause. The producer needs no telling — with nothing draining the ring it fills, and the producer blocks on backpressure. It is also what makes a seek safe, by removing the consumer that a ring clear would otherwise race.

Implementation

Future<void> suspend() async {
  try {
    await _context.suspend().toDart;
  } on Object {
    // Already suspended or already closed.
  }
}