0

我有以下 Javascript 代码,但视频没有自动启动,为什么?

var params = { allowScriptAccess: "always" };
    var atts = { id: "myvideoplayer"};
    var flashvars = {autostart: true};

    swfobject.embedSWF(

        "http://www.youtube.com/v/MHRj8BYm240?enablejsapi=1&playerapiid=ytplayer&version=3", "ytplayer", "425", "365", "8", null, flashvars, params, atts);

    function onYouTubePlayerReady(playerId) {
    ytplayer = document.getElementById("myvideoplayer");
    //ytplayer.playVideo();
}

好的,也许我应该在 YouTube 播放器准备好后立即使用,playVideo()但是其他 flashvars怎么样?displayclickclick

4

1 回答 1

0

将 &autoplay=1 添加到视频 URL,它应该可以工作

于 2013-04-08T18:51:57.437 回答