Problem/Motivation
The videojs:video-player and videojs:video-player-remote SDCs define a skin prop (default / minimal), but their templates never use it. Instead, they print a skinTagName variable, which is not part of the component props and is only provided by the field formatters (see VideoJsVideoPlayerFormatterTrait::buildSharedVideoPlayerProperties()).
As a result, the components only work when rendered through the formatters. When used standalone (in a template or in Drupal Canvas), as documented in their READMEs, the skin element renders with an empty tag name:
<video-player ...> <> <video ...></video> </> </video-player>
The player is then broken: no skin, no controls.
The videojs:audio-player SDC does not have this problem, as it derives the tag name from its skin prop:
{% set skinTagName = playerSkin == 'minimal' ? 'audio-minimal-skin' : 'audio-skin' %}Related: the "minimal" skin no longer exists. The Video.js 10 library (tested with 10.1.0) no longer ships minimal skin bundles, and video.js / audio.js do not register <video-minimal-skin> / <audio-minimal-skin>. The module's *.minimal libraries have already been removed. However, the minimal option is still offered in:
- the "Skin" setting of the video and audio field formatters,
- the
skinprop of thevideo-player,video-player-remoteandaudio-playerSDCs.
Selecting it renders an unregistered custom element, so the player has no skin or controls. The library now ships other skin variants instead (e.g. video-neutral, video-compat, video-scaffold).
Steps to reproduce
- Use the component standalone in a Twig template:
{{ include('videojs:video-player', { sources: ['https://example.com/video.mp4'], }, with_context = false) }} - Inspect the output: the skin element is rendered as
<>...</>. - Same for
videojs:video-player-remote. - Separately: set "Skin" to "minimal" in a Video.js field formatter. The player renders
<video-minimal-skin>, which is never defined.
Proposed resolution
- Derive
skinTagNamefrom theskinprop inside thevideo-playerandvideo-player-remotetemplates, likeaudio-playeralready does. The formatters should passskininstead of a precomputedskinTagName, so the mapping lives in one place (the component). - Decide how to handle the
minimalskin:- remove the option from the formatters and SDC props, with an update hook that resets existing formatter settings to
default, or - replace it with the skin variants Video.js 10 actually provides (e.g.
neutral), including the matching libraries (and CDN variants).
- remove the option from the formatters and SDC props, with an update hook that resets existing formatter settings to
- Add test coverage for rendering the SDCs standalone.
Remaining tasks
- Agree on how to handle the
minimalskin (remove vs. replace). - Implement, add tests and an update hook (if settings change).
- Review.
User interface changes
The "Skin" options of the Video.js field formatters may change, depending on the decision above.
API changes
The skinTagName variable will no longer be passed by the formatters. Custom template overrides relying on it would need to use skin instead.
Issue fork videojs-3631297
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
thomas.frobieterLet's wait until issue #3616068: [10.x] Add a thumbnail setting to open VideoJs inside a Dialog (Modal) is finally fixed and merged. We made some relevant changes there for this issue.