stopVoiceMessage method
Future<void>
stopVoiceMessage(
{ - bool notify = true,
})
Implementation
Future<void> stopVoiceMessage({bool notify = true}) async {
if (_disposed) return;
_currentPlayingMessageId = null;
_state = RCKAudioPlayerState.stopped;
// 取消播放状态监听
_playerStateSubscription?.cancel();
_playerStateSubscription = null;
if (!notify) {
if (_player.playerState.playing) {
_player.stop();
}
} else {
if (_player.playerState.playing) {
await _player.stop();
}
if (!_disposed) {
notifyListeners();
}
}
}