An advanced userscript that automatically triggers Picture-in-Picture (PiP) mode for YouTube and Bilibili videos. Built with Chrome's latest Picture-in-Picture API, this script provides a seamless video-watching experience similar to the Arc browser's implementation.
Note: Requires Chrome 120+ for optimal functionality with the new Auto Picture-in-Picture API.
- Smart Activation: Automatically enters PiP mode during active video playback
- Tab Management: Intelligently handles tab switching with user interaction detection
- Pause Handling: Prevents PiP activation during video pauses
- Click Optimization: Enhanced click event handling for better user experience
- Chrome Media Session API
- Utilizes
navigator.mediaSession
API for PiP control - Custom action handlers for PiP state management
- Utilizes
- User Interaction Enhancement
- Bypasses standard interaction requirements
- Maintains native-like experience
-
Enable Auto PiP Feature
Settings → Privacy and Security → Site Settings → Additional Permissions
Enable "Automatically enter Picture-in-Picture mode"
-
Configure Chrome Flags Navigate to
chrome://flags
and enable:Auto picture in picture video heuristics
Auto picture in picture for video playback
-
Enable Developer Mode Required for userscript installation
If you find this userscript helpful, consider supporting its development: