We use cookies to offer an improved online experience and offer you content and services adapted to your interests. By using Dailymotion, you are giving your consent to our cookies.

Getting Started

Embedding Videos on a Website

Dailymotion provides a simple way to embed videos on your website. On each video pages, users can copy/past an embed code. This embed code can also be obtained using the oEmbed protocol or through the Graph API. Note that our new iframe embeds are compatible with most mobile platforms like iOS, Android and Bada and some connected TVs.

The oEmbed protocol will be preferred when all you need is to transform a URL provided by one of your user into an embed code. If you have more complex needs like listing videos and embed them dynamically, our APIs are better suited. The REST API allows querying directly from the browser using JavaScript or from server using one of our SDKs.

If you need to control the playback of the video, you can opt for our Player API.

See API Reference to get the list of objects exposed by the APIs.

Embedding Videos in an iOS Application

Our new iframe based embeds are compatible with most mobile platforms (iOS, Android, Bada...). Embeded videos will thus perfectly work in Mobile Safari. Our embed player can also be used inside your iOS application:

If you load a webpage inside an UIWebView containing Dailymotion iframe embeds, they will just work. Although, you have to make sure you’re using the loadRequest: method to load the page. There’s some known issues if you are loading the HTML using the loadHTMLString:baseURL:: the video will play but it won’t go back to your page once the video ends. To workaround this issue, you may choose to write the HTML into a file so you can use loadRequest: with a file:// URL. There’s also some more advanced/performant solutions like NSURLCache poisoning, but this goes beyond the scope of this documentation.

If you need to render a single video outsite a webpage in your app, an alternate solution is to directly load the src of the iframe in a UIWebView which then can be sized and place anywhere you want in your application. Use the embed_url field of the API (see Video) as URL and load it like this:

webview = [[UIWebView alloc] init];
[webview loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:embedURL]]];

NEW: The Objective-C SDK now implements the Player API.

Publishing Videos

To publish videos on Dailymotion using the API, you have to follow several steps as described below. Note that most of those steps are implemented for your by our provided SDKs.

To publish a video, follow the following steps:

  1. Authenticate the user

    See authentication guide for more info

  2. Get an upload URL

    Perform an HTTP GET to /file/upload to get an upload URL. If you plan to make the end-user to post the video on this URL, you can set a callback URL to get your service to be called once upload finished. Add the callback_url query-string parameter to the URL with the encoded URL as value.

    example without callback_url:

    curl -i https://api.dailymotion.com/file/upload?access_token=XXX

    will return a JSON object:

    {"upload_url":   "http://upload-XX.dailymotion.com/upload?uuid=XXX&seal=XXX",
     "progress_url": "http://upload-XX.dailymotion.com/progress?uuid=XXX"}

    You can perform HTTP GET on progress_url to check file upload progression

    example with callback_url:

    curl -i https://api.dailymotion.com/file/upload?access_token=XXX&&callback_url=XXX
  3. Post the video

    Make the end-user to POST (or POST yourself) using multipart/form-data content-type with the file data in the file field:

    curl -F 'file=@/path/to/video.mp4' $upload_url
  4. Get the file URL

    Once POST finished, the upload server will return a JSON object if you didn’t provide a callback URL or will add query-string parameters to callback URL if you set one. The only field you need is the url field.

  5. Create the video object

    With the just created file URL, you can perform an HTTP POST to /me/videos?url=THE_URL. The id of the newly created video will be return in response.

  6. Publish the video

    Once video object is created, the video isn’t published. You have to perform an HTTP POST on the /video/VIDEO_ID with the fields you want to modify. Some fields like title, tags and channel are mandatory before you are able to publish the video. Set those field with the method, and set published field to true to publish the video.

    Note that you can perform step 4 and 5 in a single request by passing all the fields info in the initial POST.

Table Of Contents