
Ask HN: Is YouTube using a dark pattern to prevent background playlist play? - teapot01
I listen to youtube playlists in the background fairly regularly and I&#x27;ve noticed some interesting changes in the last couple of weeks. Initially it began with an auto pause, and a popup saying video paused, click to continue.<p>More recently playlists have been looping the same song at seemingly random, looking to support forumss gives hundreds of comments reporting similar behaviour. (https:&#x2F;&#x2F;support.google.com&#x2F;youtube&#x2F;thread&#x2F;16267152?hl=en)<p>Is youtube trying to drive adoption of youtube red by intentionally reducing the user experience for non premium users?
======
smittywerben
I haven't experienced this specifically on YouTube, but you may be talking
about the Page Visibility API [0]. I've tried to disable it natively in
Firefox and Chrome (without extensions) but with no avail. It can even tell if
I switch desktops in i3wm. Here's two demos [1][2]. I'm guessing it's saving
$$$ on bandwidth. I just want the option to turn it off.

[0] [https://www.w3.org/TR/page-visibility-2/](https://www.w3.org/TR/page-
visibility-2/)

[1] [http://daniemon.com/tech/webapps/page-
visibility/](http://daniemon.com/tech/webapps/page-visibility/)

[2] [https://testdrive-
archive.azurewebsites.net/Performance/Page...](https://testdrive-
archive.azurewebsites.net/Performance/PageVisibility/Default.html)

~~~
rasz
I quickly did something like this for Twitch, seems to work:

    
    
        document.hasFocus = function() {
          return true;
        }
        Object.defineProperty(document, 'hasFocus', {value: true})
        
        document.hidden = function() {
          return false;
        }
        //Object.defineProperty(document, 'hidden', {value: false})
        Object.defineProperty(document, "hidden", {get: function() { return false; }
        });
        
        document.webkitHidden = function() {
          return false;
        }
        Object.defineProperty(document, 'webkitHidden', {value: false})
        
        document.addEventListener("focus", function(e) {
          e.stopPropagation();
          e.stopImmediatePropagation();
          e.preventDefault();
          return false;
        }, true);
        
        document.addEventListener("visibilitychange", function(e) {
          e.stopPropagation();
          e.stopImmediatePropagation();
          e.preventDefault();
          return false;
        }, true);

------
mrsalt
It would not surprise me if that was the case.

I do get that "video paused" popup every once in a while, but I have never
seen the looping behavior.

If this is happening to you a lot, a cool way to get around it can be using
mpv/youtube-dl, they both support YouTube playlists:

mpv --no-video
[https://www.youtube.com/playlist?list=PLThlnilAqSEtI9HNfZEEy...](https://www.youtube.com/playlist?list=PLThlnilAqSEtI9HNfZEEyeFd4micqSmsJ)

or

mpv
[https://www.youtube.com/playlist?list=PLThlnilAqSEtI9HNfZEEy...](https://www.youtube.com/playlist?list=PLThlnilAqSEtI9HNfZEEyeFd4micqSmsJ)

The --no-video flag hides the mpv OSC (a simple GUI, which is not necessary if
you're playing songs). To navigate the playlist you'll need to learn a few
keyboard shortcuts (<, >, ENTER, p), and more:

[https://mpv.io/manual/stable/#keyboard-
control](https://mpv.io/manual/stable/#keyboard-control)

This works very well and is multi-platform.

Unless YouTube puts DRM on the whole site, this should continue working as
long as you keep mpv or youtube-dl updated. Sadly I don't think we can know
for sure if they're doing this on purpose.

