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

feat(ui): Add configurable rates #3579

Merged
merged 2 commits into from
Aug 23, 2021

Conversation

nbcl
Copy link
Contributor

@nbcl nbcl commented Aug 15, 2021

The present pull request aims to provide a solution to #3443 (How to Customise PlayBackRate or Fast_Forward rate) by adding optional custom rates for playback, fast forward and rewind.

Fixes: #3443

Example

How to preview

Initialize the client with a config that contains playback_rate, fast_forward and rewind in the controlPanelElements and select a list of rates for playbackRates, fastForwardRates and rewindRates.

const config = {
 'controlPanelElements': ['playback_rate', 'fast_forward', 'rewind'],
 'playbackRates': [0.5, 1, 1.5, 2, 4.321],
 'fastForwardRates': [2, 4, 8, 1],
 'rewindRates': [-1, -2, -4, -8],
}
ui.configure(config);

Changelog

docs/tutorials/ui-customization.md

Adds a brief description and example for the playbackRates, fastForwardRates and rewindRates configuration.

ui/externs/ui.js

playbackRates, fastForwardRates and rewindRates are added as configurable options in the UI.

ui/fast_forward_button.js

this.fastForwardRates_ is added to load the configured rates. On every click, the next rate in the array is selected until the end is reached, where the rate is set back to the initial value at this.fastForwardRates_[0].

ui/playback_rate_selection.js

The original this.playbackRates_ map is built through a configurable array of numbers (playbackRates) and which also generates the text value ('1.25x' for 1.25).

ui/rewind_button.js

this.rewindRates_ is added to load the configured rates. On every click, the next rate in the array is selected until the end is reached, where the rate is set back to the initial value at this.rewindRates_[0].

ui/ui.js

Adds default values for playbackRates, fastForwardRates and rewindRates.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code
  • I have made the corresponding changes to the documentation
  • My changes generate no new warnings
  • I have run ./build/all.py and the build passes
  • I have run ./build/test.py and all tests pass

Adds configurable options for playback, fast forward and rewind rates.
Copy link
Contributor

@michellezhuogg michellezhuogg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job! Thank you!

ui/fast_forward_button.js Show resolved Hide resolved
Extends documentation for configurable rate options.
@shaka-bot
Copy link
Collaborator

All tests passed!

@michellezhuogg michellezhuogg merged commit f65b093 into shaka-project:master Aug 23, 2021
@github-actions github-actions bot added the status: archived Archived and locked; will not be updated label Jul 25, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: archived Archived and locked; will not be updated
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How to Customise PlayBackRate or Fast_Forward rate
4 participants