Embed with oEmbed

📘

You are reading API v2 documentation

Still using the Legacy API? Access the Legacy API documentation.


What is oEmbed

oEmbed is a format for allowing an embedded representation of a URL on third-party sites. The protocol allows a website to turn a Dailymotion video page URL into a structured data set, making it easy to embed and share content across the web.

When to use it

This protocol is the preferred method when you need to transform the URL provided into an embed code. For more information, see the oEmbed specification.

How to use it

Use the following endpoint to request embed information for a Dailymotion video. The url and player parameters are mandatory. url identifies the video, while player specifies the Dailymotion Player configuration used to create the embed.

https://www.dailymotion.com/services/oembed?url=VIDEO_URL&player=PLAYER_ID

You can also provide the optional maxwidth, maxheight, format, and callback parameters.


Available URL parameters

ParameterRequiredParameter description
urlYesThe Dailymotion URL for a video
playerYesThe ID of the player that will be used to create the embed. You can find this ID in the Players tab in your Dailymotion Studio.
maxwidthNoThe maximum width the embedded video can take on the destination page
maxheightNoThe maximum height the embedded video can take on the destination page
formatNoResponse format, either json or xml. Defaults to json
callbackNoWhen returning JSON, wrap in this function

Example

Call using URL parameters:

// Replace x7tgad0 with your video ID and xfh28 with your own Player ID 
// The url and player parameters are required

https://www.dailymotion.com/services/oembed?url=https://www.dailymotion.com/video/x7tgad0&player=xfh28&maxwidth=480&maxheight=269

JSON response:

The player parameter is mandatory. The returned html field contains an iFrame created with the specified Player ID. Requests that omit Player are invalid and will not return a usable embed.

In this example, player=xfh28 causes the returned iFrame to use the xfh28 player configuration.

{
"type": "video",
"version": "1.0",
"provider_name": "Dailymotion",
"provider_url": "https://www.dailymotion.com",
"title": "Midnight Sun | Iceland",
"description": "",
"author_name": "Dailymotion player demo",
"author_url": "https://www.dailymotion.com/dailymotionplayerdemo2",
"width": 478,
"height": 268,
"html": "<iframe frameborder=\"0\" width=\"478\" height=\"268\" src=\"https://geo.dailymotion.com/player/xfh28.html?video=x7tgad0\" allowfullscreen allow=\"autoplay; fullscreen; picture-in-picture\"></iframe>",
"thumbnail_url": "https://s2.dmcdn.net/v/SBL5q1Zl12Cbw0Bb_/x240",
"thumbnail_width": 427,
"thumbnail_height": 240
}

Did this page help you?