Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make load-on-demand smarter for blocked large media elements #1390

Closed
gorhill opened this issue Feb 16, 2016 · 12 comments
Closed

Make load-on-demand smarter for blocked large media elements #1390

gorhill opened this issue Feb 16, 2016 · 12 comments

Comments

@gorhill
Copy link
Owner

gorhill commented Feb 16, 2016

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?)

@RoxKilly
Copy link

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.

@lewisje
Copy link

lewisje commented Feb 18, 2016

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.

@gorhill
Copy link
Owner Author

gorhill commented Feb 18, 2016

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.

@RoxKilly
Copy link

@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.

gorhill added a commit that referenced this issue Oct 18, 2020
Related issues:
- #1390
- #2334

The deadline to interactively load a specific media
element has been extended from 2sec to 5sec.

Clicking over a blocked large media element will cause
uBO to lookup and handle all potentially blocked large
elements at the cursor position. This should take care
of being able to unblock media elements hidden under
other DOM object.

The CSS style applied to blocked large media elements
has been fine tuned to improve interactivity.

uBO will now remember the specific media elements which
were unblocked and keep them exempted from being
further blocked. This would be an issue when unblocking
a video and then a bit later seeking to another point
in the video, in which case uBO would again block
network requests for that video.
@gwarser
Copy link
Contributor

gwarser commented Oct 19, 2020

URL from original post changed https://discourse.mozilla.org/t/support-ublock-origin/6746/18

@gorhill
Copy link
Owner Author

gorhill commented Oct 19, 2020

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.

@uBlock-user
Copy link
Contributor

Firefox's own block auto-play feature also does not work.

specific video url ?

@uBlock-user
Copy link
Contributor

@gwarser this one https://www.businessinsider.com/scotus-justice-makes-racial-remarks-2015-12?IR=T ?

gorhill added a commit that referenced this issue Oct 19, 2020
@gwarser
Copy link
Contributor

gwarser commented Oct 19, 2020

@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.

@gwarser
Copy link
Contributor

gwarser commented Oct 20, 2020

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.

@gorhill
Copy link
Owner Author

gorhill commented Oct 22, 2020

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.

gorhill added a commit that referenced this issue Oct 23, 2020
@gorhill
Copy link
Owner Author

gorhill commented Jul 10, 2021

Closing as I can't find a reproducible case, it seems changes over time ended fixing this one.

@gorhill gorhill closed this as completed Jul 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants