【问题标题】:How can i insert my syndication key in dailymotion video using javascript sdk?如何使用 javascript sdk 在dailymotion 视频中插入我的联合密钥?
【发布时间】:2021-02-24 07:10:39
【问题描述】:

我刚刚申请了 Dailymotion 发布者网络。我有一个网站,我使用这个 javascript 播放所有 Dailymotion 视频。

<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");

});
};

根据 Dailymotion Publisher,我必须将联合参数插入 iframe src。我怎样才能通过使用 javascript sdk 来实现这一点? 谢谢

【问题讨论】:

    标签: javascript syndication dailymotion-api


    【解决方案1】:

    您必须将您的联合密钥作为播放器的参数传递(查询字符串参数syndication=&lt;YOUR_KEY&gt;)。这已添加到文档 https://developer.dailymotion.com/player/#player-parameters-iframe

    如果你想使用sdk,你也可以传递这个参数,这在https://developer.dailymotion.com/player/#player-parameters-sdk-js都有描述

    例如:

     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'
        } 
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-04-09
      • 1970-01-01
      • 2012-09-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-06-10
      • 1970-01-01
      相关资源
      最近更新 更多