'How can I save the current time stamp for audio progress in flutter
I am creating a podcast app using Just audio.
How can I save the current timestamp, so that the playback will start from the same location the next time the app is opened?
Solution 1:[1]
You can listen to events of positionStream method:
audioPlayer.positionStream.listen((event) {
if (event.inMilliseconds != 0) {
var duration = audioPlayer.duration!.inMilliseconds; //get the duration of audio
progress = (event.inMilliseconds / duration)*100 // get the current position in percent
}
});
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Fateme Afshari |
