Force Facebook to play videos in background tab

7,391

Solution 1

I just enabled uBlock origin on Facebook again and now I can play videos in the background.

Seriously Facebook, what the hell?

Solution 2

Here's another simple workaround to execute in the dev console:

document.onblur = null
document.onvisibilitychange = null
Share:
7,391

Related videos on Youtube

shinzou
Author by

shinzou

Updated on September 18, 2022

Comments

  • shinzou
    shinzou over 1 year

    Recently Facebook added a feature that if I play a video and switch to another tab or a different program from chrome, the video stops playing.

    Is there a way to force it to keep playing?

    I use Chrome and I don't have flash.

    This is not enough to disable that feature:

    document.addEventListener('visibilitychange', function(e){
      e.stopPropagation();
      e.preventDefault();
      return false;
    })
    
    • Ravindra Bawane
      Ravindra Bawane over 6 years
      Do you know the method Facebook uses to detect a tab is no longer in front? Have you tried a different browser?
    • shinzou
      shinzou over 6 years
      Their code is obfuscated. And it looks like it doesn't happen on firefox. @music2myear
    • Ravindra Bawane
      Ravindra Bawane over 6 years
      I'd guess it's javascript, though I suppose HTML5 may include the ability to query the tab state as well. Or, at least, it would surprise me if HTML5 lacked this.
    • shinzou
      shinzou over 6 years
      I had uBlock origin on firefox enabled and on chrome it was disabled on facebook, enabled it again and now this stupid feature doesn't work. @music2myear
  • Ravindra Bawane
    Ravindra Bawane over 6 years
    Why are you blaming Facebook? That's actually a rather convenient feature for most people. uBlock Origin is likely blocking the element(s) Facebook uses for the detection.
  • shinzou
    shinzou over 6 years
    Because it's a very annoying feature that was obviously intended to make sure people actually watch ads, I just want to have a vid playing in the background and to listen to it, that's a fair expectation IMO, taking that option away is not cool.