Re:Ask HN: Is YouTube using a dark pattern to prevent backgr...
by rasz on Monday October 14, 2019 @04:40AM
(#21246215)
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);
Re:Ask HN: Is YouTube using a dark pattern to prevent backgr...
by teapot01 on Monday October 14, 2019 @01:09AM
(#21245411)
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.
[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...