![Benjamin Keen](https://web.dev/images/authors/bkeen.jpg) Benjamin Keen ![François Beaufort](https://web.dev/images/authors/beaufortfrancois.jpg) François Beaufort [GitHub](https://github.com/beaufortfrancois)

<br />


Published: March 18, 2026

<br />

Starting with Chrome 142, web apps that play audio or video can [automatically enter Picture-in-Picture mode](https://developer.chrome.com/blog/automatic-picture-in-picture-media-playback.md.txt) if they register a media session [action handler](https://www.w3.org/TR/mediasession/#dom-mediasessionaction-enterpictureinpicture). This has been a great addition for music and video players, but it requires developers to implement support explicitly.

To provide a seamless media multitasking experience and improve the discoverability of Picture-in-Picture (PiP), Chrome introduces browser-initiated Auto PiP. This feature lets Chrome automatically open a video PiP window for sites that have not registered a media session action handler. This ensures that your media content remains visible when you switch tabs.

### Instructions

- Use Chrome 142 or a later version on desktop.
- Enable "Browser initiated automatic picture in picture" in `chrome://flags/#browser-initiated-automatic-picture-in-picture` and restart Chrome.
- Go to a video website and play a video ([example](https://www.youtube.com/watch?v=CFGLoQIhmow)).
- Switch to another Chrome tab to trigger a video PiP window.

### How it works

When you play media and switch to another tab, Chrome can automatically move the media into an always-on-top video PiP window. Unlike the existing "Auto PiP for Media Playback feature," which supports either video or arbitrary HTML content (using the [Document Picture-in-Picture API](https://developer.chrome.com/docs/web-platform/document-picture-in-picture.md.txt)), browser-initiated requests always open a standard video PiP window.

To ensure a high-quality and non-intrusive user experience, Chrome triggers this behavior only when a strict set of conditions are met:

- The top frame URL is safe according to the Safe Browsing service.
- The media is in the top frame.
- The media has been audible within the last two seconds.
- The media has audio focus and is playing.
- A single "normal" player exists, that is, an unmuted media element that has played and is not using `MediaStream`.
- The media element must have a video track.
- The site is not actively using the camera or microphone.
- The user's [Media Engagement Index](https://developer.chrome.com/blog/autoplay.md.txt#media_engagement_index) threshold has been exceeded, which indicates frequent use of the site. This condition applies if the user has not explicitly allowed or denied the feature.
- No PiP window is currently open. If another PiP window is already open, Chrome does not trigger an automatic transition.

Comparison of browser-initiated Auto PiP (site without an `enterpictureinpicture` action handler) and Auto PiP for media playback (where the site has registered the handler).

### User control and privacy

Browser-initiated Auto PiP respects the same user permissions and settings as site-initiated requests. The first time a site enters PiP automatically, Chrome presents users with a permission dialog that asks if they want to allow this behavior for the site in the future.

Users can also manage these permissions at any time through the "[Site Settings](https://developer.chrome.com/blog/one-time-permissions.md.txt#:%7E:text=or%20via%20the-,Site%20settings,-.:%7E:text=or%20via%20the-,Site%20settings,-.)".

### Developer control and opt-out

While this feature is designed to work out of the box for most video sites, you can opt out of this behavior.

#### Implement your own handler

If your web app already registers a media session action handler for the [`enterpictureinpicture`](https://www.w3.org/TR/mediasession/#dom-mediasessionaction-enterpictureinpicture) action, your implementation takes precedence, and Chrome does not initiate its own automatic transition.

If you want to customize behavior when Chrome thinks a transition is appropriate, the [`enterpictureinpicture`](https://www.w3.org/TR/mediasession/#dom-mediasessionaction-enterpictureinpicture) action handler includes a `reason` in the `MediaSessionActionDetails`. You can [check](https://googlechrome.github.io/samples/media-session/video.html#:%7E:text=enterPictureInPictureReason%20===%20%22contentoccluded%22) if the `reason` is `contentoccluded` (which means the browser initiated the request because the tab was hidden) and decide how to proceed.

```javascript
navigator.mediaSession.setActionHandler("enterpictureinpicture", (details) => {
  if (details.reason === "contentoccluded") {
    // The browser suggests entering Picture-in-Picture.
    // You can choose to open a standard video PiP or a Document PiP window, or do
    // nothing (effectively blocking browser-initiated Auto Picture-in-Picture).
  }
});
```

### Best practices for media session

With browser-initiated Auto PiP, your media session configuration helps Chrome understand and interact with your content. A well-configured `MediaSession` ensures that the PiP window provides a high-quality experience with accurate controls and information for users.

#### Keep the progress bar in sync

If the `setPositionState` API is used, and the media session position is not updated properly, PiP windows display an inaccurate progress bar during media playback. To prevent this, always update or unset the [`position state`](https://www.w3.org/TR/mediasession/#dom-mediasession-setpositionstate) using `navigator.mediaSession.setPositionState()` as appropriate (for example, when the media source changes or is reset), so the PiP window reflects the correct position for the playing media.

```javascript
const video = document.querySelector('video');

function updatePositionState() {
  if ('setPositionState' in navigator.mediaSession) {
    navigator.mediaSession.setPositionState({
      duration: video.duration,
      playbackRate: video.playbackRate,
      position: video.currentTime,
    });
  }
}

// Update when metadata is loaded or when seeking happens.
video.addEventListener("loadedmetadata", updatePositionState);
video.addEventListener("seeked", updatePositionState);
```

#### Handle transitions gracefully

If your site automatically plays a "Next Episode," ensure that your `MediaSession` action handlers and metadata stay active and accurate throughout the transition. If action handlers are removed or unset during the transition to a "Next" element, the PiP window might lose the capabilities that were provided by the handler.

#### Enable full control

Beyond basic play and pause, consider implementing handlers for [`seekto`](https://www.w3.org/TR/mediasession/#dom-mediasessionaction-seekto), [`previoustrack`](https://www.w3.org/TR/mediasession/#dom-mediasessionaction-previoustrack), and [`nexttrack`](https://www.w3.org/TR/mediasession/#dom-mediasessionaction-nexttrack). This lets users navigate your content directly from the PiP window without returning to the original tab.

```javascript
navigator.mediaSession.setActionHandler("seekto", (details) => {
  if (details.fastSeek && "fastSeek" in video) {
    video.fastSeek(details.seekTime);
    return;
  }
  video.currentTime = details.seekTime;
});
```

### Engage and share feedback

If you have feedback or encounter any issues with this behavior, share them at [crbug.com](http://crbug.com).

### Resources

- [Spec changes](https://github.com/w3c/mediasession/pull/295)
- [ChromeStatus entry](https://chromestatus.com/feature/6245717716238336)
- [Intent to Ship](https://groups.google.com/a/chromium.org/g/blink-dev/c/BEhYD8v4zY0/m/ZcINHmMMBAAJ)
- [Chromium issue](https://issues.chromium.org/issues/408502322)
- [Enter picture-in-picture automatically when playing media](https://developer.chrome.com/blog/automatic-picture-in-picture-media-playback.md.txt)
- [Picture-in-Picture for any Element, not just \<video\>](https://developer.chrome.com/docs/web-platform/document-picture-in-picture.md.txt)
- [The future of Picture-in-Picture](https://developer.chrome.com/blog/the-future-of-picture-in-picture.md.txt)