Create a Player
Introduction
The Dailymotion Player is customizable, consistent across all devices, delivered with Picture-in-Picture, extensive analytics and the necessary advertising infrastructure out of the box.
Each Player is identified with a unique ID that carries every element you need to make embeds easy and efficient:
- Configuration with a set of parameters you defined via the API or your Dailymotion Studio
- Analytics to monitor your embeds’ performance
- Tracking to ensure accurate monetization ad targeting and ad revenue attribution
Your Player IDs are the central pieces for each of your embeds. In this article, we’ll guide you to create your own custom Player via the API so you can start your journey with Dailymotion in the best conditions.
If you prefer using the Dailymotion Studio rather than the API, please follow the dedicated guide.
Create your Player
To create a Player through the Platform API, you need to have the manage_players
scope. Please refer to the authentication guide to see how to authenticate with specific scopes.
Then, define and specify the required fields and perform a POST
request. Once a Player has been created and associated with your account, it is possible to update or delete it. Please refer to the exhaustive list of Player fields to customize it.
Example of Player creation
curl -X POST -H 'Authorization: Bearer ${ACCESS_TOKEN}' \
-d 'label=My new player' \
'https://api.dailymotion.com/user/<YOUR_CHANNEL_ID>/players'
Next step: Embed your Player
Players can be embedded on web and native environments. See below an overview of the different embed methods available.
Embed on web
Our Web SDK provides you with different integration methods to embed content on web with your custom Player. You only need to add your Player to your page using a generated script embed or iFrame. The script URL of your Player can be retrieved with the Platform API using the below fields, depending on which embed method you want to use.
To know which of the embed methods best suits your needs, please refer to the description of each integration methods.
Embed type | Data API field | Description |
---|---|---|
Embed script URL | embed_script_url | Retrieve the URL of the Player Embed Script. Add this URL in a script HTML tag. This will load the Player exactly where it is added in the HTML page. This method also provides access to the Player API. |
Library script URL | lib_script_url | Retrieve the URL of the Player Library Script. Add this URL in a script HTML tag to load your library, and create a Player programatically using the Player API. |
Embed HTML URL | embed_html_url | Retrieve the URL of the iFrame Player. Add this URL in an iFrame HTML tag. This embed method isn’t using JavaScript, advanced functionalities such as PiP or firstTimeView will not be available. |
You can test and learn more about the Platform API with our API Explorer.
Embed on native
You can embed your custom Player on native environments using our dedicated SDKs.
Android SDK | Pass in your Player ID when creating a PlayerView in your Android app. Check the Android SDK getting started guide to learn how to embed with our SDK. |
iOS SDK | Pass in your Player ID when creating a PlayerView in your iOS app. Check the iOS SDK getting started guide to learn how to embed with our SDK. |