15 ms·
I wrote a small extension for personal use that can set various <video> preferences on a site-by-site basis. One of the main things I wanted to be able to do is
by oftenwrong 10y ago
I wrote a small extension for personal use that can set various <video> preferences on a site-by-site basis. One of the main things I wanted to be able to do is disabled autoplay. However, I found that a lot of sites just start the video from js instead of setting the 'autoplay' attribute. I was able to put in some stronger defense by using MutationObserver to stop a video that was played without the user clicking play, but then I found that some sites have code that will force a video to be playing, so even a manual pause would be overridden, and the site's js would contend with my extension's js.
There's no way to stop autoplay if we allow free, programmatic access to videos (without blocking js too, which I use noscript for).
I had the same problem with the 'loop' attribute. I wanted videos to not loop. I found that some sites loop videos without using the 'loop' attribute. I would disable 'loop' on the <video>, but the <video> would be replaced by a new autoplaying <video> when the original video ended.
This is about the point that I gave up on my extension.