xxxily / h5player

This software supports all audio and video websites, such as TikTok, YouTube, Bilibili, TED, Instagram, Twitter, etc. Features include: variable playback speed, screen capture, video download, custom settings, and extensions, etc., providing you with a pleasant online audio and video playback experience.
https://h5player.anzz.top
GNU General Public License v3.0
3.05k stars 253 forks source link

[BUG] Spacebar sends the play/pause twice #574

Closed shalak closed 9 months ago

shalak commented 12 months ago
  1. 问题描述 Sometimes, on some pages (e.g. youtube) I'm starting to observe really annoying behavior: pressing spacebar pauses and then immediately starts the video again. I commented out the body of switchPlayStatus and it fixes that issue, but then, the embedded youtube videos don't have spacebar working at all. Adding disable: true to youtube.com configuration section also seems to fix the problem.

  2. 出现上述问题的地址 youtube

  3. 你使用的浏览器与浏览器版本信息 Firefox 119.0 (64-bit)

seriousgigi commented 12 months ago

exactly came for this. so frustrating, pls fix this immediately. thx.

xxxily commented 11 months ago

已修复,请更新到最新版本

shalak commented 11 months ago

Unfortunately,3.7.9 did not fix the issue.

seriousgigi commented 11 months ago

Unfortunately,3.7.9 did not fix the issue.

i stopped updating after script started to save screenshots in png format. does that still happen? does script saving images in png format instead jpg?

LakeishaKowalczyk commented 11 months ago

@xxxily

宝,BUG 还在 火狐 114.0 暴力猴 h5player 3.7.9

shalak commented 11 months ago

Has anybody found a workaround for this issue?

LakeishaKowalczyk commented 11 months ago

Has anybody found a workaround for this issue?

Go to global settings, search for ‘space’ and check the ‘disable’

shalak commented 11 months ago

Go to global settings, search for ‘space’ and check the ‘disable’

I'm not sure I follow. I'm using Tampermonkey in Firefox. I installed the script from greasyfork. When I open the Tampermonkey dropdown, I see the following:

image

Clicking the "Global settings" spawn this popup:

image

After clicking OK, the page is refreshed, and the Tampermonkey dropdown shows some more options:

image

I cannot search for anything here. Clicking the Disable default playback progress control logic does nothing (the issue is still there), the only thing that happens except page-refresh is that the menu entry changes itself to "allow":

image

NOTE: clicking the "hotkeys" menu opens the hotkeys help page

What am I missing here? How do I disable the space-behavior in the userscript code itself?

LakeishaKowalczyk commented 11 months ago

Have a look at this link https://h5player.anzz.top/tools/json-editor/index.html?mode=tree&saveHandlerName=saveH5PlayerConfig&expandAll=true&json={}

图片

shalak commented 11 months ago

Have a look at this link

Huh, that seems to do the trick, at least for now. Thank you!

Would you mind explaining a bit - how is it possible? The userscript runs in youtube.com domain, it has access to e.g. my session cookies in that domain, right?

If it's able to do a GET to the h5player.anzz.top, there's nothing that prevents it from e.g. sending my session cookies. I was (mistakenly) sure that the Same Origin / CORS would not allow data from youtube.com to be send over to h5player.anzz.top - which clearly is not the case.

How is it possible, that the script running in youtube.com is able to fetch the data from, what I understand, are a local storage settings for h5player.anzz.top?

LakeishaKowalczyk commented 11 months ago

How is it possible, that the script running in youtube.com is able to fetch the data from, what I understand, are a local storage settings for h5player.anzz.top?

This link leads to the built-in settings interface of h5player. It should be located between the "Donate" and "Collapse menu 「Global Settings」" buttons , I’m not sure why it doesn’t appear in your script. Please note that youtube.com and anzz.top are unrelated and do not exchange any data.

shalak commented 11 months ago

I still don't understand the mechanics of it. Where is this data saved, how does it work that a JS script running on youtube.com can access it?

seriousgigi commented 11 months ago

How is it possible, that the script running in youtube.com is able to fetch the data from, what I understand, are a local storage settings for h5player.anzz.top?

This link leads to the built-in settings interface of h5player. It should be located between the "Donate" and "Collapse menu 「Global Settings」" buttons , I’m not sure why it doesn’t appear in your script. Please note that youtube.com and anzz.top are unrelated and do not exchange any data.

i am using old version and deleted the line related issue about space button but then space is not working for videos other than youtube. is there a workaround for disabling space button only for youtube.com?

LakeishaKowalczyk commented 11 months ago

i am using old version and deleted the line related issue about space button but then space is not working for videos other than youtube. is there a workaround for disabling space button only for youtube.com?

The approach I can think of is to save your modified code as a new script and set it to only be effective for YouTube, then exclude the original h5player script from being effective on YouTube. a bit weird though