avi12 / youtube-auto-hd

A simple browser extension for changing YouTube videos' quality based on FPS.
https://avi12.com/youtube-auto-hd
GNU General Public License v3.0
235 stars 28 forks source link

[Bug] Settings popup appears when using left or right arrow keys #17

Closed sojusnik closed 2 years ago

sojusnik commented 3 years ago

Describe the bug When using left or right arrow keys on the keyboard to scroll through the video, then often the settings popup of YouTube appears. Sometimes it disappears again without interaction within a second, but mostly it just stays open. It disappears when f.i. a click is made somewhere on the page.

To Reproduce See above.

Expected behavior The popup should stay hidden and only appear, when clicking on the gear icon.

Details:

avi12 commented 3 years ago

Are you getting any console errors when the player settings suddenly appear?

sojusnik commented 3 years ago

Strangely, I didn't observe it the last days, but will have a look at the console, when it should reappear.

avi12 commented 3 years ago

I only know that this bug occurs when the user has received an update for the extension but did not refresh, though, even still, this bug shouldn't be in the first place because I am pretty sure I already pushed a while ago a fix for it Anyway, I do not encounter this bug, so it seems like it comes and goes randomly, which is very frustrating lol

On Sat, Dec 4, 2021, 11:17 sojusnik @.***> wrote:

Strangely, I didn't observe it the last days, but will have a look at the console, when it should reappear.

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/avi12/youtube-auto-hd/issues/17#issuecomment-985996602, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABRACFF56PDQE33VLUA6GU3UPHMBPANCNFSM5JCQIPNA .

janhartigan commented 2 years ago

Just noticed this starting today.

Chrome version: 97.0.4692.45

The settings is also popping up on every video at the start.

It also seems to happen when pressing any of the forward/backward buttons, including L and J.

stevencrader commented 2 years ago

I am also seeing this now.

Chrome: Version 96.0.4664.93 (Official Build) (64-bit)

Extension: 1.3.17

In the console, I see the messages:

On Load:

Uncaught (in promise) Error: Extension context invalidated.
    at yt-auto-hd-content-script-initialize.js:1
    at new Promise (<anonymous>)
    at i (yt-auto-hd-content-script-initialize.js:1)
    at n (yt-auto-hd-content-script-initialize.js:1)
    at HTMLVideoElement.m (yt-auto-hd-content-script-initialize.js:1)

When skipping forward

yt-auto-hd-content-script-initialize.js:1 Uncaught (in promise) Error: Extension context invalidated.
    at yt-auto-hd-content-script-initialize.js:1
    at new Promise (<anonymous>)
    at i (yt-auto-hd-content-script-initialize.js:1)
    at n (yt-auto-hd-content-script-initialize.js:1)
    at HTMLVideoElement.m (yt-auto-hd-content-script-initialize.js:1)
mattdavisgames commented 2 years ago

I've just started getting this issue today. Seems to happen every time. Settings are not visible at the start of a video, but appear after skipping forward or backward a few times using arrow keys (the first few skips work). Settings also appear when using comma and period keys to step through frames.

Chrome Version 96.0.4664.110 (Official Build) (64-bit)

Extension Version 1.3.17

avi12 commented 2 years ago

I am also seeing this now.

Chrome: Version 96.0.4664.93 (Official Build) (64-bit)

Extension: 1.3.17

In the console, I see the messages:

On Load:

Uncaught (in promise) Error: Extension context invalidated.
    at yt-auto-hd-content-script-initialize.js:1
    at new Promise (<anonymous>)
    at i (yt-auto-hd-content-script-initialize.js:1)
    at n (yt-auto-hd-content-script-initialize.js:1)
    at HTMLVideoElement.m (yt-auto-hd-content-script-initialize.js:1)

When skipping forward

yt-auto-hd-content-script-initialize.js:1 Uncaught (in promise) Error: Extension context invalidated.
    at yt-auto-hd-content-script-initialize.js:1
    at new Promise (<anonymous>)
    at i (yt-auto-hd-content-script-initialize.js:1)
    at n (yt-auto-hd-content-script-initialize.js:1)
    at HTMLVideoElement.m (yt-auto-hd-content-script-initialize.js:1)

This error has to do with not being able to retrieve fun the storage (i.e. to get the users preferences), which typically happens when the extension is being reloaded (e.g. updated), unless I am missing something and another thing could cause this error

