I found this code for **listening to Audio Position ** using package audioplayers
.
But the onAudioPositionChanged
features seems to be deprecated now. Does anyone know its replacement or how to listen the audio position using audioplayers in 2023?
code:
// //listen to audio position
audioPlayer.onAudioPositionChanged.listen((newPosition){
setState(() {
position = newPosition;
});
});
You can use onPositionChanged
on intestate.
_positionSubscription = audioPlayer.onPositionChanged.listen(
(p) => setState(() => _position = p),
);