# How to Trigger Picture-in-Picture on Tab Switch Without User Activation Error

**URL:** <https://devforum.zoom.us/t/how-to-trigger-picture-in-picture-on-tab-switch-without-user-activation-error/131210>\
**Category:** Web\
**Tags:** video-sdk\
**Created:** [April 9, 2025, 4:48am UTC](https://devforum.zoom.us/t/how-to-trigger-picture-in-picture-on-tab-switch-without-user-activation-error/131210 "2025-04-09T04:48:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![lmtruong1512](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/lmtruong1512/32/59233_2.png) [@lmtruong1512](https://devforum.zoom.us/u/lmtruong1512)\
**Post date:** [April 9, 2025, 4:48am UTC](https://devforum.zoom.us/t/how-to-trigger-picture-in-picture-on-tab-switch-without-user-activation-error/131210/1 "2025-04-09T04:48:55Z")

</div>

**Description**  
I’m trying to automatically trigger **Picture-in-Picture (PiP)** when the user switches to another tab or minimizes/hides the browser window.

Currently, I’m using the `visibilitychange` event to detect tab switches and then trigger PiP:

```auto
    document.addEventListener('visibilitychange', async () => {
      if (document.hidden && !document.pictureInPictureElement) {
        this.onActivatePip();
      }
    });

```

However, this approach often throws the following error if the user hasn’t interacted with the document beforehand:

```auto
NotAllowedError: Failed to execute 'requestWindow' on 'DocumentPictureInPicture': 
Document PiP requires user activation.

```

I also tried listening to the `enterpictureinpicture` event as suggested in [this source](https://steimelchrome.github.io/autopip.html), using `navigator.mediaSession.setActionHandler`:

```auto
    navigator.mediaSession.setActionHandler('enterpictureinpicture', () => {
      this.onActivatePip();
    });

```

However, this event handler doesn’t get triggered when integrating with **Zoom Video SDK**.

How can I reliably trigger Picture-in-Picture when the user switches tabs or hides the window, **without** running into the `Document PiP requires user activation` error?

What’s the **best practice** for handling PiP in this context?

**Which Web Video SDK version?**  
2.1.0

**Device (please complete the following information):**

- Device: Mac
- OS: 15.1
- Browser: Chrome
- Browser Version: 134.0.6998.166

---

<div class="post-metadata">

**Author:** ![vic.yang](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/vic.yang/32/24656_2.png) [@vic.yang](https://devforum.zoom.us/u/vic.yang)\
**Post date:** [May 16, 2025, 6:27am UTC](https://devforum.zoom.us/t/how-to-trigger-picture-in-picture-on-tab-switch-without-user-activation-error/131210/2 "2025-05-16T06:27:14Z")

</div>

Hey @lmtruong1512

Thanks for your feedback.

It appears to be a browser limitation, and unfortunately, we currently don’t have a workaround for it.

Thanks  
Vic

---

<div class="post-metadata">

**Author:** ![Kudret](https://avatars.discourse-cdn.com/v4/letter/k/50afbb/32.png) [@Kudret](https://devforum.zoom.us/u/Kudret)\
**Post date:** [November 1, 2025, 2:41pm UTC](https://devforum.zoom.us/t/how-to-trigger-picture-in-picture-on-tab-switch-without-user-activation-error/131210/3 "2025-11-01T14:41:40Z")

</div>

Hello, I have been trying to get past this issue but have had no success so far. However, somehow Google Meet manages to bypass this limitation because, on their platform, it works regardless of whether I click inside the tab or not, it just opens. Does anyone have any information about this?

---

<div class="post-metadata">

**Author:** ![vic.yang](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/vic.yang/32/24656_2.png) [@vic.yang](https://devforum.zoom.us/u/vic.yang)\
**Post date:** [November 1, 2025, 3:02pm UTC](https://devforum.zoom.us/t/how-to-trigger-picture-in-picture-on-tab-switch-without-user-activation-error/131210/4 "2025-11-01T15:02:27Z")

</div>

Hey @Kudret

Thanks for your feedback.

Starting from Chrome 133, web apps that play audio or video can also automatically enter picture-in-picture mode. You can refer to the following articles for the details:

> **[Automatic picture-in-picture for video conferencing web apps  | ...](https://developer.chrome.com/blog/automatic-picture-in-picture)**
>
> Chrome allows video conferencing web apps to automatically enter picture-in-picture.

> **[Enter picture-in-picture automatically when playing media  |  Blog...](https://developer.chrome.com/blog/automatic-picture-in-picture-media-playback)**
>
> Chrome allows web apps playing media to automatically enter picture-in-picture.

Thanks  
Vic

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/6/1/614bdd549b610bbaa46ff934617683a02bdaa03c.png) [@system](https://devforum.zoom.us/u/system)\
**Post date:** [November 1, 2026, 3:03pm UTC](https://devforum.zoom.us/t/how-to-trigger-picture-in-picture-on-tab-switch-without-user-activation-error/131210/5 "2026-11-01T15:03:13Z")

</div>

Closed on November 1, 2026, 3:03pm UTC

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
