Commit 47a27901 authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇
Browse files

Don't add and remove player element if it is already in the page

In case the player has genuinely been added to the website as visible player control.

CCBUG: 411742

Differential Revision:
parent 7b033c52
......@@ -791,8 +791,14 @@ function loadMediaSessionsShim() {
player.pausedBecauseOfDomRemoval = true;
player.removeEventListener("play", player.registerInDom);
(document.head || document.documentElement).appendChild(player);
// If it is already in DOM by the time it starts playing, we don't need to do anything
if (document.body && document.body.contains(player)) {
delete player.pausedBecauseOfDomRemoval;
player.removeEventListener("pause", player.replayAfterRemoval);
} else {
(document.head || document.documentElement).appendChild(player);
player.replayAfterRemoval = () => {
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