feat: sort tracks by their id in AudioPlayer on get_tracks

This commit is contained in:
2026-01-24 23:59:23 +03:00
parent f7f96abcbb
commit 03e936ac34
+5 -2
View File
@@ -315,7 +315,8 @@ impl AudioPlayer {
}
pub fn get_tracks(&self) -> Vec<TrackInfo> {
self.tracks
let mut tracks: Vec<_> = self
.tracks
.values()
.map(|sound| TrackInfo {
id: sound.id,
@@ -326,7 +327,9 @@ impl AudioPlayer {
looped: sound.looped,
paused: sound.sink.is_paused(),
})
.collect()
.collect();
tracks.sort_by_key(|t| t.id);
tracks
}
pub async fn update(&mut self) {