Media Card: Fix Progress update (#5096)

This commit is contained in:
Zack Arnett 2020-03-08 01:00:52 -05:00 committed by GitHub
parent 8e7ef58715
commit b72d8cf7d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -24,6 +24,10 @@ export interface MediaPlayerThumbnail {
export const getCurrentProgress = (stateObj: HassEntity): number => {
let progress = stateObj.attributes.media_position;
if (stateObj.state !== "playing") {
return progress;
}
progress +=
(Date.now() -
new Date(stateObj.attributes.media_position_updated_at).getTime()) /