Commit 999e790c authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇

Only consider player gone if really no longer part of the visible DOM

We listen for the player being removed from the DOM so we can detect when a player
was removed dynamically when e.g. an overlay div closes.
However, when the player is just reparented elsewhere, we get a DOM add and remove dance,
and then it becomes racy who will be given controls: previous player on another tab or
the same player again when it becomes known again.
To avoid this just ignore player removal when it remains part of the visible page DOM.

Differential Revision: https://phabricator.kde.org/D20582
parent 7cd77672
......@@ -492,6 +492,11 @@ function loadMpris() {
players.forEach(function (player) {
if (player == activePlayer) {
// If the player is still in the visible DOM, don't consider it gone
if (document.body.contains(player)) {
return; // continue
}
sendPlayerGone();
return;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment