Skip to content

This script enhances your video-watching experience by automatically enabling PiP, allowing efficient multitasking while watching videos.

License

Notifications You must be signed in to change notification settings

hong-tm/Auto-Picture-in-Picture

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🌟 YouTube and Bilibili Auto Picture-in-Picture (PiP) Userscript

Currently Only Compatible with Chrome and Brave! Edge is Not Supported

This userscript automatically triggers Picture-in-Picture (PiP) mode while watching YouTube and Bilibili videos. It handles tab switching and playback status changes, providing a smooth video-watching experience. Inspired by the Arc browser experience, it was developed with AI assistance. Future maintenance may be sporadic.

🎉 Enjoy the smoothest PiP experience!

GIF Preview


🔻 Installation

☕ Support the Author


🌟 Key Features

1. Automatic PiP Mode Activation

  • 🔄 PiP mode is automatically triggered during video playback, allowing you to view the video in a floating window while multitasking or browsing other pages.
  • ⚡ If you switch tabs, PiP mode will wait for user interaction to activate.

2. Prevents PiP Trigger on Pause

  • ❌ When the pause button is clicked, PiP mode will not be triggered, preventing accidental PiP entry.

3. Tab Switching Handling

  • 🔄 When you return to the video tab, PiP remains in standby and activates only when the video is clicked.

4. Video Click Event

  • 🎬 PiP mode is triggered when the video is clicked, as long as it’s playing.

5. Supports Media Session API (Chrome 120+)

  • 📱 Uses navigator.mediaSession API to set "Enter PiP" action, enabling control of PiP via media sessions.

6. Bypasses User Interaction Requirement

  • ✅ Unlike other scripts, this one activates PiP without requiring page interaction.

⚙️ Setup Instructions for Chrome

To ensure the script works correctly, follow these steps:

  1. Open Chrome Settings

    • Click the "three dots" icon in the upper-right corner and select "Settings".
  2. Access Site Settings

    • Go to "Privacy and Security" → "Site Settings".
  3. Enable Auto PiP Mode

    • Under "Permissions," select "Additional Permissions Settings".
    • Locate "Automatically enter Picture-in-Picture mode" and allow sites to use this feature automatically.
  4. Enable Developer Mode for Extensions

  5. Enable Chrome Flags

    • Go to chrome://flags and enable:
      • Auto picture in picture video heuristics
      • Auto picture in picture for video playback

Chrome Settings

Extension Flags

About

This script enhances your video-watching experience by automatically enabling PiP, allowing efficient multitasking while watching videos.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published