Dailymotion api Dailymotion iframe api

Dailymotion api Dailymotion iframe api,dailymotion-api,Dailymotion Api,我正在使用dailymotion api播放视频。示例直接来自文档: 它在控制台中给了我错误: <!-- This <div> tag will be replaced the <iframe> video player --> <div id="player"></div> <script> // This code loads the Dailymotion Javascript SDK asynchronously

我正在使用dailymotion api播放视频。示例直接来自文档:

它在控制台中给了我错误:

<!-- This <div> tag will be replaced the <iframe> video player -->
<div id="player"></div>

<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: "x1bpnpt", width: "640", height: "360", params: {autoplay: 1}});

    // 4. We can attach some events on the player (using standard DOM events)
    player.addEventListener("apiready", function(e)
    {
        e.target.play();
    });
};
</script>

//此代码异步加载Dailymotion Javascript SDK。
(功能(){
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);
}());
//加载SDK后,此函数将初始化播放器
window.dmasyninit=函数()
{
//PARAMS是一个javascript对象,包含要传递给播放器的参数(如有)(例如:{autoplay:1})
var player=DM.player(“player”,视频:“x1bpnpt”,宽度:“640”,高度:“360”,参数:{autoplay:1});
//4.我们可以在播放器上附加一些事件(使用标准DOM事件)
player.addEventListener(“apiready”),函数(e)
{
e、 target.play();
});
};

但是,如果我将其直接嵌入iframe中,它就会工作(它也会显示一些错误,但不会显示上面的错误):



怎么了?

我正在查看,js文件没有正确加载,请查看
e.src=document.location.protocol+'//api.dmcdn.net/all.js'

document.location.protocol
//api.dmcdn.net/all.js前面加上前缀域


所以请看一下,让我知道。

经过几次研究,我发现了导致这个问题的原因

他们正在使用的视频作为例子,从第三方广告集团获得报告,并需要向其报告视频的每一步

上传你自己的视频,并使用你从中获得的id,你会发现你不会有控制台错误


希望这对您有所帮助。

您好,您能添加两种情况下的错误吗?这可能有助于人们理解。另外,您是在移动设备上还是在桌面上进行测试?当我测试您发送的两个JSFIDLE链接时,一切似乎都正常(在第一种情况下,我也看到控制台中的错误,但似乎不会影响视频播放)。您使用的是哪种浏览器?
<iframe src="http://www.dailymotion.com/embed/video/x1bpnpt?api=true&autoplay=1" width="640" height="360" frameborder="0"></iframe>