pause method

Future<void> pause()

Pauses the audio that is currently playing.

If you call resume later, the audio will resume from the point that it has been paused.

Implementation

Future<void> pause() async {
  desiredState = PlayerState.paused;
  await creatingCompleter.future;
  if (desiredState == PlayerState.paused) {
    await _platform.pause(playerId);
    state = PlayerState.paused;
    await _positionUpdater?.stopAndUpdate();
  }
}