Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add playbackRates() method #7198

Closed
gkatsev opened this issue Apr 20, 2021 · 11 comments · Fixed by #7228
Closed

Add playbackRates() method #7198

gkatsev opened this issue Apr 20, 2021 · 11 comments · Fixed by #7228

Comments

@gkatsev
Copy link
Member

gkatsev commented Apr 20, 2021

Add a new playbackRates(rates) method to the player which will update the playback rates used by the playback rate menu. It should also turn the menu button on if it is off.

Currently, the only way to turn it on is by providing a playbackRates option during player initialization. This will allow users to update the menu and turn it on after a player has already been created.

@AwokeKnowing
Copy link

this would match several other things like poster() autoplay() etc and help us keep our clients in compliance with regulations that require users to complete training where there should be no rates faster than 1.0 since training must take a minimum amount of time, and be enforced in software. So there's a list of items in a playlist, and playbackrates > 1 only show for videos that have already been watched. for unviewed videos, the lower playback rates are helpful for some people, especially foreign language speakers, as well as some process demonstrations

@gkatsev
Copy link
Member Author

gkatsev commented Apr 21, 2021

since training must take a minimum amount of time

I still think that's a completely ridiculous requirement since different people have different needs, but that's definitely a separate story.

@mister-ben
Copy link
Contributor

mister-ben commented Apr 21, 2021

Makes sense to have this. What should it do if rates were present and then removed? Disable or hide the menu button?

since training must take a minimum amount of time

If I have to listen to training with someone speaking far too slowly, I start "multitasking" and paying less attention. Completely counterproductive to prevent me setting a comfortable speed. (off topic for this thread, and meant as feedback rather than a rant...)

@brandonocasey
Copy link
Contributor

Seems like a good idea to me.

@gkatsev
Copy link
Member Author

gkatsev commented Apr 21, 2021

Oh, yeah, forgot to add it in later but I was thinking that playbackRates([]) should remove/hide the button.

@AwokeKnowing
Copy link

question, should changing playbackrates enforce changing the playback rate to an option in the list?

(I assume answer is no..)

@gkatsev
Copy link
Member Author

gkatsev commented Apr 22, 2021

Yeah, it shouldn't affect the actual playback rate, only the display of the menu.

@AwokeKnowing
Copy link

If I have to listen to training with someone speaking far too slowly, I start "multitasking" and paying less attention. Completely counterproductive to prevent me setting a comfortable speed. (off topic for this thread, and meant as feedback rather than a rant...)

haha, yeah, tell that to your local state government regulators that measure required training in minutes.

@AwokeKnowing
Copy link

for reference, my current implementation:

let rates = this.player.disableFF()?[0.25, 0.5, 0.75, 1]:[0.25, 0.5, 0.75, 1, 1.25, 1.5, 2];
controlBar.replaceChild('PlaybackRateMenuButton',{playbackRates:rates})

@misteroneill
Copy link
Member

I am in favor of this idea!

gkatsev added a commit that referenced this issue May 10, 2021
Adds a new playbackRates() method that takes an Array of numbers
representing the rates that are wanted to show up in the playback rates
menu. When new rates are given, a rateschange event will trigger, which
will be used by the PlaybackRatesMenuButton to update itself.

An empty array will hide the menu. No value will return the currently
set playback rates. Other values will be ignored.

Fixes #7198
@gkatsev
Copy link
Member Author

gkatsev commented May 10, 2021

PR #7228

gkatsev added a commit that referenced this issue Jun 8, 2021
Adds a new playbackRates() method that takes an Array of numbers
representing the rates that are wanted to show up in the playback rates
menu. When new rates are given, a playbackrateschange event will trigger, which
will be used by the PlaybackRatesMenuButton to update itself.

An empty array will hide the menu. No value will return the currently
set playback rates. Other values will be ignored.

Fixes #7198
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 25, 2022
edirub pushed a commit to edirub/video.js that referenced this issue Jun 8, 2023
Adds a new playbackRates() method that takes an Array of numbers
representing the rates that are wanted to show up in the playback rates
menu. When new rates are given, a playbackrateschange event will trigger, which
will be used by the PlaybackRatesMenuButton to update itself.

An empty array will hide the menu. No value will return the currently
set playback rates. Other values will be ignored.

Fixes videojs#7198
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants