Skip to content

jamesng-minhkhoi/messenger-pip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Messenger PiP

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.

Features

  • 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

How It Works

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)

Installation

  1. Clone or download this repository
  2. Open Chrome → chrome://extensions
  3. Enable Developer mode (top right)
  4. Click Load unpacked → select the messenger-pip folder
  5. The extension icon appears in your toolbar

Usage

  1. Start a Messenger video call (from messenger.com or facebook.com)
  2. Click the extension icon in the toolbar → PiP window appears with the remote caller
  3. Click again to close PiP
  4. After the first manual toggle, auto-PiP activates on tab switches

Testing Locally

A test page is included to verify PiP without a real call:

python3 -m http.server 8000
# Open http://localhost:8000/test-pip.html

Browser Support

  • Chrome 116+ (Document PiP API)
  • Edge 116+
  • Firefox / Safari: not supported (no Document PiP API)

License

MIT

About

A Chrome extension that adds Picture-in-Picture support for Facebook & Meta Messenger video calls

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors