oddworks blog

Keep a video playing while you work: PiP, window or extension

On this page
  1. Why a video stops when you start working
  2. Option 1: picture-in-picture
  3. Option 2: a second window you can see
  4. Option 3: an extension that hides the signals
  5. Which one to use
  6. Two things that help with every option
  7. FAQ

The quickest way to keep a video playing while you work is picture-in-picture: right-click the video, choose Picture in picture, and it floats above everything else. If the site pauses anyway, put the video in its own window and leave part of it on screen. If it still pauses when you click into your work, the site is watching for focus loss, and an extension that hides that signal is the remaining fix.

Here is how each option works, what it can't do, and how to pick.

Why a video stops when you start working

Most players pause for one of two signals. When the tab is hidden, the browser sets document.hidden to true and fires a visibilitychange event (MDN). When you click into another window or app, the page gets a window blur event and document.hasFocus() becomes false, even if the video is still in view.

A player that only reacts to visibility can be kept going by keeping it visible. A player that reacts to focus pauses as soon as you click anywhere else, which is the hard case. The full list of causes, including tabs the browser puts to sleep, is in why videos pause when you switch tabs.

Option 1: picture-in-picture

Picture-in-picture (PiP) moves the video into a small floating window that stays on top of other windows. You can drag it to a corner and resize it. It is built into Chrome, Edge and Brave on desktop.

How to open it

  1. Start the video.
  2. Right-click the video. If the site shows its own menu (YouTube does), right-click a second time to get the browser's menu.
  3. Choose Picture in picture.

Some players also have a PiP button in their controls. In recent Chrome versions, some music and video sites can open PiP on their own when you switch tabs, if they support it and you allow it. Chrome asks for permission the first time (Chrome for Developers).

Where it falls short

  • Only one PiP window at a time. Chrome follows the operating system convention of a single PiP window (Chrome for Developers).
  • Sites can turn it off. A disablePictureInPicture attribute on the video removes the option, and some players hide the browser menu.
  • The tab behind it is still hidden. The page still receives visibilitychange when you leave its tab. A player that pauses on that event can pause the PiP video too.
  • It is small. Fine for a stream or a talk, less so for a tutorial with code on screen.

Option 2: a second window you can see

Drag the video's tab out of the tab strip so it becomes its own window, then place it beside your work. Use your operating system's window snapping (Windows Snap, or dragging to the screen edge on macOS) to split the screen, or put the window on a second monitor.

This works because a tab is only "hidden" when it is not the active tab in its window, the window is minimized, or the window is entirely covered by another one (MDN). A window that is at least partly on screen keeps the page visible, so visibilitychange never fires.

Where it falls short

  • Clicking into your work still fires blur. Sites that pause on focus loss will pause the moment you click elsewhere. This option can't fix that.
  • Don't cover it completely. If your editor or another window fully covers the video window, the browser can treat it as hidden.
  • It costs screen space. On a single laptop screen, a half-and-half split is a big trade.

Option 3: an extension that hides the signals

When a player pauses on blur or a hidden tab, the only way to keep it going is to stop the page from seeing those signals. That needs code that runs inside the page before the site's own scripts.

Focus Spoofer (which we make) does this. It is free and open source, works in Chrome, Edge and Brave, and runs only on tabs you turn it on for, or sites you mark "Always protect". On those tabs it:

  • keeps document.hidden false and document.visibilityState "visible"
  • blocks visibilitychange, pagehide, and window-level blur and mouseleave
  • keeps document.hasFocus() returning true
  • keeps requestAnimationFrame and requestVideoFrameCallback firing in hidden tabs

So the video can sit in a background tab, or a window behind your editor, and the player behaves as if you were still watching. Clicks and focus inside the page itself keep working normally. It needs no account, and browsing data never leaves your browser.

Where it falls short

  • It can't stop Chrome's Memory Saver or Edge's sleeping tabs from unloading a tab. Add the site to the browser's exclusion list for that; see Chrome Memory Saver: on or off.
  • It doesn't stop "are you still watching?" prompts, which can be based on things other than tab visibility.
  • It is desktop only. No mobile, Firefox or Safari yet.
  • It can't run on chrome:// pages, the Chrome Web Store or the built-in PDF viewer.

Which one to use

Situation Best option
A stream or talk you glance at now and then Picture-in-picture
Two monitors, or a screen wide enough to split A second window
Video pauses when you click into another app Extension
Video pauses in PiP or a side window Extension
Tab reloads from the start when you come back Browser exclusion list (Memory Saver or sleeping tabs)

Try them in that order. PiP and a second window cost nothing and change nothing about the page. If a site still pauses, it is reacting to focus or visibility, and the extension handles both.

A common case is following a course in one window and taking notes in another. Online course video pauses when you switch tabs walks through that setup for Udemy, Coursera and LinkedIn Learning.

Two things that help with every option

Keep the video audible. If you want quiet, unmute the player and mute the tab instead: right-click the tab and choose Mute site. People report that Chrome pauses or stops drawing muted video in background tabs, and keeping the sound on in the player avoids that.

Exclude the site from tab sleeping. In Chrome, go to Settings > Performance and add the site next to Always keep these sites active. Google lists active playback as something that can prevent deactivation, but a paused video tab is fair game (Chrome Help).

FAQ

Does picture-in-picture keep playing if I switch tabs?

Usually, yes. The PiP window keeps playing while you use other tabs and apps. A player that pauses itself when its tab becomes hidden can still pause it, and then a second window or an extension is the fix.

Why does my video pause when I click into another window?

The site listens for the window blur event or checks document.hasFocus(). Keeping the video visible doesn't help with that, because the page still loses focus. An extension that blocks window-level blur and keeps hasFocus() true is the way around it.

Can I watch two videos in picture-in-picture at once?

Not in Chrome. It allows one PiP window at a time. Put the second video in its own visible window instead.

How can I tell which signal a site is using?

Open the tab-switch detection test, then switch tabs and click into another app. It logs each event the page receives, so you can see whether visibility, focus or both change. With Focus Spoofer on for that tab, the log stays empty.

Keep reading

Start with the overview: Why videos pause when you switch tabs, and how to stop it