Add speed buttons to any HTML5 <video> element. Comes with a loader for YouTube and Vimeo
< Opiniones de Video Speed Buttons
Sorry for the late response. I haven't been on this site for a few weeks.
In the future, you might want to try submitting an issue on the GitLab repo. That should get GitLab to shoot an email my way, so that I'm more likely to see it.
This turns out to be easy to implement right in the callback. Here's what I came up with:
...
["=", "Reset Speed", function(ev){
let selbtn = buttons.head;
let result = null;
if(is_comment_box(ev.target))
return false;
while(selbtn !== null && result === null)
if(selbtn.speed === DEFAULT_SPEED)
result = selbtn;
else
selbtn = selbtn.next;
// above loop will only terminate upon a successful match or the exhaustion of the list
// the latter case is an edge case (you can't call `null.el.dispatchEvent`), hence...
if(result === null)
result = buttons.head;
result.el.dispatchEvent(new MouseEvent("click"));
}],
...
The only thing that comes into question is intent.
I've decided that "default" means the already-existing constant, DEFAULT_SPEED
, which is set to 1.0 by default. This satisfies the requirement to reset to 1x speed and also allows the user freedom to configure that to be different.
I've also decided that in the case where DEFAULT_SPEED doesn't appear in the button list that the first button will be used. This is an edge case that will only occur if your config is improperly set. I.e. if pressing =
sets your speed to 0.25x, check your config.
=
?The rationale here is that while /
is close to ,
and .
, /
also happens to trigger the search bar, which would obviously be annoying. And while you might be able to use ev.preventDefault()
to override YouTube's default behavior, VSB is intended for more than just YouTube, so that would be an inelegant solution. VLC uses =
to reset speed to 1x, and I've never heard of a video site using =
for anything, hence it seems like a reasonable default.
By the time you're reading this, the greasyfork repo should already be synced with the v1.0.5 commit.
Working perfectly, thank you.
Reset speed button
I think a nice addition would be a reset button, i usually like to speed up the videos but there are some parts where i just want to play at normal speed and i need to keep pressing the ","
I was gonna say the "-" because for me its next to the "," & "." but maybe the "*" or just set any button you want and we just change it to what ever.