mod_oembed

Makes media resources from embeddable URLs through the OEmbed protocol.

This module, if activated, checks the pasted URLs in the create media / page dialog of the admin. It will show an embed option for services like YouTube, Vimeo or any other service which supports OEmbed.

A saved media resource has a thumbnail image which is downloaded from the OEmbed service and embedded in the resource. Furthermore, the resource’s medium record has an oembed field which contains the full JSON response of the request. The oembed field looks like this:

"oembed": {
  "type": "video",
  "version": "1.0",
  "provider_name": "Vimeo",
  "provider_url": "http://vimeo.com/",
  "title": "Heli Filming Showreel",
  "author_name": "Hot Knees Media",
  "author_url": "http://vimeo.com/hotknees",
  "is_plus": "1",
  "html": "<iframe src=\"http://player.vimeo.com/video/20898411\" width=\"640\" height=\"362\" ...",
  "width": 640,
  "height": 362,
  "duration": 106,
  "description": "description..",
  "thumbnail_url": "http://b.vimeocdn.com/ts/138/106/138106290_640.jpg",
  "thumbnail_width": 640,
  "thumbnail_height": 362,
  "video_id": 20898411
}

So, to display the HTML of an OEmbedded medium, you would do the following in a template:

{{ id.medium.html }}

The module also supports the use of the media tag:

{% media m.rsc[id].o.depiction.medium %}

Note however, that setting dimensions on this media tag is not supported for OEmbed, as the embed width/height is always taken from the provider.

Configuration options

The following m_config options are supported:

mod_oembed.embedly_key

The API key for Embedly. This configuration kan be added set in the admin via the menu Auth -> External Services.

mod_oembed.maxwidth

Requests the OEmbed service to return an HTML embed code with the requested maximum width. Defaults to 640.

mod_oembed.maxheight

Requests the OEmbed service to return an HTML embed code with the requested maximum height. Not set by default.

Edit on GitHub

See also

mod_video_embed

This module, if activated, checks the pasted URLs in the create media / page dialog of the admin. It will show an embed…

mod_video

Adds support for viewing and handling video medium items.

mod_audio

Adds support for viewing and handling audio medium items.

media

Show embed, video or audio media.

Referred by

mod_video_embed

This module, if activated, checks the pasted URLs in the create media / page dialog of the admin. It will show an embed…