What is oEmbed and why is it useful?
From the oEmbed site [1]:
oEmbed is a format for allowing an embedded representation of a URL on third party sites.
Cool… what?
For example Vimeo will return the HTML required to embed one of its videos - oEmbed is particularly useful for videos [2].
http://vimeo.com/api/oembed.xml?url=http://www.vimeo.com/935317
<?xml version="1.0" encoding="UTF-8"?>
<oembed>
<type>video</type>
<version>1.0</version>
<provider_name>Vimeo</provider_name>
<provider_url>http://vimeo.com/</provider_url>
<title>Weird Fishes: Arpeggi</title>
<author_name>flight404</author_name>
<author_url>http://vimeo.com/flight404</author_url>
<is_plus>1</is_plus>
<html><![CDATA[<object type="application/x-shockwave-flash" width="504" height="348" data="http://vimeo.com/moogaloop.swf?clip_id=935317&server=vimeo.com&fullscreen=1&show_title=1&show_byline=1&show_portrait=1&color=00ADEF">
<param name="quality" value="best" />
<param name="allowfullscreen" value="true" />
<param name="scale" value="showAll" />
<param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=935317&server=vimeo.com&fullscreen=1&show_title=1&show_byline=1&show_portrait=1&color=00ADEF" />
</object>]]></html>
<width>504</width>
<height>348</height>
<duration>318</duration>
<thumbnail_url>http://20.media.vimeo.com/d1/5/57/04/55/thumbnail-57045532.jpg</thumbnail_url>
<thumbnail_width>160</thumbnail_width>
<thumbnail_height>120</thumbnail_height>
<clip_id>935317</clip_id>
</oembed>
Hidden away amongst the cruft you can see that the html
element contains their movie player embed code.
Why?
Think bookmarks, tumbles and other such delights. It’s like a rich meta description - though that sounds awfully close to being a cringe-worthy marketing buzzword creating developer cynicism.
Resources
- oEmbed - The official oEmbed site
- Vimeo oEmbed API documentation
- oohEmbed.com - Get oEmbed code for resources from non-oEmbed supporting sites
__ __
/\ \ /\ \
___ __ ___ ___\ \ \____ __ \_\ \
/ __`\ /'__`\/' __` __`\ \ '__`\ /'__`\ /'_` \
/\ \L\ \/\ __//\ \/\ \/\ \ \ \L\ \/\ __//\ \L\ \
\ \____/\ \____\ \_\ \_\ \_\ \_,__/\ \____\ \___,_\
\/___/ \/____/\/_/\/_/\/_/\/___/ \/____/\/__,_ /
===== because 'open embed' sounds too dirty =====
[1] Gotta love their ASCII art:
[2] One could argue that embedding videos is all it’s really useful for at the moment as it seems to be most popular among video services (not YouTube!) but that’s a discussion for another day.