From 4503eb31edbe42ea2c769e16e296acd26d5f632e Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Wed, 13 Feb 2019 17:53:57 +0100 Subject: [PATCH] Clear track elapsed time display on stop event --- platypush/backend/http/static/js/widgets/music.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/platypush/backend/http/static/js/widgets/music.js b/platypush/backend/http/static/js/widgets/music.js index e74e08c6..dc8e6838 100644 --- a/platypush/backend/http/static/js/widgets/music.js +++ b/platypush/backend/http/static/js/widgets/music.js @@ -90,6 +90,11 @@ $(document).ready(function() { refreshElapsedInterval = undefined; } + if (time === undefined) { + $timeElapsedElement.text('-:--'); + return; + } + timeElapsed = parseInt(time); $timeElapsedElement.text(secondsToTimeString(timeElapsed)); @@ -111,6 +116,9 @@ $(document).ready(function() { if ('state' in status) { setState(state=status.state); + if (status.state === 'stop') { + setTrackElapsed(); + } } if ('elapsed' in status) {