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.
Details
Details
- Reviewers
fvogt - Group Reviewers
Plasma - Commits
- R856:999e790c1eeb: Only consider player gone if really no longer part of the visible DOM
Switching full screen back and forth in YouTube works fine now (now, really! :D)
Verified that closing a twitter video overlay still considers the player gone (which was the main point of this mutation observer, detecting when a video player is removed dynamically)
Diff Detail
Diff Detail
- Repository
- R856 Plasma Browser Integration
- Lint
Lint Skipped - Unit
Unit Tests Skipped
Comment Actions
I see an opportunity for code decuplication here... Not sure how though - maybe
var players = Array.prototype.slice.call(node.querySelectorAll("video,audio")); if (node.matches("video,audio")) { players.unshift(node); }