closeAudioSession method

Future<void> closeAudioSession()

Close an open session.

Must be called when finished with a Player, to release all the resources. It is safe to call this procedure at any time.

  • If the Player is not open, this verb will do nothing
  • If the Player is currently in play or pause mode, it will be stopped before.

example:

@override
void dispose()
{
        if (myPlayer != null)
        {
            myPlayer.closeAudioSession();
            myPlayer = null;
        }
        super.dispose();
}

Implementation

Future<void> closeAudioSession() async {
  await _lock.synchronized(() async {
    await _closeAudioSession();
  });
}