I want to hide the "download" button on the audio player provided by the Media module in Drupal 8. How can I do that?

  1. Create a subtheme if you haven't already.
  2. Find the file core/modules/file/templates/file-audio.html.twig and copy it to your subtheme's templates directory.
  3. Edit the following line in the file.

Original line:

<audio {{ attributes }}>

Change it to this:

<audio {{ attributes }} controlsList="nodownload">

| improve this answer | |
  • 2
    You should also be able to preprocess this to add onto the attributes. – mpdonadio May 12 at 13:58

For files uploaded into the private:// directory, you can restrict access via permissions. Also, take a look for the Protected File (from download) module.

| improve this answer | |
  • Which permission allows you to restrict access to file downloads? – Patrick Kenny May 13 at 15:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.