如何使用javascript sdk在dailymotion视频中插入我的联合密钥?

时间:2014-10-12 11:36:31

标签: javascript syndication dailymotion-api

我刚刚申请了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实现这一目标? 感谢

1 个答案:

答案 0 :(得分:1)

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

如果你想使用sdk,你也可以传递这个参数,这在http://developer.dailymotion.com/documentation#sdk-javascript-player-api

中有所描述。

例如:

var player = DM.player("player", {video: "x27rzcj_", width: "728", height: "410", params: { syndication: <SYNDICATION_KEY> }});