javascriptsyndicationdailymotion-api

How can i insert my syndication key in dailymotion video using javascript sdk?


I just applied for Dailymotion publisher network. I have an website and i play all the Dailymotion videos using this javascript.

<script>
// This code loads the Dailymotion Javascript SDK asynchronously.
(function() {
    var e = document.createElement('script'); e.async = true;
    e.src = document.location.protocol + '//api.dmcdn.net/all.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(e, s);
}());

// This function init the player once the SDK is loaded
window.dmAsyncInit = function()
{
    // PARAMS is a javascript object containing parameters to pass to the player if any (eg: {autoplay: 1})
    var player = DM.player("player", {video: "x27rzcj_", width: "728", height: "410", autoplay: 1});

    // 4. We can attach some events on the player (using standard DOM events)
    player.addEventListener("ended", function(e)
{
    document.getElementById('player').style.display = 'none';

    $("#videorol").fadeIn("fast");

});
};

According to Dailymotion Publisher i have to insert the syndication parameter to the iframe src. How can i achieve this by using the javascript sdk ? Thanks


Solution

  • You have to pass your syndication key as a parameter of the player (query string parameter syndication=<YOUR_KEY>). This was added to the documentation https://developer.dailymotion.com/player/#player-parameters-iframe

    If you want to use the sdk, you can pass this parameter as well, this is all described at https://developer.dailymotion.com/player/#player-parameters-sdk-js

    for example:

     var player = DM.player(document.getElementById("player"),{ 
        video: "x7tgad0",
        width: "100%",
        height: "100%",
      referrerPolicy: "no-referrer-when-downgrade",
        params: {
            'syndication': YOUR_SYNDICATION_KEY,
            'ads_params' : 'YOUR_ADS_PARAMS',
            'ui-logo': 'false'
        } 
    });