Picture-in-Picture for every website with a video, plus Region PiP to float any selected area of your screen.
- Overview
- Features
- Region PiP
- Installation
- Settings
- How It Works
- Project Structure
- Changelog
- Browser Compatibility
- Known Limitations
- Contributing
- License
PiP Master adds a Picture-in-Picture button directly into the YouTube player controls. On every other website (Netflix, Twitch, Dailymotion, news sites, etc.), a floating button appears when you hover over any video element.
New in v2.2: Region PiP lets you draw a selection rectangle over any part of the page (like a screenshot tool) and stream that region into a floating, movable PiP window — no video element required.
The extension requires no external services, collects no data, and has zero impact on page load performance.
- Native-looking button injected into the YouTube player controls bar (next to the fullscreen button)
- Dedicated floating button for YouTube Shorts
- Survives SPA navigation: the button stays when you switch videos without a full page reload
- Auto-skip ads while in PiP mode — detects the "Skip Ad" button and clicks it automatically
- Playlist continuation — when a video ends in PiP mode and the next one starts, PiP is re-entered automatically
- A small floating button appears in the top-right corner of any
<video>element on hover - Works on lazily-loaded videos (videos injected into the DOM after page load)
- Tracks video replacements (e.g. episode auto-play on streaming sites) and re-enters PiP
| Feature | Description |
|---|---|
| Keyboard shortcut | Default Alt+P, fully configurable from the settings page |
| Auto-PiP | When you leave a tab with a playing video, PiP activates automatically |
| Re-enter PiP | Stays in floating mode across playlist advancement and autoplay |
| Region PiP | Drag-select any screen area and float it — Alt+Shift+P (new in v2.2) |
| Toast notifications | Discrete on-screen confirmations for every PiP state change |
| Firefox compatible | Works on Firefox 109+ via a chrome.* / browser.* compatibility shim |
Region PiP lets you select any rectangular area of the current tab and float it in a Picture-in-Picture window — just like a screen-region screenshot tool, but live and moveable.
- Press
Alt+Shift+P(or your configured shortcut) on any page. - Your browser shows a screen-sharing dialog — select "This Tab" (Chrome) or the current browser window (Firefox) for the most accurate coordinate mapping.
- An overlay appears. Click and drag to draw a rectangle over any area you want to float.
- Release the mouse — the selected region starts streaming in a floating PiP window.
- Move and resize the PiP window freely, just like any other PiP.
- To stop: press
Alt+Shift+Pagain, close the PiP window, or click the browser's "Stop sharing" button.
Tip: Share "This Tab" (not "Entire Screen" or "Window") for pixel-perfect region alignment, since the coordinates are mapped relative to the viewport.
- Float a live chart, map, or dashboard while working in another tab
- Keep a live code diff or document section visible while typing elsewhere
- Watch a specific section of a long video (subtitles, annotations, speaker cam)
- Monitor a live score, ticker, or any updating element on a page
-
Go to the repository page and click Code → Download ZIP
-
Extract the ZIP — this creates a folder called
Youtube-pip-master-main -
Open that folder — inside you will find another folder also called
Youtube-pip-master-main. This inner folder is the one you need.Youtube-pip-master-main/ ← extracted from ZIP, ignore this level └── Youtube-pip-master-main/ ← select THIS folder in Chrome ├── manifest.json ├── content_script.js ├── browser-compat.js ├── options.html ├── options.js └── icons/⚠️ Common mistake: selecting the outer folder gives the error "Manifest file is missing or unreadable". Always go one level deeper until you can seemanifest.jsondirectly inside the folder. -
Open
chrome://extensions/(Chrome) oredge://extensions/(Edge) -
Enable Developer mode (top-right toggle)
-
Click Load unpacked
-
Select the inner
Youtube-pip-master-mainfolder (the one that containsmanifest.json)
The extension icon appears in the browser toolbar. Click it to open settings.
- Download and extract the ZIP
- Navigate into the inner folder (same rule as above — the one with
manifest.json) - Open
about:debugging#/runtime/this-firefox - Click Load Temporary Add-on
- Select the
manifest.jsonfile inside the inner folder
Temporary add-ons are removed when Firefox closes. For a permanent installation, submit the extension to addons.mozilla.org.
Replace the files in your local folder with the new version, then go to
chrome://extensions/ and click the refresh icon on the PiP Master card.
Click the extension icon in the browser toolbar to open the settings page.
| Option | Default | Description |
|---|---|---|
| Auto-PiP | Off | Enters PiP automatically when you switch away from a tab with a playing video |
| Auto-Skip Ads | On | Clicks the YouTube "Skip Ad" button automatically while in PiP mode |
| Re-enter PiP on next video | On | Re-enters PiP when a playlist or autoplay starts the next video |
| Keyboard shortcut | Alt+P |
Click the shortcut display to capture a new combination |
| Enable Region PiP | On | Enables the drag-to-select region floating feature |
| Region PiP shortcut | Alt+Shift+P |
Click to capture a new key combination for Region PiP |
Page load
|
+-- youtube.com?
| |
| +-- /shorts --> fixed floating button (bottom-right)
| |
| +-- /watch --> button injected into .ytp-right-controls
| MutationObserver handles SPA navigation
| AdSkipper watches for skip buttons while in PiP
| Video end listener triggers PiP re-entry on next video
|
+-- any other site
|
MutationObserver scans for <video> elements
Each video gets an on-hover floating button
Video replacement is detected for auto re-entry
|
v
video.readyState >= 1 ?
yes --> requestPictureInPicture()
no --> wait for "loadedmetadata" event, then retry
Region PiP (Alt+Shift+P)
|
getDisplayMedia() --> browser share dialog
|
User selects "This Tab" / browser window
|
Full-screen selection overlay appears
|
User drag-selects a rectangle
|
getVideoTracks()[0].getSettings() --> capture resolution
|
Scale CSS viewport coords --> capture pixel coords
|
Hidden <canvas> crops the frame on every requestAnimationFrame()
|
canvas.captureStream(30) --> hidden <video>
|
video.requestPictureInPicture() --> floating window
|
Press shortcut / close window / "Stop sharing" --> stopRegionPip()
APIs used:
HTMLVideoElement.requestPictureInPicture()— enters PiP modeDocument.exitPictureInPicture()— exits PiP modeDocument.pictureInPictureEnabled— browser support checkHTMLVideoElement.readyState— ensures metadata is loaded before requesting PiPnavigator.mediaDevices.getDisplayMedia()— screen/tab capture for Region PiPHTMLCanvasElement.captureStream()— streams the cropped canvas as a video trackVideoTrack.getSettings()— reads actual capture resolution for coordinate scalingrequestAnimationFrame()— continuous frame cropping loop for Region PiPMutationObserver— watches DOM for SPA navigation and dynamic video injectionPage Visibility API— Auto-PiP on tab switchchrome.storage.sync/browser.storage.sync— persists user settings
pip-master/
├── manifest.json Manifest V3 config — Chrome and Firefox
├── browser-compat.js Shim that maps chrome.* to browser.* for Firefox
├── content_script.js All extension logic (injection, PiP, region PiP, observers, ad skip)
├── options.html Settings page UI
├── options.js Settings page logic
├── LICENSE MIT
└── icons/
├── icon16.png
├── icon48.png
└── icon128.png
- New: Region PiP — press
Alt+Shift+Pto activate a drag-to-select overlay on any page. Draw a rectangle over any screen area; that region is cropped in real time via Canvas API and streamed into a floating, movable PiP window. No video element required. - New: Region PiP shortcut is fully configurable from the settings page (default
Alt+Shift+P). - New: Region PiP can be toggled on/off independently from the settings page.
- New: The selection overlay shows corner handles and a live size label (
W × H) while dragging. - New: Four dim panels animate around the selection to visually isolate the chosen area.
- Changed: version bumped to 2.2.0; settings page updated with a dedicated "Region PiP" card.
- Docs: installation section now explains the ZIP nested-folder structure to avoid the "Manifest file is missing or unreadable" error when loading the extension.
- Fixed: floating hover button not appearing on sites like Le Monde and any site where videos
are inside positioned containers. Changed from
position: absolutetoposition: fixed.
- Fixed:
requestPictureInPicturecrash when video metadata is not yet loaded.
- Fixed: unhandled Promise rejections — all async operations replaced with
.then().catch().
- New: Auto-Skip Ads, Re-enter PiP, Universal mode, settings page.
- New: Universal mode, Firefox compatibility, browser-compat.js shim.
- Initial release: YouTube button, Shorts button, keyboard shortcut, Auto-PiP, MutationObserver.
| Browser | Version | Status | Notes |
|---|---|---|---|
| Chrome | 88+ | Supported | Full feature set including Region PiP ("This Tab" share recommended) |
| Edge | 88+ | Supported | Same Chromium engine as Chrome |
| Firefox | 109+ | Supported | Via browser-compat.js shim; Region PiP works (share browser window) |
| Opera | 74+ | Likely compatible | Chromium-based, not formally tested |
| Brave | Any | Likely compatible | Chromium-based, not formally tested |
| Safari | — | Not supported | Requires macOS + Xcode + paid Apple Developer account |
- Safari: Out of scope — requires macOS, Xcode, and an Apple Developer account ($99/year).
- DRM-protected content: Disney+, Amazon Prime Video and similar platforms block PiP at the browser level. This is a browser restriction, not an extension bug.
- Cross-origin iframes: Videos inside cross-origin iframes cannot be controlled due to browser security policies.
- Firefox temporary install: Removed on browser close when loaded via
about:debugging. - Region PiP coordinate accuracy: Share "This Tab" (Chrome) for pixel-perfect alignment. When sharing the full screen, coordinate mapping depends on the browser window position and DPI scaling, which may introduce a small offset.
- Region PiP on Firefox: Firefox does not support the
preferCurrentTabhint; manually choose the browser window for best results.
git clone https://github.com/anonyme-afk/Youtube-pip-master.git
cd Youtube-pip-master
git checkout -b feature/your-feature-name
git add .
git commit -m "feat: describe your change"
git push origin feature/your-feature-nameIdeas for contributions:
- i18n / localization support
- Configurable button position for universal mode
- Timer display in PiP window via Media Session API
- Support for sites with multiple simultaneous video elements
- Region PiP: "re-select region" button without restarting the share session
MIT License — see LICENSE for full text. Copyright (c) 2026 anonyme-afk
If this extension is useful to you, consider leaving a star on the repository.