From 7947c1031d3e6b803166d6e088909174c487a1ef Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Tue, 29 Sep 2020 15:58:23 +0200 Subject: [PATCH] More robust frontend reaction in case of race conditions on player state events --- platypush/backend/http/static/js/plugins/media/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/platypush/backend/http/static/js/plugins/media/index.js b/platypush/backend/http/static/js/plugins/media/index.js index 5afe62329..6cf186c46 100644 --- a/platypush/backend/http/static/js/plugins/media/index.js +++ b/platypush/backend/http/static/js/plugins/media/index.js @@ -295,10 +295,16 @@ Vue.component('media', { delete event.resource; } - if (status.state !== 'stop') { + if (status.state !== 'stop' || event.type.endsWith('.MediaPlayEvent')) { status.title = status.title || this.status[type][player].title; } + if (event.type.endsWith('.MediaPlayEvent')) { + status.state = 'play'; + } else if (event.type.endsWith('.MediaPauseEvent')) { + status.state = 'pause'; + } + Vue.set(this.status[type], player, status); },