mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 09:46:36 +00:00
Prevent negative media player progress (#14547)
This commit is contained in:
parent
4c5f4508b2
commit
65cef9d996
@ -210,7 +210,10 @@ export const getCurrentProgress = (stateObj: MediaPlayerEntity): number => {
|
||||
(Date.now() -
|
||||
new Date(stateObj.attributes.media_position_updated_at!).getTime()) /
|
||||
1000.0;
|
||||
return progress;
|
||||
// Prevent negative values, so we do not go back to 59:59 at the start
|
||||
// for example if there are slight clock sync deltas between backend and frontend and
|
||||
// therefore media_position_updated_at might be slightly larger than Date.now().
|
||||
return progress < 0 ? 0 : progress;
|
||||
};
|
||||
|
||||
export const computeMediaDescription = (
|
||||
|
Loading…
x
Reference in New Issue
Block a user