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

For some reason, the arrow keys don't advance/go back in time nor Up/Lower the Volume. Arrow keys just not working. #2406

Closed
Romdara13 opened this issue Jun 22, 2024 · 14 comments
Labels
Bug Bug or required update after YouTube changes good first issue A GitHub standard for inviting (new) contributors *Congratulations in advance!* help wanted Just an old github standard we add automatically. (The team can remove it when working on it.) up-for-grabs (a github standard for inviting new contributors) - Welcome! ♥

Comments

@Romdara13
Copy link

Bug Report: When i press either of the arrow keys, it doesn't advance/go back 5 seconds and does not Change the volume, it just freezes the video a bit without ANY change.

  • Description: upon clicking Arrow keys, nothing happens other than a little freeze in the player, then the video resumes and nothing happened. Note that the "L" and "J" Shortcuts for 10 seconds, odly, still work. Trying to mute the video with "M" also does not work. Another weird thing is that if i Change the Keys for "Seek Back/Foward 10 seconds" in the Shortcuts section, it stops working, its strictly something Arrows related.
  • Steps to reproduce this: I don't recall any changes in the config to reproduce the problem.
  • Since when?: It happened randomly after some hours that i downloaded the extension.
  • Browser: Firefox-
  • Are any errors shown in the Browser-Console?: (F12-key, then console-tab)
  • Does the bug not happen when you log out of YouTube? Then please copy your experiment flags list twice (with & without the error to compare). Enter: yt.config_.EXPERIMENT_FLAGS into the Browser console on youtube (F12-Key - Or find it in the html source(ctrl+U)
please check, if the issue has already been reported ever. (If so, that might inspires you to add different/better words to that report.)

GitHub's issue search (use the link or remove "is:issue is:open" from the search)

  • Expected preferred behavior:
  • ImprovedTube Version (Written in the Extension header & your Browser's store)
  • Tested as only active extension or in incognito mode?:
  • Your Settings (From the Extension's -Hamburger menu > Settings > Backup & reset > Export settings (You can remove any Blocklist, History Analyzer data - or paste the following in the Browser-Console and hit enter: (function({analyzer, blocklist, ...a}){return JSON.stringify(a)})(ImprovedTube.storage) )
  • YouTube-Document: (F12 copy the whole root element: <html> (alternative: CTRL+U) (https://github.com/code-charity/youtube/wiki/Contributing#Test )
  • OS / Device:
@Romdara13 Romdara13 added Bug Bug or required update after YouTube changes good first issue A GitHub standard for inviting (new) contributors *Congratulations in advance!* help wanted Just an old github standard we add automatically. (The team can remove it when working on it.) up-for-grabs (a github standard for inviting new contributors) - Welcome! ♥ labels Jun 22, 2024
@raszpl
Copy link
Contributor

raszpl commented Jun 23, 2024

Current Shortcuts code has limitations #2312 but afaik we dont touch arrow keys at all. Are you sure you dont have another extension doing something with keyboard input actuve?

@dante987
Copy link

dante987 commented Jun 23, 2024

hehe, I reported the same bug 10 hours ago even though the problem has been going on for a few days.

Unlike yours, mine is working totally fine on Firefox. I am facing these problems on "Opera One (version: 111.0.5168.25) - Chromium version:125.0.6422.143".
Extension Version 4.944

Even F5 to refresh the page is not working, so its not a YouTube problem.
Is your F5 working when on YouTube and this extension enabled ?

@raszpl
Copy link
Contributor

raszpl commented Jun 23, 2024

Thats great! erm I mean for finding the bug :-) We can try to pinpoint source of the problem if you or Romdara13 are ready for some debugging.

  • wait until bug starts to happen
  • open Devtools - if F12 doesnt work use menu "Developer Mode" button (no idea how its called precisely in Opera One).
  • navigate to Sources / Page
  • find and click on 'Improve YouTube!' 🎧 (for YouTube & Videos)/js&css/web-accessible/www.youtube.com/shortcuts.js
  • scroll to line ~90 to if (handler() === true) {
  • put breakpoint (by clicking on line number, a blue marker shoudl appear) on the very next line event.preventDefault();
  • switch back to YT and try pressing button that no longer worked just a moment before

if breakpoint triggers then we (or your settings) are to blame :-)

@dante987
Copy link

Screenshot 2024-06-24 152107
ok I did that.
As soon as I pressed M to Mute/Unmute on YouTube, it showed "Paused on breakpoint".

@raszpl
Copy link
Contributor

raszpl commented Jun 24, 2024

put breakpoint (by clicking on line number, a blue marker shoudl appear) on the very next line event.preventDefault();

we are testing here if ImproveTube somehow wants to preventDefault() on keys that dont belong to it

@dante987
Copy link

Did I do it right ? Is that what you wanted to check ?
I clicked on Line no.91, a blue arrow type thing(marker) appeared next to "if".
Then I went to youtube, clicked on the play button, then as soon as I pressed M to mute, it showed "ⓘ Paused on breakpoint" on the top right.
This is what you asked right ?

@raszpl
Copy link
Contributor

raszpl commented Jun 26, 2024

on the very next line event.preventDefault();

@dante987
Copy link

sss

ok.
same thing occurred.
"Paused on breakpoint" on the top right
and
"Paused in debugger" over the Youtube video on the Left.

@raszpl
Copy link
Contributor

raszpl commented Jun 27, 2024

ok, so its in your settings somehow
on youtube open devtools, console, paste (function({analyzer, blocklist, ...a}){return JSON.stringify(a)})(ImprovedTube.storage), copy result and post here

@dante987
Copy link

ok, so its in your settings somehow on youtube open devtools, console, paste (function({analyzer, blocklist, ...a}){return JSON.stringify(a)})(ImprovedTube.storage), copy result and post here

'{"always_show_progress_bar":true,"ambient_lighting":false,"below_player_loop":true,"below_player_pip":false,"below_player_screenshot":false,"bluelight":0,"dim":0,"ga":1668341473944,"hide_gradient_bottom":true,"lastDarkTheme":"black","limit_page_width":true,"mark_watched_videos":false,"player_hd_thumbnail":false,"player_hide_cards":false,"player_loudness_normalization":false,"player_remaining_duration":true,"player_rotate_button":true,"player_screenshot_button":false,"player_screenshot_save_as":"clipboard","schedule":"disabled","shortcut_rotate_video":{},"shortcut_screenshot":{"alt":false,"ctrl":false,"keys":{"83":{"code":"KeyS","key":"S"}},"shift":true,"wheel":0},"theme":"black","theme_primary_color":[200,200,200],"theme_text_color":[25,25,25],"track_watched_videos":false,"up_next_autoplay":false,"youtube_language":"default"}'

@raszpl
Copy link
Contributor

raszpl commented Jun 27, 2024

So this was the first time I read

function handler() {
var prevent = false;
for (var key in storage) {
var shortcut = storage[key],
same_keys = true;
if (
typeof shortcut === 'object' &&
(keyboard.alt === shortcut.alt || !ImprovedTube.isset(shortcut.alt)) &&
(keyboard.ctrl === shortcut.ctrl || !ImprovedTube.isset(shortcut.ctrl)) &&
(keyboard.shift === shortcut.shift || !ImprovedTube.isset(shortcut.shift)) &&
(mouse.wheel === shortcut.wheel || !ImprovedTube.isset(shortcut.wheel))
) {
if (keyboard.keys && shortcut.keys) {
for (var code in keyboard.keys) {
if (!shortcut.keys[code]) {
same_keys = false;
}
}
for (var code in shortcut.keys) {
if (!keyboard.keys[code]) {
same_keys = false;
}
}
}
if (!ImprovedTube.isset(mouse.wheel) || mouse.wheel === 0 || mouse.player === true) {
if (same_keys === true) {
if ([
'shortcutAuto',
'shortcut144p',
'shortcut240p',
'shortcut360p',
'shortcut480p',
'shortcut720p',
'shortcut1080p',
'shortcut1440p',
'shortcut2160p',
'shortcut2880p',
'shortcut4320p'
].includes(key) === true) {
ImprovedTube['shortcutQuality'](key);
} else if (typeof ImprovedTube[key] === 'function') {
ImprovedTube[key]();
}
prevent = true;
}
}
}
}
return prevent;
}

its written in a weird way, it only actually compares keys if they exist, if a shortcut doesnt exist like yours "shortcut_rotate_video":{} it bugs out. It needs a rewrite. Why does it even allow empty shortcuts :

if (this.isset(this.storage[name]) && this.storage[name] !== false) {

funny thing about {} empty Objects in javascript, they are not null https://mortoray.com/the-many-faces-of-undefined-in-javascript/ its a true minefield https://x.com/BrendanEich/status/1273250867823538176

For a quickfix execute ImprovedTube.messages.send({action: 'set', key: 'shortcut_rotate_video', value: null}) in the console on YT page.

Boy Im glad I added that action: 'set' message few weeks ago :]

@dante987
Copy link

For a quickfix execute ImprovedTube.messages.send({action: 'set', key: 'shortcut_rotate_video', value: null}) in the console on YT page.

yup, that fixed it.
Thank you :)

@Romdara13
Copy link
Author

Romdara13 commented Jul 1, 2024 via email

@raszpl
Copy link
Contributor

raszpl commented Jul 1, 2024

quickfix was tailored specifically for dante987 config
Romdara13 you will have to either manually find all broken shortcut_ definitions or
note down which ones you use
in Improvetube popup paste "Reset all shortcuts" inside search bar and click it to reset all shortcuts
configure your shortcuts again

or wait for next update :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bug or required update after YouTube changes good first issue A GitHub standard for inviting (new) contributors *Congratulations in advance!* help wanted Just an old github standard we add automatically. (The team can remove it when working on it.) up-for-grabs (a github standard for inviting new contributors) - Welcome! ♥
Projects
None yet
Development

No branches or pull requests

3 participants