This module offers a simple mechanism to handle remote URL content (usually from non-OEmbed providers) as Media items in Drupal.

Features

With this module, you will be able to create Media Types where editors can enter a remote URL, and have that content stored and displayed as a Media item in Drupal (available in the Media Library, media reference fields, WYSIWYG text areas, etc.). The format the content will have in Drupal will depend on the provider, such as an audio player, an embedded document preview, a map, etc.

Supported providers

Would you like to ask the inclusion on this list of another provider? Open an issue with your request. If you feel like writing some PHP code, here's an example of a patch/MR that adds a new provider to the module. Any contribution is appreciated!

How is this different than core Remote Video and OEmbed source plugin?

If the content you want to use comes from a provider that implements the OEmbed specification (in other words, if it's listed at https://oembed.com/providers.json ), you probably don't need this module. Drupal core has support for OEmbed providers, and it's a much more powerful API than what this module offers.

For non-OEmbed providers, the process of transforming an URL into an embedded content instance usually involves crafting a provider-specific snippet / embed code. This transformation fits well in a field formatter plugin, which is something that can usually be implemented in custom code. However, in order to have this content integrated with the Media system in Drupal, there is a non-negligible amount of code that is always the same for any provider. That's where this module comes in. You can either use one of the providers (formatters) included here, or use the module as a base to integrate your own formatter with Drupal media entities.

Technical implementation

There are two aspects of how this module is structured:

- A common body of code that is provider-agnostic, and provides integration with the Media system in Drupal. This includes a Media Source plugin, the constraint validator code, the form that integrates with the Media Library modal, etc.

- A collection of formatter plugins. These are provider-specific, and all the logic about how to render the remote content is contained in the formatter class and its corresponding twig template.

Configuration & Use

  1. Install this module as usual.
  2. Create a new Media Type, select "Remote Media URL" as Media source
  3. Important: Configure the display, selecting as formatter in the URL field your desired provider. For example, if you are creating a "Buzzsprout" media type, select "Remote Media - Buzzsprout" as formatter for the URL field in the "Manage display" tab.

I need a slightly different snippet / embed code in my project

The easiest option is to copy the corresponding twig template into your theme, and customize it there.

If you need in the template some information that isn't currently available, and your use-case is not particular to your project, feel free to open an issue and we can discuss it there.

Supporting organizations: 
Initial development

Project information

Releases