stevencrader commented 2 years ago

This error has to do with not being able to retrieve fun the storage (i.e. to get the users preferences), which typically happens when the extension is being reloaded (e.g. updated), unless I am missing something and another thing could cause this error

That could be it. I disable and re-enabled the extension as part of debugging this issue.

I don't see any console messages now that the extension has been enabled for a while and YouTube has been reloaded a few times.

avi12 commented 2 years ago

This part should be responsible for handling such errors, so in such case, use the last value instead of retrieving from the storage https://github.com/avi12/youtube-auto-hd/blob/c46cccafe59d6043aff7b95ed08130e9446c4aae/src/yt-auto-hd-content-script-functions.js#L176-L183

avi12 commented 2 years ago

This error has to do with not being able to retrieve fun the storage (i.e. to get the users preferences), which typically happens when the extension is being reloaded (e.g. updated), unless I am missing something and another thing could cause this error

That could be it. I disable and re-enabled the extension as part of debugging this issue.

I don't see any console messages now that the extension has been enabled for a while and YouTube has been reloaded a few times.

I have a feeling that the context becomes invalidated not just because the extension is being reloaded

MelloLuvsPeen commented 2 years ago

When you click on a video the settings menu pops up for a split second, And also its not just the arrow keys it is the function of skipping left and right, It also does it when you press "J" and "L", very annoying.

avi12 commented 2 years ago

I know The thing is, I'm puzzled by what's triggering the issue in the first place, since as I mentioned in one of my previous comments, it should be handled

dnmTX commented 2 years ago

@avi12 same here and i'm with Chromium 92.X.X.X,not even close to the latest. I haven't been watching any videos on YT for a while until today and was wondering what causing this annoyance. Also i don't get any errors on my end in console. Hopefully it's something small and easy to fix 👍

avi12 commented 2 years ago

I know The thing is, I'm puzzled by what's triggering the issue in the first place since as I mentioned in one of my previous comments, it should be handled

That shouldn't be able to fix anything If it does, it's very peculiar

LoganDark commented 2 years ago

Looks like this issue might be caused by a youtube update which causes the extension to fail to go through the menu completely? I've noticed that the extension uses the GUI to set the resolution, which is annoying because it randomly sinks my keypresses when I'm trying to skip through the video, but recently the extension hasn't been closing the menu properly so I have to use the mouse to close it. Very slow and annoying. Hope it is fixed soon :)

avi12 commented 2 years ago

Looks like this issue might be caused by a youtube update which causes the extension to fail to go through the menu completely? I've noticed that the extension uses the GUI to set the resolution, which is annoying because it randomly sinks my keypresses when I'm trying to skip through the video, but recently the extension hasn't been closing the menu properly so I have to use the mouse to close it. Very slow and annoying. Hope it is fixed soon :)

Interesting, now the issue is magically reproducible I hope that later today I will have some time to investigate it (as I have an IRL job)

LoganDark commented 2 years ago

Interesting, now the issue is magically reproducible

yeah, I hate how update rollouts work. you can't fix issues with the new updates until you yourself get the update. :(

avi12 commented 2 years ago

@LoganDark That's the thing with software development 😉

Banderi commented 2 years ago

