raingart / Nova-YouTube-extension

Apache License 2.0
213 stars 11 forks source link

[Bug] Video autoplays if comments are auto-expanded #87

Closed God-damnit-all closed 1 year ago

God-damnit-all commented 1 year ago

While "Video auto pause" does work for the initial page load, once I scroll down to do something like check the description, the video began playing. At first I wasn't sure why this was occurring, but then I realized that it was related to the triggering the comments to lazy-load.

As an experiment, I tried turning off the "Expand comments" option, and I found that with this disabled, the video no longer autoplayed when the comments section loaded up.

I have mine set to "always", but I tested "On hover" and its as you might expect... the video autoplays as soon as an expandable comment is hovered over.


raingart commented 1 year ago

in Nova YouTube - test v.0.41.0 removed all other settings

i tested inchromium 89/109 + ViolentMonkey 2.14.0. And for me, adding the check below was enough to fix it:

document.addEventListener('click', ({ isTrusted }) => isTrusted && stopForceHoldPause());

you can extend the check considering selectors:

document.addEventListener('click', evt => {
            if (evt.isTrusted
               && ['button[class*="play-button"]', '.ytp-cued-thumbnail-overlay-image'].some(selector => evt.srcElement.matches(selector))
            ) {
               stopForceHoldPause();
            }
 });

And in the latest test version, I added a check that displays information about the type of click. Is it automatic or not https://gist.github.com/raingart/1288df51d266deb2dd0c85a3bdfacd3e#file-nova-user-js-L76-L77 But I forgot to add the comment-expand plugin

I need information whether you have an alert and whether it correctly determines the type of click (automatic or not) Because the fix works for me.