Adding media content to a website instantly turns it into an engaging and attractive one. Media like images, videos, audio, slideshows, etc. work wonders in creating better and compelling digital experiences. The Drupal 8 Media module lets you manage your media elements easily and systematically. The release of Drupal 8.4 saw the inclusion of many media features like the Drupal Media module and Media Library in core.

What does the Drupal 8 Media module do?

The Drupal 8 Media module is often called as a ‘File browser to the internet’. The Drupal Media module lets you manage media files and assets regardless of where they are hosted. With this module, you can add/embed different kinds of media to your website content, save them in the Drupal 8 Media Library, embed videos with a URL, and more.

Drupal 8 Media Entity

The concept of Media entities is similar to that of Nodes. Media types are to Drupal 8 media entity as Content types are to nodes. However, with Drupal 8 Media entity, every media type is different. For example, an Image media type will come with a different set of features that can be modified (like dimensions) when compared to a video embed with a URL media type. Drupal 8 Media entity module is now in core. When you enable the Drupal Media module, these Media types are created automatically -

  • File
  • Image
  • Audio File
  • Video File
  • Remote Video

You can also add fields to media types and create your own media types based on your selected media source.

Installation of the Drupal Media module:

The Drupal 8 Media module ships with Drupal 8 core but you will need to enable it first to be able to use it. Here are the steps to enabling and using the Drupal 8 Media module-

Step1: 

First we have to go to Extend tab and enable the Media and Drupal 8 Media library module as shown in the below image.

Step2:

Once we enable the module now we can see that the Media types are part of the site’s structure, which has 5 types - Audio, Image , Remote video, File and video. Here we can create our own type as well.

Step3: 

Now we can use this as an entity reference for any field.
For example, here we will create a field for Images as Media type as shown in the below.

Next, we have to select a Reference type of media as shown in the below image.

Step 4: 

The field has been created successfully. It is time to add some media of the available types. You can add it in two ways:

  1. From the admin dashboard “Content ->  Add content ->  Article” for Image field

      2.Directly from the “Media” tab in “Content” where you will see the entire Media Library with all media that you have added.

The new Drupal 8 Media Library interface can display your media in the Gridview and in the Table view

It is easy to filter and sort the media by various criteria, as well as select particular items to do actions with them (delete, publish, save, unpublish).

Deeksha BSep 11, 2019

 
Deeksha BSep 11, 2019