stopPlayer method
Stop a playback.
This verb never throw any exception. It is safe to call it everywhere, for example when the App is not sure of the current Audio State and want to recover a clean reset state.
Example:
await myPlayer.stopPlayer();
if (_playerSubscription != null)
{
_playerSubscription.cancel();
_playerSubscription = null;
}
Implementation
Future<void> stopPlayer() async {
await _lock.synchronized(() async {
await _stopPlayer();
});
}