A Chrome extension that adds Picture-in-Picture support for Facebook Messenger video calls — showing the remote caller (not your own camera) in a compact floating window, just like Google Meet.
- Smart video detection — Uses WebRTC hooks and heuristics to correctly identify the remote person's video vs your local camera
- Compact native PiP — Uses Chrome's standard PiP API for a small, native floating window
- Auto-PiP on tab switch — Automatically enters PiP when you leave the call tab (requires one manual toggle first)
- Auto-exit on return — PiP closes when you switch back to the call tab
- Works in call popups — Force-injects into Messenger's popup call windows via the background script
- Document PiP fallback — Falls back to Document PiP with mute/close controls if standard PiP fails
| File | Purpose |
|---|---|
manifest.json |
Extension config, permissions, content script injection rules |
background.js |
Detects Messenger tabs, force-injects scripts into call popups, handles tab switch events |
webrtc-hook.js |
Runs in page context (MAIN world) to intercept RTCPeerConnection and getUserMedia, tracking remote vs local streams |
content.js |
Core logic — classifies videos, toggles PiP, registers MediaSession for auto-PiP |
content.css |
Styles injected into the page (minimal) |
- Clone or download this repository
- Open Chrome →
chrome://extensions - Enable Developer mode (top right)
- Click Load unpacked → select the
messenger-pipfolder - The extension icon appears in your toolbar
- Start a Messenger video call (from messenger.com or facebook.com)
- Click the extension icon in the toolbar → PiP window appears with the remote caller
- Click again to close PiP
- After the first manual toggle, auto-PiP activates on tab switches
A test page is included to verify PiP without a real call:
python3 -m http.server 8000
# Open http://localhost:8000/test-pip.html- Chrome 116+ (Document PiP API)
- Edge 116+
- Firefox / Safari: not supported (no Document PiP API)
MIT