Skip to content

Commit

Permalink
add display-mode: picture-in-picture example and fix sizing issue (#263)
Browse files Browse the repository at this point in the history
* add display-mode: picture-in-picture example and fix sizing issue

* Update document-picture-in-picture/main.css

Co-authored-by: Vadim Makeev <[email protected]>

---------

Co-authored-by: Vadim Makeev <[email protected]>
  • Loading branch information
chrisdavidmills and pepelsbey authored Mar 11, 2024
1 parent 9edd962 commit 69c077f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions document-picture-in-picture/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,19 @@
#in-pip-message {
display: none;
}

@media (display-mode: picture-in-picture) and (prefers-color-scheme: light) {
body {
background: antiquewhite;
}
}

@media (display-mode: picture-in-picture) and (prefers-color-scheme: dark) {
body {
background: #333;
}

a {
color: antiquewhite;
}
}
2 changes: 1 addition & 1 deletion document-picture-in-picture/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ async function togglePictureInPicture() {
// Open a Picture-in-Picture window.
const pipWindow = await window.documentPictureInPicture.requestWindow({
width: videoPlayer.clientWidth,
height: videoPlayer.clientHeight,
height: videoPlayer.clientHeight + 50,
});

// Add pagehide listener to handle the case of the pip window being closed using the browser X button
Expand Down

0 comments on commit 69c077f

Please sign in to comment.