question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Extending the controls and settings options API to support adding new controls and changing the order

See original GitHub issue

The current array options for buttons and settings has some limitation:

  • You can’t exclude a button or setting. You have to specify all buttons/settings you want to include instead (more verbose and complicated).
  • It’s not possible to control the order of the buttons. While it would be possible for Plyr to respect the array order (as a comment in the source code suggests), this would be a breaking change.
  • It’s not possible to add a custom button using the Plyr API directly (#787). The only way to do this now is by dom manipulation

Alternative syntax (boolean to disable, number to change the order):

new Plyr(element, {
    controls: {
        playLarge: false, // disable the big play button
        mute: 4, // move mute to after volume, for some reason
        chapters: 7 // add custom button "chapters" at position 7
    }, settings: {
        speed: false // disable speed settings
    }
});

The custom button “chapters” (#1011) could work by triggering a custom event. For example “plyr-custom-chapters”. This could also work with future plugin support, by letting plugin extend the Plyr defaults.

I’m not sure how to deal with svg icons, labels, toggle-states buttons or “sliders” though. It’s likely we need a more complex API for custom buttons.

This is not a high prio task. I just wanted to put it out there for feedback since the second and third issues have been brought up a few times.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:13
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
mayeauxcommented, Aug 27, 2020

+1 , don’t really have an input on how it should look in terms of an API, I trust whatever you guys come up with. My use case is that I would like to add a button for ‘theatre’ mode, so I’d be looking to just add an icon that I can target with some JS to make the necessary DOM adjustments.

1reaction
inside83commented, May 23, 2021

Can anyone help me add a custom button/link next to the volume button please?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Extending the controls and settings options API to support ...
Extending the controls and settings options API to support adding new controls and changing the order.
Read more >
Customizer Objects | Theme Developer Handbook
The Customize API is object-oriented. There are four main types of Customizer objects: Panels, Sections, Settings, and Controls. Settings associate UI ...
Read more >
Important changes (deprecations) coming in Power Apps and ...
We will be introducing new Fluent controls which have better usability ... Internet Explorer 11 support for Dynamics 365 and Microsoft Power ...
Read more >
Control when app changes are published with managed ...
Changes that are not held back by managed publishing · Increasing an existing staged roll-out to 100% · Updating your app's ”Release notes”...
Read more >
Controls | Maps JavaScript API - Google Developers
By default, all the controls disappear if the map is too small (200x200px). You can override this behavior by explicitly setting the control...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found