demo · v130
meeting → chat context switch
The chromestatus motivation: "if the new window is semantically unrelated to the previous window, such as if it is a new VC, then the developer can use this parameter to provide a hint to the user agent that this window might be better opened in its default position / size instead." Walk a real two-context journey — open a big video-call PiP, close it, then open a small chat-thread PiP — and watch how preferInitialWindowPlacement changes the second open.
requires Document PiP (desktop)
window.documentPictureInPicture is desktop Chromium only. The probe below shows support and lets you actually open the windows if available; the journey explanation works in any browser.
the user journey
1. open VC PiP
requested 640×360
requested 640×360
→
user drags it to 980×550
browser caches that size for this origin
browser caches that size for this origin
→
2. close VC PiP
meeting ends
meeting ends
3. open chat PiP
requested 360×500
requested 360×500
→
browser sees cached 980×550
reuses that size by default
reuses that size by default
→
chat opens at the wrong size
looks empty / awkward
looks empty / awkward
two outcomes
without preferInitialWindowPlacement
requestWindow({width:360, height:500})→ browser opens at
980×550 (cached from VC)→ chat thread is dwarfed in a huge window
preferInitialWindowPlacement: true
requestWindow({width:360, height:500, preferInitialWindowPlacement: true})→ browser opens at
360×500 (requested)→ window is sized for the chat thread
try the real journey
1. video call
big window — full speaker tiles + chat sidebarrequested: 640×360
2. chat thread (legacy)
small window — single conversation columnrequested: 360×500
3. chat thread (new)
same as 2, but with the new optionrequested: 360×500 + preferInitialWindowPlacement
probing…
the code
// 1. The video-call PiP — let users move/resize it; bounds are cached.
const vc = await documentPictureInPicture.requestWindow({
width: 640,
height: 360,
});
// 2. Later, after the call ends and the user opens a chat thread:
const chat = await documentPictureInPicture.requestWindow({
width: 360,
height: 500,
preferInitialWindowPlacement: true, // ignore the cached VC bounds
});
// Without the new option, `chat` would open at 980×550 (the size the
// user dragged the VC window to), making a chat thread feel cavernous.