Carry track duration through the queue pipeline
ApiTrackLike/QueueItem had no duration field, so toQueueItem(s) always dropped it and toTrack() hardcoded a new track's duration to 0, relying entirely on the <audio> element's durationchange/loadedmetadata events to fill it in once that track actually became current. Upcoming queue rows never reach that point, so "A continuación" always showed a blank duration even though the backend already returns it. Add duration to both types, thread it through toQueueItems/toQueueItem/ trackFromQueueItem, and seed toTrack() from it. The real-time audio sync still overwrites it once a track actually plays, so this only fills the gap for tracks that haven't played yet. Also map MixItemApplicationResponse's durationSeconds through mixItemTrack, since mixes use a differently-named field.
This commit is contained in:
@@ -13,6 +13,7 @@ export function mixItemTrack(item: MixItem): ApiTrackLike {
|
||||
id: item.trackId,
|
||||
title: item.title,
|
||||
artist: item.artist,
|
||||
duration: item.durationSeconds,
|
||||
listensCount: item.listensCount
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user