Remote stream playing in picture-in-picture fix #27958
Open
+8
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proposed change
This PR fixes the following issue: #26582, caused by #26235.
Type of change
Example configuration
No config changes is needed, just open a video stream in Chrome, move it to a PiP window and change tabs inside the browser.
Additional information
I tried several approaches since the current implementation is not very precise. The
document.pictureInPictureElementreturns the roothome-assistantelement because of the shadow DOM, so we can't test that the PiP window is containing the exact video element we are in. This should still be fine since afaik there is no way to have multiple video streams running at the same time, and even if there were, we know that at least one of them is in PiP, so we don't need to clean up the streams.I tried to listen for the
enterpictureinpictureevent like suggested in the linked issue, but that is not fired in Chrome for any element (video or document), so that approach does not work.Checklist
If user exposed functionality or configuration variables are added/changed: