closePlayer method

Future<void> closePlayer()

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> closePlayer() async {
  await _lock.synchronized(() {
    return _closeAudioSession();
  });
}