0
我目前正在开发一个项目,我需要显示一个以静音模式自动启动的Dailymotion视频。根据文档 - http://www.dailymotion.com/doc/api/sdk-javascript.html - DM.player能够操纵视频的音量(方法:setMuted(静音))。然而,在我的代码发生很多变化之后,我无法弄清楚它是如何工作的。 你以前做过这个吗?你能提供一些帮助吗?Dailymotion视频自动播放和静音
感谢
这里是我的代码:
<html>
<head>
<script src="http://api.dmcdn.net/all.js"></script>
</head>
<body>
<div id="myPlayer"></div>
<script>
// 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("myPlayer", {video: "xz0ytt", width: "480", height: "270"});
// 4. We can attach some events on the player (using standard DOM events)
player.addEventListener("apiready", function(e) {
// alert(e.target.muted);
// e.target.muted = true;
// alert(e.target.muted);
// e.target.play();
// player.setMuted(1);
player.setMuted("1");
e.target.play();
});
};
</script>
</body>
</html>
你好,谢谢你。你的脚本工作得很好,但正如你所说的,它没有在静音模式下设置第一个广告。但是它会将下一个广告设置为静音。 – dacowa