How to embed social media content using Drupal Media

How to embed social media content using Drupal Media

18 أكتوبر 2022

Today, the Golems team decided to start a super-useful blog with vital video stats. They will definitely help to understand why should you think about the Drupal media module and Drupal video embedding.

  • 92% of marketers consider video to be a crucial part of their marketing plan
  • Video has increased traffic for 87% of marketers.
  • Video helped to generate leads for 86% of marketers.

Video marketing has long maintained its position of superiority. This is evidenced by the tremendous and long-term popularity of Tiktok and YouTube. People love watching videos. They interact more with video content than with text.
By the way, the Golems team is ready to help you with Drupal integrations and development!

How does the Drupal Media module work?

For some reason, there is such a stereotype about Drupal sites:

Drupal is not media-friendly.

We are ready to debunk this false claim thoroughly. That's why we wrote this blog. It was not always easy to add multimedia content to Drupal sites before Drupal 8. But in newer versions of Drupal, starting from the 8th, this problem is cleverly solved by the ingenious Media module. Let's take a quick look at this module, what it offers, how it works, and which minor versions of Drupal 8 already have it.
With the Media module, you can easily add Facebook-embedded videos, embed different kinds of media, embed videos with a URL, and more. Basically, it is a framework for loading, and managing various types of content. The Drupal media module can be extended with other contributed modules, such as:

and others.
Drupal integration with the contributed modules can be easily implemented. With their help, you can provide and manage media content however you want.
What you can do with Drupal Media:

  • manage media types such as remote video, audio, files, videos, and images
  • display media types the way you prefer
  • upload media using drag-and-drop functionality

and much more.

oEmbed support in the Media module

One more important feature is the oEmbed support for the Media module. Now the Media module has bud-in support for remote media using the oEmbed standard. The OEmbed feature allows embedding a third-party media provider. The most popular are YouTube, Vimeo, Twitter, Instagram, and Facebook.

How to embed videos with the Drupal Media module

Adding video to your website will increase your audience's engagement. But how to embed a video in Drupal so as not to harm the site? Let's explore this issue further!

Drupal video embeds with Media Module

Earlier, we mentioned that you could manage media types like remote video and video through the Drupal Media module. In other words, they differ from each other. Remote videos were originally hosted on other platforms, such as YouTube. We also include Facebook-embedded videos in these types of videos. Furthermore, such remote videos can be easily played on your Drupal site. You will have to sweat a little to accomplish this. 
Today, we use Media Entity Facebook module to get Facebook videos embedded. Before starting, enable the built-in Media module. Then, we'll add a new media type using Facebook as the source. To run this, follow the next steps:

  • Go to the Admin page
  • Click on Structure
  • Choose Media types
  • Add a new media type
  • Fill in the name, description, and media source fields
  • Don't forget to click Save

Creating a new Media Type requires creating a new field. Let's make a Facebook video media type field or modify the existing one. The way it should be done:

  • Create a new field for your content type 
  • In the Field Type drop-down menu, choose Media and name the field as you want
  • Select a few minutes ago, created a Facebook media type from the list of Media Types

The next important step is to change the input widget. If you have a new field, the "Media" field, then content rendering will be possible using the default method. But the autocomplete widget does not suit you and us. Here are the steps to follow:

  • Open the Form Display Control tab
  • Select the field where you entered the Facebook video URL.
  • Select the Simple Inline entity form option.

This way, you can embed the video just by pasting the Facebook video URL. Then, the Facebook video URL, not the embed code, can be captured in the media entity when the content is added. By default, for the content type, many fields will be displayed. You don't need all of them. You can disable them by going to the Manage form display menu.

And the final touch of our joint work- changing the display field. Again, by default, the module will only display the URL of the Facebook video, not the most embedded video. You can't leave it like that, so follow our next tips:

  • Go to the admin page
  • Click on Structure
  • Select Media Types/Control
  • Click on the name of your media type and then play
  • Select Facebook added in the format
  • Click Save

These steps will help you change the display type of the Media object and display a video on your Drupal site.

Second method: Embedding HTML

This method is easier and faster, but! it has its shortcomings. Once you embed a video on your site, you won't be able to:

  • re-used it through your site
  • save it to Media Library
  • it cannot be referred to

So, how do you implement basic HTML embed? Find the video on Facebook you want to share. In the upper right corner, click on the three dots. This will open an additional menu. After that, select Embed and copy the code. Now go back to the WYSIWYG editor field and paste the HTML code. That's all! Congratulations! You've done it!

To sum up

That's a short overview of the Media module. Working with multimedia is not as easy as it might seem, but it is beneficial. Drupal is a great CMS because it allows administrators to upload, embed and manage media. 
We hope our blog showed you how to embed videos on your Drupal site. So that adding multi-content does not turn into a quest, contact us. Visit our Drupal services page and get help regarding the Facebook-embedded video.

Comments

An
مجهول