youtube icon indicating copy to clipboard operation
youtube copied to clipboard

Using keyboard shortcuts to pause/play makes pause/play not work

Open AmarinReyny opened this issue 1 year ago • 4 comments

Bug Report:

BUG: After installing and using the extension, using spacebar to switch between pause and play no longer works properly. If pressed while the video is playing, it will pause for only a brief moment, but will immediately resume playing; likewise, if pressed while the video is paused, it will play for only a brief moment, but will immediately go back to being paused. I tried setting the pause/play function to the spacebar in ImprovedTube's settings, but that did not solve the issue. The issue persisted until I uninstalled ImprovedTube.

HOW: 1. Install ImprovedTube. 2. Try to use the spacebar to pause/play a video. 3. Weep, for it does not work.

⚬ ImprovedTube Version: I've already uninstalled it. I can't check which version I had. I installed it yesterday, if that helps.

AmarinReyny avatar Feb 06 '24 21:02 AmarinReyny

Hey, I'm interested in taking on this issue, would that be possible?

Jibby2k1 avatar Feb 07 '24 01:02 Jibby2k1

same issue here on two different machines. setting the another key as keyboard shortcut for play/pause toggle ("P" in my case, for example) works as intended.

edit: just found out (for one machine only, the other one is at work and i can't try) that the issue maybe due to a powertoys component. closing powertoys from the tray restored the default spacebar shortcut.

CRiS-SVRS avatar Feb 24 '24 16:02 CRiS-SVRS

Shortcuts are buggy. Sometimes its easier to backup settings and just... reinstal extension.

same issue here on two different machines. setting the another key as keyboard shortcut for play/pause toggle ("P" in my case, for example) works as intended.

edit: just found out (for one machine only, the other one is at work and i can't try) that the issue maybe due to a powertoys component. closing powertoys from the tray restored the default spacebar shortcut.

Anoaxx avatar Feb 24 '24 20:02 Anoaxx

#1565

yay @Jibby2k1

ImprovedTube avatar Feb 25 '24 06:02 ImprovedTube

~~Cant reproduce. Youtube does Pause/Play with spacebar without any extensions. if you configure ImproveTube to pause on space too it will double the action resulting in exactly what is described here.~~

~~What ImproveTube could do is cancel all other events after intercepting Space, or just not letting Space be used. https://github.com/code-charity/youtube/issues/1815 there is tons of issues about this :/ remove space as default shortcut to fix this~~

raszpl avatar Mar 04 '24 08:03 raszpl

EDIT after 3 months and actually reading shortcuts code: My previous comment was fully wrong. This shouldnt happen. Configuring anything in ImproveTube on Spacebar should override YT default action.

Can reproduce, this simple code just simply doesnt work: https://github.com/code-charity/youtube/blob/e1c339d6b994d8824779f9cd55ca096d42838ec9/js%26css/web-accessible/www.youtube.com/shortcuts.js#L278-L286

Cause: YT doesnt use Click event for Space and Space alone !?!?! it uses KeyUp event. We only cancel keydown events. Two options:

  • make Space a special case and specifically check for it on every key press to be ready to cancel if custom Space shortcut is installed
  • prevent users from configuring Space in the first place

EDIT: or actually cancel all keyup events corresponding to triggered keydown shortcuts, FIXED Now why was YT Space shortcut a special case listening to keyup events? Because of magical YT 'Hold Spacebar for 2x>>' fast forward function.

raszpl avatar Jun 29 '24 06:06 raszpl