Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

oEmbed proposal: Difference between revisions

From MoodleDocs
(Initial copy from Google Docs.)
(No difference)

Revision as of 15:34, 2 November 2011

NOTE: I'm not posting this yet on the Moodle Docs wiki as I'm away 14 Oct-1 November.

Summary: This is a proposal and request for comments for a third-party/ contributed oEmbed filter plugin for Moodle. It would enable authors to easily embed multimedia resources from many web sites, for instance, YouTube, Vimeo, Slideshare, Prezi, LAMS and Google Docs.

IMPORTANT: This a proposal - the code does not yet exist!

[Todo: forum link]

What is oEmbed?

From the Wordpress docs:

oEmbed is "...a protocol for site A (such as your blog) to ask site B (such as YouTube) for the HTML needed to embed content (such as a video) from site B." [1]

Longer explanation:

oEmbed is a specification for a service-based approach to embedding external content. An author typically inserts a URL for the provider's web page containing the content, for example, for a YouTube video the author might insert http://youtube.com/watch?v=wZoMbBzqxyc or http://prezi.com/zoidjousoeat/technology-for-the-classroom/ in their Moodle resource. The client plugin (a Moodle filter), takes this URL and makes a request to a web service, for example, http://youtube.com/oembed?format=xml&url=http://youtube.com/watch?v=wZoMbBzqxyc

The web service responds using XML or JSON, and the response contains the embed code. The client replaces the URL in the author's text with the embed code.

Adoption

Many multimedia sites (providers) have an oEmbed service, including YouTube, Flickr, Slideshare...

There are several services to provide oEmbed on behalf of multiple multimedia providers:

  • Oohembed.com - 10s of providers
  • Embed.ly - 100s of providers; jQuery plugin; API key; services.json.
  • Embed.open.ac.uk - The Open University has an experimental oEmbed service, with a jQuery plugin. Currently it supports the OU player (release candidate), YouTube, Prezi, Google Docs spreadsheets/forms and LAMS (Beta). With the OU-embed service we are experimenting with improved mobile support, improved accessibility, HTML5, RDFa, internationalization, and fulfilling niche requirements (eg. embedding LAMS, Scratch etc.). Note, OU-embed ties in with the OULDI project and Cloudworks.

oEmbed is widely adopted on the client side. It is native to Wordpress 2.9+, there is a Drupal module, and libraries for PHP, Python and other languages. There are also in-browser, Javascript solutions - jquery-oembed, embed.ly's oEmbed plugin, and a version of jquery-oembed for Embed.open.ac.uk).

It is used in sites like Twitter [link],... and Cloudworks

Advantages

There are various advantages to oEmbed:

  • An author can avoid manual copy and paste of embed HTML code from the multimedia site. So, it simplifies the task of embedding, and prevents mistakes,
  • A web developer need only add support for oEmbed to their site or application once, and take advantage of multimedia embeds from many external sites,
  • It can allow un-privileged users (eg. students) to securely embed content,
  • For the multimedia providers (like YouTube), it allows them to update their embed code once, while the changes take effect across the Web (when caches are updated). This is particularly relevant at the moment - providers can seamlessly switch from Flash to HTML5 <video>, and from <object> to an <iframe> solution with improved content negotiation (mobiles, HTML5, internationalization).
  • A low-cost, lower risk way of experimenting with new multimedia sites and services, including those that are particularly interesting for learning, eg. TimeToast.com (interactive timelines), LAMS etc.

Dis-advantages

I haven't thought of any yet. Feel free to suggest!

The proposal

The proposal is for an oEmbed plugin for Moodle, implemented as a filter in PHP. The plugin would be influenced chiefly by the Wordpress and Drupal solutions.

Considerations/ proposed requirements:

  • A Moodle server-side filter solution - so not Javascript,
  • (Possibly an interim Javascript solution - using jquery-oembed - would this be useful, or confusing?)
  • A plugin for Moodle to consume external resources (it may also be interesting to turn Moodle into an oEmbed provider/server for consumption by other sites, though I don't yet have a specific use-case - not a priority),
  • The option of a filter syntax, eg. [embed] http://youtu.be/UniQuEiD [/embed] (Wordpress),
  • The option to reveal the filter syntax within the embed. That is, "Click me to see how I was embedded".
  • Probably, the option to parse all links - <a href=...</a>,
  • oEmbed responses cached in Moodle,
  • The ability to add and remove oEmbed providers via PHP configuration (Wordpress), and/or Moodle admin-interface (Drupal module),
  • Integration with Moodle roles and permissions,
  • Alignment with existing multimedia/ embedding solutions, and Moodle generally,
  • Like all Moodle filters (Moodle 2+?), oEmbeds could be enabled on a per-course (per-resource?) basis.
  • Security?
  • Performance? (caching)
  • I propose support for Moodle 2 onwards,
  • Support/ compatibility with Embed.ly (including API key, possibly services.json), and Oohembed.com,
  • A list of default providers on installation - requires discussion/input,
  • Evaluate auto-discovery, versus a white-list approach (security).

I'm writing this proposal to introduce the concept, gauge interest, foster discussion, identify issues/ priorities, and find interested parties and potential collaborators.

I hope to have at least some alpha-level code within 6 months.

NOTE: I propose developing this as a side-project, that is not part of my day job at The Open University (unless someone at the OU says they need it ;).)

[Todo: forum link]

See also