Only just got this issue today, can confirm. Seems to be classic A-B testing crap done by Youtube, which makes reproducing bugs like these incredibly frustrating. :(

avi12 commented 2 years ago

A few minutes ago, I started debugging the issue I'm working as fast as I can to find why the bug occurs, and of course, find a fix for it

jq-green commented 2 years ago

Just started to encounter this too(on load or arrow keys). For reference if it helps, I tested a similar extension (Auto Quality for YT) and theirs do not exhibit this behavior. But I prefer to use auto-hd so hopefully a fix is found.

Env: Youtube auto-hd v1.3.17 Chrome v96.0.4664.110

avi12 commented 2 years ago

UPDATE: I found a pattern in the code https://github.com/avi12/youtube-auto-hd/blob/c46cccafe59d6043aff7b95ed08130e9446c4aae/src/yt-auto-hd-content-script-functions.js#L13-L16 If isLastOptionQuality() turns to be false, I noticed that the menu is triggered to open

avi12 commented 2 years ago

UPDATE: Fixed the issue, I'm about to push the commits & update

avi12 commented 2 years ago

Gonna reopen it so no new issues will be created regarding this bug

avi12 commented 2 years ago

Found a different issue, working to fix it

avi12 commented 2 years ago

I realized what the issue is For some reason, this function: https://github.com/avi12/youtube-auto-hd/blob/503ae04554c2e9e7cd2354575697956d0ac299a7/src/yt-auto-hd-content-script-functions.js#L19-L30 will get called repeatedly

Because each call forces the MutationObserver to observe changes and will open the quality menu as soon as the menu opens, I need to find a way to make this function only be called once every time the quality needs to be changed, i.e. once the video page loads, on every navigation, and every time the player "refreshes"

avi12 commented 2 years ago

Came up with a solution a few minutes ago

avi12 commented 2 years ago

Still keeping the issue open, so long that the extension stores didn't push the update yet, so new users who want to report the issue will see it open

avi12 commented 2 years ago

I found another bug - this time it's about setting the quality in a channel page I'm investigating an all-in-one solution, i.e. one that works for both /watch pages and channel pages

avi12 commented 2 years ago

Still keeping the issue open, so long that the extension stores didn't push the update yet, so new users who want to report the issue will see it open

xproplayer commented 2 years ago

Hey avi12,

Is there a way for us users to push / force receive the update in the webstore? I uninstalled and re installed but i'm still just seeing the Nov 10th release date.

avi12 commented 2 years ago

The thing is version 1.3.20 is pending review, so sadly there's nothing I can do about it Earlier today I sent a message to the support team in an attempt to speed up the review process, we'll see how that goes

xproplayer commented 2 years ago

The thing is version 1.3.20 is pending review, so sadly there's nothing I can do about it Earlier today I sent a message to the support team in an attempt to speed up the review process, we'll see how that goes

Is it possible to post the extension file that allows 1 click install in chrome w/ dev mode? Or should I follow the source and set it up on my computer that way?

avi12 commented 2 years ago

@xproplayer You should generally not install extensions manually unless you have to, like in this case That is because, generally speaking, extensions get reviewed by a review team that tests the extension to see that it's actually working and also not violating the store's policies

There is one case where I had to make users install the extension manually, YouTube Downloader, for an obvious reason

avi12 commented 2 years ago

image

medaIs commented 2 years ago

I updated to 1.3.20, at first the issue was gone but now a couple hours later its back again :( could you look into it again

dnmTX commented 2 years ago

I updated to 1.3.20, at first the issue was gone but now a couple hours later its back again :( could you look into it again

Works as expected here(Chromium Browser)

Qwarr commented 2 years ago

Updated to 1.3.20, worked for a short time but bug started to pop up again.

Here are the console errors I see:

2021-12-20 23_57_53-DevTools - www youtube com_watch_v=oHHz2aAFFA0 list=PLyDO0T4aHrDxiV8R-kG86Hkhf1s 2021-12-21 00_02_27-DevTools - www youtube com_watch_v=c-aFE0BXvzI list=PLyDO0T4aHrDxiV8R-kG86Hkhf1s

avi12 commented 2 years ago

@Qwarr I'll look into it later today Function n is https://github.com/avi12/youtube-auto-hd/blob/64b57d16bba6bf2da474fdd684b95ee32aa53736/src/shared-scripts/ythd-utilities.ts#L8-L39

dnmTX commented 2 years ago
if (!autoResize) { 
     return; 

That's why i don't experience any issues cause i don't really use the resize feature at all 💡

avi12 commented 2 years ago

Interesting, it will make it easier to debug once I get to the code

avi12 commented 2 years ago

@Qwarr Please open a new issue about the bug

Qwarr commented 2 years ago

Submitted

LoganDark commented 2 years ago

@avi12 Navigating quickly (i.e. holding down 5 key, or using the arrows quickly) still causes the settings menu to pop up sometimes. I'm sure I got the newest update since the menu no longer pops up all the time, but it still pops up sometimes

avi12 commented 2 years ago

@LoganDark I will look into it when I have the time Remember, I have an IRL job (my GitHub profile also says so)

LoganDark commented 2 years ago

Remember, I have an IRL job (my GitHub profile also says so)

I'm sorry? I'm not demanding anything. Just trying to give you a heads up.