code-charity / youtube

[top~1 open YouTube & Video web-extension] Enrich your experience & choice! 🧰180+ options & clever features📌set+forget📌Longest-standing(yet rare&tough alone. Please help/join🧩us👨‍👩‍👧‍👧) ..⋮ {playback|content discovery|player|extra buttons|distractions|related videos|shorts|ads|quality|codec|full tab|full screen}
http://improvedtube.com
3.3k stars 500 forks source link

Changing playback speed with a hotkey does not work reliably #2166

Closed andraz closed 2 days ago

andraz commented 2 months ago

BUG: Playback hotkeys only work sometimes. ⚬ Browser: Chrome ⚬ HOW:

  1. map playback speed to two keyboard buttons (in my case , and . on SI keyboard, they would be < and > in US)
  2. after refreshing the YouTube page, buttons work and increase/decrease playback speed
  3. but after some navigation or even just changing the system volume with a keyboard volume button, they stop working
  4. refreshing the page fixes the issue

Might be related to #2046 and #664 (my buttons are identical to the built in speed hotkeys without shift, but the YT built in buttons work only up to 2x so they are practically useless - alternative fix might be to remove this limitation, to allow built in hotkeys to work correctly up to 16x)

ImprovedTube commented 2 months ago

thanks! @andraz is this true for our other shortcuts too?

everything about our shortcuts: #1565 (hopefully this motivates somebody to understand the whole script)

andraz commented 2 months ago

No, it seems J and L continue to work fine, but speed hotkeys break after I change system volume with my media keys.

I did figure out I can fix this by CTRL+1..9 or CTRL+TAB to switch tabs away and back to the YouTube player.

After this workaround, hotkeys work again (until I break them again with volume change). This can be replicated multiple times.

ImprovedTube commented 2 months ago

fascinating!

ImprovedTube commented 2 months ago

no wait, since J & L are youtube defaults, my original question remain. also check the browser console, please. and logging out of youtube maybe

andraz commented 2 months ago

Tested again with extra keys for skipping chapters back and forward linked to B and N.

They fail in the same way as speed buttons and can be fixed in same way, by switching tab focus away and back.

p.s.: checked console, no messages when broken or when fixed back to working state

raszpl commented 4 days ago

Tested again with extra keys for skipping chapters back and forward linked to B and N.

They fail in the same way as speed buttons and can be fixed in same way, by switching tab focus away and back.

looks like one of shortcuts bugs I just fixed, code wasnt keeping track of pressed keys well and losing events https://github.com/code-charity/youtube/pull/2421