To enjoy all our Developer Portal features, please switch to Microsoft Edge, Google Chrome or Mozilla Firefox browsers.

How to embed Dailymotion videos using the oEmbed protocol?

Posted on by Nicolas Ferron
There is not just one way to embed Dailymotion videos, but using oEmbed is one of the simplest. Follow our video tutorial to learn how to retrieve a JSON representation of a video URL via the oEmbed protocol.


(VIDEO) How to embed a dailymotion video via the oEmbed protocol

Code sample

<!DOCTYPE html>
<html>
   <head>
       <title>Embed Player</title>
       <script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
   </head>
   <body>
       <div id="page"> </div>
       <script>
           var lnk = "https://www.dailymotion.com/services/oembed?url=https://www.dailymotion.com/video/x5s90td";            $.ajax({
               url: lnk,
               type: 'GET',
               crossDomain: true,
               dataType: 'jsonp',
               success: function (out)
               {                     
                    $('#page').append('<h1>Title: '+out.title+'</h1>');
                    $('#page').append('<p>Description: '+out.description+'</p>');
                    $('#page').append('<h3> Author: '+out.author_name+'<h3>');
                    $('#page').append('Thumbnail: <img src="'+out.thumbnail_url+'"/><br />');
                    $('#page').append('Video: '+out.html);
               },
               error: function (err)
               {
                    console.log(err)
               }
           });
           </script>
   </body>
</html>

The oEmbed specification

The oEmbed API allows websites to display embedded content when a user posts a link to that resource. Dailymotion’s video page URL is turned into structured data, which returns, among others information, an embed code that developers can easily integrate.

Providers must specify one URL scheme and API endpoint pairs. The URL scheme describes which URLs provided by the service may have an embedded representation. The API endpoint describes where the consumer may request representations for those URLs.

For more information, see the oEmbed specification.

Short URLs

You can also use the link on the sharing pop-up to retrieve the video information:

https://www.dailymotion.com/services/oembed/?url=https://dai.ly/x5s90td