I was wondering how could I modify the controls from a media video.
In my particular case, I want to remove the "Download" button from the controls, see:
1 Answer
The easiest workaround I could find was:
- Create a template on your custom theme for the video field such as
file-video.html.twig
. - Inside the template, create a video tag and place videos inside a
<source />
, then set a new attribute for the video tag calledControlsList
with a value ofnodownload
, like this:
<video {{ attributes.setAttribute('controlsList', 'nodownload') }}>
{% for file in files %}
<source {{ file.source_attributes }} />
{% endfor %}
</video>
You could also set the attribute manually: <video ControlsList='nodownload'/>