How to Embed Videos in Drupal 8
Thursday, August 2, 2018 by Ana
Videos have become a major part of the internet alongside images and of course text. They not only increase the engagement of your website but also making it more engaging. Historically, Drupal hasn’t been too media friendly and has been criticized for that compared to other CMS. But with Drupal 8 as well as its media initiative, those days are behind us. In this post, let’s take a look at how easy it is to embed a video on your Drupal 8 site.
Start off by downloading the Video Embed Field module. Install the module and enable it (It requires the Drupal Media module to be enabled). Before we proceed, let’s talk a little about how this module works. In very basic terms, what this module does is that it creates a custom field type for videos and makes it easy to include this field in the content type of your choice negating the need for delving into the code and having to do this yourself manually. Currently it comes packaged with only Youtube and Vimeo, however, you can easily extend that list by downloading separate contributed modules for other services such as:
Apart from this, you can also change some additional settings such as autoplay, responsiveness as well as creating thumbnail previews.
Add Video Field
Now that your module is installed, you should be able to see it in the list of fields for your content types. To add a video field to your desired content type, navigate to Structures -> Content types -> Content type you want to add the field to -> Manage Fields. Next, click Add Field button and select Video Embed from the drop-down menu and label it. Leave the Allowed number of values to 1 and click Save field settings. Go through the settings in this field’s edit page and make changes suitable to you, upon which you’ll be done adding video field to your content type.
Now that you’ve added a video embed field to your content type, you will be able to embed videos to that content type easily without having to add the field again and again. You can also edit any previous content to include videos as well. Now, let’s try adding a video to our site and see how it works out!
To add a video, create or edit a previous content type to which you added the video field. Notice that now at the bottom there’s the field you created in the previous step, simply paste the link of the video you wish to add here:
Now, click save or preview and you should be able to see the video embedded successfully.
Configure embedded video
You can make further changes to your embedded video by changing the way it is displayed. This can be done by navigating to Admin -> Structure -> Content Types -> Manage Display from drop-down. Scroll down to the video field created in 1st step and click the gear icon.
Make the changes you want and save it.
That’s it! You’ve successfully learned how to embed videos on your Drupal site. As always modules make the process pretty straight-forward, however, this would be more complex if not for Drupal 8 excellent media initiative.
If you’ve got trouble with your Drupal 8 site or are simply stuck, feel free to contact us here at AGILEDROP. We specialize in Drupal and love working on it!