raingart / Nova-YouTube-extension

Apache License 2.0
212 stars 11 forks source link

[Bug] Video autopause is having weird issue with Space (play/pause) keyboard shortcut #123

Closed BobbyWibowo closed 10 months ago

BobbyWibowo commented 10 months ago

The issue is very straightforward. If "Video autopause" plugin is enabled, then whenever you press Space key, the video will always resume, EVEN IF you are currently focused in the comment input textarea.

I do not have "Player shortcuts always active" plugin enabled


Additionally, trying to pause a video by clicking on this specific button will always fail screenshot It will always resume the video straight away. The same happens when you use Space keyboard shortcut. It can resume, but it cannot pause.

Clicking on the video itself, or using k keyboard shortcut, work fine though

raingart commented 10 months ago

yep, I see. I don't know what the reason is Did this plugin work fine before?

I replaced the implementation with a completely different one. It is more effective but also more dangerous. Because theoretically it can break the work of other scripts and the player itself

beta ver https://gist.github.com/raingart/87cdad75f8e11f21f6ee937eab4e6962

BobbyWibowo commented 10 months ago

Did this plugin work fine before?

I think it had always been broken, but I don't really send comments a lot so I was never bothered enough to troubleshoot it till today haha

I replaced the implementation with a completely different one. It is more effective but also more dangerous. Because theoretically it can break the work of other scripts and the player itself

beta ver https://gist.github.com/raingart/87cdad75f8e11f21f6ee937eab4e6962

Thank you, I can confirm this almost works flawlessly on my end

The only issue I immediately noticed is only that when navigating to other videos, sometimes you can't resume by clicking on the video itself, but instead must press the Play button in the controls bar, or pressing Space key (oddly enough, k key won't work when this happens)

Here's a sample recording (issue appears by the 3rd video, but on my testing, it can happen as early as the 2nd video): https://github.com/raingart/Nova-YouTube-extension/assets/9364930/36da9449-9c03-4112-b76b-c76c3183c47e

raingart commented 10 months ago

Yes, the plugin essentially rewrites the work of the built-in player function. Including hotkeys.

Logically everything should be simple. Just pause() once and that's it. But in practice. For example, if after a pause you change the video quality. Then a reboot occurs and the player autostarts. I believe this is deliberately done for compatibility with advertising integrations.

But since you are the only one who pointed out such a fatal flaw in the plugin. I can assume that no one needs the plugin. So I'll just delete it. let others figure it out. There are hundreds of plugins for autopause.

@BobbyWibowo thanks for creating the issue

BobbyWibowo commented 10 months ago

But since you are the only one who pointed out such a fatal flaw in the plugin. I can assume that no one needs the plugin. So I'll just delete it. let others figure it out. There are hundreds of plugins for autopause.

Unfortunate but understandable

I guess, tip for future travelers that pass by this issue, to cope you can disable Autoplay via website permission in your browser. Though it won't pause when navigating to other videos but better than nothing


UPDATE: Found this userscript https://greasyfork.org/en/scripts/16323-youtube-player-controls, and it appears to have quite the reliable "Pause at Start" function. Doesn't seem to conflict with most of Nova's features (e.g. custom player buttons, etc), so I'm using both at the same time.