Skip to content

Commit

Permalink
PiP 2.0: Reuse player when window is opened.
Browse files Browse the repository at this point in the history
This CL fixes a bug introduced recently[1] so that the HTML media player
is now reused if the Document Picture-in-Picture API is enabled.

[1] https://chromium-review.googlesource.com/c/chromium/src/+/4190826

Change-Id: I24b7d0080cf9ee9e054c2a20a2f6d98911898b06
Bug: 1411201
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4202152
Reviewed-by: Yoav Weiss <yoavweiss@chromium.org>
Commit-Queue: Fr <beaufort.francois@gmail.com>
Cr-Commit-Position: refs/heads/main@{#1098495}
  • Loading branch information
beaufortfrancois authored and Chromium LUCI CQ committed Jan 30, 2023
1 parent 4731d3d commit ff8497c
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -647,8 +647,12 @@ void HTMLMediaElement::DidMoveToNewDocument(Document& old_document) {

bool HTMLMediaElement::ShouldReusePlayer(Document& old_document,
Document& new_document) const {
// Don't reuse player if the Document Picture-in-Picture API is disabled for
// both documents.
if (!RuntimeEnabledFeatures::DocumentPictureInPictureAPIEnabled(
GetExecutionContext())) {
old_document.domWindow()->GetExecutionContext()) &&
!RuntimeEnabledFeatures::DocumentPictureInPictureAPIEnabled(
new_document.domWindow()->GetExecutionContext())) {
return false;
}

Expand Down

0 comments on commit ff8497c

Please sign in to comment.