Background information @ Mozilla Discourse.
User wants to prevent auto-playback of video. Blocking large media elements could be used for this, but unfortunately the current load-on-demand code (which load blocked media elements with a click of the mouse) does not work if the blocked media element is not immediately under the mouse, i.e. if it is covered with other (invisible) DOM elements. uBO should be smarter and attempt to find any and all blocked media elements under the mouse, and load them (and possibly trigger playback for video/audio?)
Why not toggle Firefox's built-in preference media.autoplay.enabled to enable or disable auto-playback? It would be a global setting, like the Privacy options in uBO's settings.
That partially works, but I know YouTube makes efforts to start playback even if that setting is disabled, by using JS to start the player anyway.
I want to look into this issue regardless, it's annoying sometimes to have to force a reload of all blocked media elements on a page just because the one we are interested in is behind invisible DOM elements.
@gorhill this post is about the same issue as the title, but from a different angle so I'm not sure whether to open a new issue.
Another way to improve the smarts of the "large-media block" process would be to allow large media loaded from the browser's cache. The use case is: I block large-media by default. I go to a website where I click on a few elements that I wish to see, so they get loaded. Later in the day, I come back to the website, but the large-media gets blocked again even though it would cause no network bandwidth to get it (browser would load it from its cache). In this scenario, blocking the large-media the 2nd time around does not yield the intended benefit (bandwidth reduction) and requires the user to repeat herself when she has already made her preference known.
URL from original post changed https://discourse.mozilla.org/t/support-ublock-origin/6746/18
The original video given as example is blob:-based, so the improvements here won't help in that case. Firefox's own block auto-play feature also does not work.
Firefox's own block auto-play feature also does not work.
specific video url ?
@gwarser this one https://www.businessinsider.com/scotus-justice-makes-racial-remarks-2015-12?IR=T ?
@uBlock-user yes. Auto-play blocking works now in Firefox. But it's not static html video, so no-large-media does not work on it.
Click to load does not work on videos.
I first notices on Firefox NSFW chan.sankakucomplex.com, relatively safe sample: https://chan.sankakucomplex.com/post/show/21932932, only <video> element with <p> inside. Seems to work on Chrome. On Firefox only gray placeholder.
I also tried on GfyCat https://gfycat.com/fatherlygrizzledelectriceel-bouncing this is safe, <video> with <source>. If I click after page is loaded completely, both Chrome and Firefox cannot play it. In Chrome, if I click before page finishes loading, then it sometimes start playing.
On Firefox only gray placeholder.
On Firefox, uBO's click handler is never called when clicking the missing video, the browser eats the event. I need to find a way around this quirk.
Most helpful comment
@gorhill this post is about the same issue as the title, but from a different angle so I'm not sure whether to open a new issue.
Another way to improve the smarts of the "large-media block" process would be to allow large media loaded from the browser's cache. The use case is: I block large-media by default. I go to a website where I click on a few elements that I wish to see, so they get loaded. Later in the day, I come back to the website, but the large-media gets blocked again even though it would cause no network bandwidth to get it (browser would load it from its cache). In this scenario, blocking the large-media the 2nd time around does not yield the intended benefit (bandwidth reduction) and requires the user to repeat herself when she has already made her preference known.