Auto PiP on Tab Switch

Automatically enable Picture-in-Picture mode for videos when switching tabs

Author
FerNikoMF
Daily installs
0
Total installs
36
Ratings
0 0 0
Version
1.1
Created
2025-01-30
Updated
2025-01-30
Size
1.73 KB
License
MIT
Applies to
All sites

Auto PiP on Tab Switch

This script automatically enables Picture-in-Picture (PiP) mode for videos when you switch to another tab. When you return to the tab with the video, PiP is disabled.

It works on most video platforms like YouTube, Twitch, VK, Twitter, and other websites that use the <video> element. This allows you to continue watching videos in a small window that stays on top of other apps or tabs, without interrupting your viewing experience.

How it works:

  • The script listens for visibility changes on the tab (when you switch to another tab or return to the video tab).
  • When the tab becomes hidden (you switch away), the script triggers PiP for the first available video on the page.
  • When you come back to the tab with the video, PiP is automatically turned off.

Installation Instructions:

  1. Install Tampermonkey (or Greasemonkey for Firefox).
  2. The script will start working automatically on all supported websites.

Supported Websites:

  • YouTube
  • Twitch
  • Twitter
  • VK
  • And any other site using the <video> element.

Requirements:

  • Tampermonkey or Greasemonkey extension version 4.0 or later.
  • Works on Chrome, Edge, Firefox, and other browsers supporting user scripts.

Known Issues:

  • Some websites might block PiP on their video players, in which case the script may not work.
  • Make sure you're using the latest version of your browser for optimal performance.

Changelog:

  • v1.0: Initial release with support for auto Picture-in-Picture when switching tabs.
  • v1.1: add icon.