Why do we use data attributes to set the vidstack settings

Created on 16 April 2025, 29 days ago

Problem/Motivation

I had inconsistencies when adjusting settings. I think the data attributes do not properly set the desired functionality sometimes. Was there a reason we did it this way?

It seems, that we could have also applied the settings on the javascript site (although this might also be prone to caching issues)?

Unsure if we should leave it or not.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Component

Code

Created by

🇩🇪Germany Grevil

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @Grevil
  • 🇩🇪Germany lrwebks Porta Westfalica

    @grevil: I was unable to provide the settings via JS drupalSettings, since when there were multiple instances of vidstack players on the same page, the settings of the first player were also used as the settings for all other players (usually correct, but it was messing up the differences in settings between local and remote players). By using data attributes as described in the vidstack docs injected via a twig template, I can fine-tune the settings for each individual player that is injected into the page. This will hopefully prove useful again, if we ever want/need to override the player settings on a per-entity basis.

  • 🇩🇪Germany Anybody Porta Westfalica

    Using data attributes is also helpful for being able to manipulate them even at the theming layer / twig level, so I think this is fine! :)

  • Yes, +1 for data-attributes!

Production build 0.71.5 2024