Ask HN: Is YouTube using a dark pattern to prevent background playlist play?

I listen to youtube playlists in the background fairly regularly and I'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.

More recently playlists have been looping the same song at seemingly random, looking to support forumss gives hundreds of comments reporting similar behaviour. (https://support.google.com/youtube/thread/16267152?hl=en)

Is youtube trying to drive adoption of youtube red by intentionally reducing the user experience for non premium users?

15 points | by teapot01 1627 days ago

2 comments

  • smittywerben 1627 days ago
    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/

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

    [2] https://testdrive-archive.azurewebsites.net/Performance/Page...

    • rasz 1627 days ago
      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);
    • teapot01 1627 days ago
      The pause button make sense, force users to focus on the page briefly every now and then to save bandwidth - Netflix does something similar to prevent long running auto-play.

      The looping is quite different though, there's no legitimate use for it, and I can't find any controls that would allow you to set a song to auto-repeat. So it's either a bug that they're struggling to fix or an intentional change to make play-lists less functional when you are not watching the platform.

  • mrsalt 1627 days ago
    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...

    or

    mpv https://www.youtube.com/playlist?list=PLThlnilAqSEtI9HNfZEEy...

    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

    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.