oddworks blog

Udemy or Coursera video pauses when you switch tabs? The fixes

On this page
  1. First, work out which signal the player is reacting to
  2. Fix 1: Give the lecture its own window
  3. Fix 2: Use picture-in-picture
  4. Fix 3: Unmute the player and mute the tab instead
  5. Fix 4: Control playback without switching back
  6. Fix 5: Check your own extensions
  7. Fix 6: Turn on Focus Spoofer for the lecture tab
  8. Which fix to try first
  9. FAQ

A lecture video stops when you switch tabs because the player, or the browser, notices the page is no longer in front of you. The page either reads the Page Visibility API (the tab went hidden) or listens for the window losing focus (you clicked into your editor or notes app). The fastest fix is to give the lecture its own window or a picture-in-picture player, and if the player still pauses, turn on a visibility spoofer for that one tab.

This post is for the common setup: a Udemy, Coursera or LinkedIn Learning lecture on one side, and a code editor, terminal or notes document on the other. For the general background on why players do this, see why videos pause when you switch tabs.

First, work out which signal the player is reacting to

There are two different triggers, and the fixes are different.

  • The tab is hidden. You switched to another tab in the same window, or minimized the browser. The page sees document.visibilityState change to "hidden" and gets a visibilitychange event.
  • The window lost focus. The lecture is still on screen, but you clicked into VS Code, a terminal or a notes app. The page gets a window blur event and document.hasFocus() returns false. Nothing is hidden.

A quick check: put the lecture in a window next to your editor, press play, then click into the editor. If it pauses, the player is reacting to focus. If it keeps playing there but pauses when you switch tabs, it is reacting to visibility.

You can see both signals live on our tab-switch detection test. It logs every visibility and focus event as you leave and return, which tells you exactly what any page can see. The Page Visibility API test walkthrough explains each line.

Player behaviour differs between the three platforms and changes when they ship new players, so checking it yourself is more reliable than any list of which site does what.

Fix 1: Give the lecture its own window

If the player only reacts to visibility, this fixes it for free.

  1. Right-click the lecture's tab and choose Move tab to new window (or drag the tab out of the tab strip).
  2. Snap the lecture window to one half of the screen and your editor or notes to the other. On Windows press Win + Left or Win + Right. On macOS, hover over the green button in the window corner and pick a tile option.
  3. Press play and click into your editor.

A window that is on screen and not minimized counts as visible, so visibilityState stays "visible" while you type in another app. Be aware that on some systems a window completely covered by another window can be reported as hidden, so keep at least part of the lecture window showing.

This does not help if the player pauses on focus loss. Clicking into your editor still fires blur on the lecture window.

Fix 2: Use picture-in-picture

Picture-in-picture pops the video into a small floating window that stays on top of everything, which is often the most comfortable way to follow along with code.

In Chrome and Edge:

  1. Start the lecture.
  2. Right-click the video. Most course players show their own menu, so right-click a second time to get the browser's menu.
  3. Choose Picture in picture.

You can also open Chrome's media controls (the music-note icon in the toolbar while something is playing) and use the picture-in-picture button there.

Some players turn off the browser's picture-in-picture option, and some keep reacting to the original tab's visibility even after the video pops out. If that happens, the extension fix below is the one that works. We compare these options in more detail in keep a video playing while you work.

Fix 3: Unmute the player and mute the tab instead

People report that Chrome pauses or stops rendering muted video in background tabs. If you muted the lecture with the player's own volume control (because you only want captions, or you are rewatching a section), that can be why it stops.

Instead:

  1. Turn the player's volume back up.
  2. Right-click the lecture's tab and choose Mute site.

The page now has an unmuted video, but you hear nothing. To get sound back later, right-click the tab and choose Unmute site.

Fix 4: Control playback without switching back

Part of the annoyance is having to go back to the lecture every time you want to pause or rewind a few seconds. You may not need to.

  • Media keys. On most keyboards, the play/pause key controls whatever Chrome or Edge is playing, even when you are typing in another app.
  • Chrome's media controls. The music-note icon in the toolbar lets you play and pause the lecture from any tab in that window.

This keeps your hands in the editor. It does not stop a player that pauses itself, but it makes resuming a single key press.

Fix 5: Check your own extensions

Some extensions pause media on purpose: tab suspenders, "pause video when I leave" tools, and some focus or productivity extensions. If lectures only stop in one browser profile, open chrome://extensions (or edge://extensions), turn extensions off, and try again. Turn them back on one at a time to find the one responsible.

Fix 6: Turn on Focus Spoofer for the lecture tab

If the player pauses on visibility or focus no matter how you arrange your windows, the fix has to happen inside the page. Focus Spoofer (which we make) is a free, open-source extension for Chrome, Edge and Brave that does this on the tabs you choose.

On a tab where it is on, it:

  • keeps document.hidden false and document.visibilityState "visible"
  • blocks visibilitychange, pagehide and window-level blur and mouseleave events
  • keeps document.hasFocus() returning true
  • keeps requestAnimationFrame and requestVideoFrameCallback firing in hidden tabs, which some players use to draw frames

Clicks, typing and focus on elements inside the page still work normally, so the player's own controls, notes panels and transcripts behave as usual.

To set it up:

  1. Install it from the Chrome Web Store. It works in Edge and Brave from the same listing. No account is needed.
  2. Open the lecture, click the extension icon and choose Protect this tab. By default the page reloads once, so protection starts before the player's own scripts run.
  3. If you study on the same site every day, turn on Always protect this site so it switches on automatically there.
  4. Check it on the live test page: switch away and back, and the log should show nothing.

Your browsing data never leaves the browser. There is also an optional fingerprint randomization setting, unrelated to video, which you can turn off. The source is on GitHub.

What it cannot fix: it does not run on mobile apps or mobile browsers, it cannot stop Chrome's Memory Saver from unloading a tab you have not used in a while, and it cannot help if the video stops because of a network or player error. For those, see how to prevent a tab from sleeping.

Which fix to try first

  • Lecture pauses only when you change tabs: give it its own window (Fix 1).
  • Lecture pauses when you click into your editor: picture-in-picture (Fix 2), then Focus Spoofer (Fix 6).
  • Lecture is muted and stops in the background: unmute the player and mute the site (Fix 3).
  • It happens in one browser profile and not another: check extensions (Fix 5).

FAQ

Why does my Udemy video pause when I click into VS Code?

Clicking into another app takes focus away from the browser window, and the page receives a blur event. A player listening for that event pauses even though the video is still on screen. Picture-in-picture or a focus spoofer on that tab stops it.

Does putting the lecture on a second monitor help?

It helps if the player only checks whether the tab is visible, because a window on another monitor stays visible. It does not help if the player pauses when the window loses focus, since you will be typing in a different window.

Will Focus Spoofer work on Coursera and LinkedIn Learning as well as Udemy?

It works at the browser level, not per site, so it applies to any normal web page where you turn it on. It cannot run on chrome:// pages, the Chrome Web Store or the built-in PDF viewer.

Does it work in Firefox or Safari?

Not yet. It supports Chrome, Edge and Brave on desktop.

Why did my lecture reload after I left it for an hour?

That is the browser unloading an inactive tab to save memory, not the player pausing. Chrome calls this Memory Saver and Edge calls it sleeping tabs. You can exclude a site in settings, as explained in Chrome Memory Saver: on or off.

Keep reading

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