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 tag#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 model#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.

Accepted Events

This module handles the following notifier callbacks:

  • observe_media_import: Expand supported oEmbed URLs into embeddable media metadata and resources.
  • observe_media_import_medium: Import a embedded medium for a rsc_import using m_media:get.
  • observe_media_stillimage: Return the filename of a still image to be used for image tags using oembed_admin:count_missing.
  • observe_media_viewer: Return the media viewer for the embedded video.
  • observe_rsc_update: Check if the update contains video embed information using z_acl:is_allowed.

Delegate callbacks:

  • event/2 with postback messages: fix_missing.
  • event/2 with submit messages: admin_oembed.

Edit on GitHub

Observes

Notifications

observe_media_viewer/2

Request to generate a HTML media viewer for a resource. The HTML data can not contain any Javascript, as it might be serialized. This could happen if the…

Notifications

observe_media_import/2

Notification to translate or map a file after upload, before insertion into the database Used in mod_video to queue movies for conversion to mp4. You can set…

Notifications

observe_rsc_update/3

An updated resource is about to be persisted. Observe this notification to change the resource properties before they are persisted.

Notifications

observe_media_stillimage/2

See if there is a ‘still’ image preview of a media item. (eg posterframe of a movie) Return:: {ok, ResourceId} or undefined

Notifications

observe_media_import_medium/2

Notification to import a medium record from external source. This is called for non-file medium records, for example embedded video. If the medium record is…

See also

Modules

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 option for Youtube and Vimeo URLs. It…

Modules

mod_video

Adds support for viewing and handling video medium items.

Modules

mod_audio

Adds support for viewing and handling audio medium items.

Tags

media

Show embed, video or audio media.

Referred by

Modules

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 option for Youtube and Vimeo URLs. It…