New Drupal 8 oEmbed feature to easily embed third-party videos
There is a long-expected feature in Drupal 8 to make website users engaged and editors happy. It lets you easily embed third-party videos from an URL into your site’s content, and it’s called the oEmbed feature for Drupal 8’s Media module. It will be fully ready for production sites as of September 5, 2018, with the official release of Drupal 8.6.0. Of course, no one will be able to resist updating to this feature-rich version as soon as possible! You can always rely on our Drupal team for a smooth update to Drupal 8.6.0 or upgrade to Drupal 8. In the meantime, while the new Drupal subversion is “preening its feathers,” we will raise the veil on its new and magic oEmbed and see how it works.
What is oEmbed technology?
In a nutshell, oEmbed is a format that allows you to create embedded representations of URLs from third-party resources on your website. The oEmbed format is supported by the most popular resources with multimedia content — Facebook, Twitter, YouTube, Instagram, Flickr, Vimeo, and more.
The new oEmbed feature in Drupal 8
The fact that the oEmbed support has been added to Drupal Media module is awesome. It makes Drupal 8 a great choice not only for news and media websites, but for sites in all other industries that know the power of interesting video content.
This helps you capture your users’ attention with your product, service, or brand videos, as well as engage them with scenarios where they can share videos themselves. In addition, you can set up how exactly the videos will look when embedded into your content.
Drupal 8 has an out-of-box support for embedding YouTube and Vimeo videos by means of the oEmbed technology. However, Drupal 8’s basic API makes it possible to also set up this “cooperation” with any other oEmbed providers.
How oEmbed works in Drupal 8
In Drupal 8.6.0 with its oEmbed, we will immediately notice its novelty as compared to Drupal 8.5.6. First of all, an experimental module “Media Library” is in its core, which allows you to save and reuse media. Together with the Media module, the Media Library module should be enabled.
We have previously mentioned that the Media module introduced Media Types for Drupal 8 websites. So another great novelty of Drupal 8.6.0 is that, in addition to the already “traditional” Media Types in Drupal 8.5.x, there is a new one called “Remote Video.” See the difference:
Drupal 8.5.6:
Drupal 8.6.0:
When opening the “Remote Video” configuration tab, we see that this media type is already perfectly preconfigured. However, it also has options for us. We can configure the allowed providers and the video thumbnail location, as well as for field mapping.
OK, let’s see how any content editor or user — according to your website’s permissions and content creation scenarios — can embed a video from YouTube.
They can do it by going to Content — Add Media — Remote Video. And you see that the form is incredibly easy. Adding a URL is all they need!
So the newly added video is already saved in the website’s Media Library. What we now need is to display it in our content.
Here the options are unlimited! Site builders and administrators can decide which content types should have the video embedding feature (news, blog posts, products, bios, and so on). All they need is to add the “Media” field to particular content types.
In our example, we have added the “Media” field to the article content type and called it “OEmbed video.”
Let’s rearrange the fields a little to place the oEmbed video immediately after the article body.
From now on videos are embeddable into any article. For this, the article creation form now has an “OEMBED VIDEO” option where we will click “Browse media,” immediately see all the videos we have saved, and select the needed ones.
So here goes our article with the video embedded into it!
To recap
You can admit it — the new oEmbed feature in Drupal 8 looks really good! We have shown its basic settings, but there are more to play with.
If you need help with that, or if you want to customize the embedding functionality to your needs, you are welcome to contact our Drupal 8 development team.
And, of course, if you are not with the amazing Drupal 8 yet, reach out to us for an upgrade.
If you already are with Drupal 8, ask us and we will update you to Drupal 8.6.0 in the first days of September, as soon as it appears — bringing the oEmbed feature and plenty of others!
For any of these tasks, contact our Drupal experts, and let Drupal 8 work its magic on your site!