oEmbed¶
oEmbed is an open standard for allowing an embedded representation of a URL on third party sites. The simple API allows a website to display embedded content (such as photos or videos) when a user posts a link to that resource, without having to parse the resource directly.
Quick Example¶
A third party site has been asked by one of its user to embed the video at the URL http://www.dailymotion.com/video/xf02xp_uffie-difficult_music. The third party site make the following HTTP request (carriage returns have been added for clarity):
http://www.dailymotion.com/services/oembed?format=json
&url=http%3A//www.dailymotion.com/video/xf02xp_uffie-difficult_music
Dailymotion then responds with an oEmbed response (carriage returns have been added for clarity):
{
"type": "video",
"version": "1.0",
"provider_name": "Dailymotion",
"provider_url": "http://www.dailymotion.com",
"title": "Uffie - Difficult",
"author_name": "Uffie",
"author_url": "http://www.dailymotion.com/Uffie",
"width": 480,
"height": 270,
"html": "<iframe src=\"http: //www.dailymotion.com/embed/video/xf02xp\"
width=\"480\" height=\"270\" frameborder=\"0\"></iframe>",
"thumbnail_url": "http://static2.dmcdn.net/static/video/540/891/...",
"thumbnail_width": 426,
"thumbnail_height": 240
}
This allows the third party site to turn a Dailymotion video page URL into a structured data to allow embedding of the video on its site.
API Enpoint¶
You can use the API endpoint to request the embed code for a video from its URL. The response format can be either xml or json:
http://www.dailymotion.com/services/oembed?format=<format>
Dailymotion URL scheme is:
http://www.dailymotion.com/video/*
Discovery¶
Dailymotion supports discovery of the oEmbed URL. Each page that has a video will have two link tags with types application/json+oembed and application/xml+oembed containing the URLs for JSON and XML oEmbed responses.
Allowed Parameters¶
All arguments are sent as query parameters and must be urlencoded (as per RFC 1738).
- url (required): the Dailymotion URL for a video.
- maxwidth: The maximum width of the embedded video can take on the destination page.
- maxheight: The maximum height the embedded video can take on the destination page.
- callback: When returning JSON, wrap in this function (see JSONP proposal <http://bob.pythonmac.org/archives/2005/12/05/remote-json-jsonp/> for more info)
- wmode: Add the “wmode” parameter to the <embed>/<object> element of the Flash player. Can be either transparent or opaque.