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) {