为什么YouTube视频内容没有填充?

时间:2010-10-04 19:16:17

标签: jquery flash youtube-api

我正在尝试在fancybox弹出窗口中播放YouTube视频。弹出窗口出现正常,但视频无法播放。 Firebug表示所有必要的元素都在加载,但没有视频。

this page上,一切正常。

this page上弹出窗口,但没有视频。

这是html:

<div id="play-btn">
   <a class="play-video" href="#flashArea1">Play Video</a>
</div>
<div style="display:none">
<div id="flashArea1" class="flashArea1" style="height:376;"><p>This content requires the Adobe Flash Player.<br /><a href="http://www.adobe.com/go/getflashplayer">
<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /><br />Get Flash</a></p>
</div>

<script type="text/javascript">
var mainswf = new SWFObject("youtube_player_standalone.swf", "main", "600", "250", "9", "#000000");
mainswf.addParam("scale", "noscale");
mainswf.addParam("wmode", "window");
mainswf.addParam("allowFullScreen", "true");
mainswf.addVariable("youtube_id", "_EC2tmFVNNE");
mainswf.addVariable("title", "Harry Potter and the Deathly Hallows");
mainswf.addVariable("controls_always_on", "false");
mainswf.addVariable("controls_fade_out_time", "5");
mainswf.addVariable("volume_cookie_on", "true");
mainswf.write("flashArea1");
</script>
</div><!-- end flash -->

这是弹出框的jQuery:

<script type="text/javascript">
$(document).ready(function() {
$("a.play-video").fancybox({
'hideOnContentClick': false
});
});
</script>

我将不胜感激。感谢。

1 个答案:

答案 0 :(得分:0)

尝试验证您的页面也因为某些原因您在源代码中显示了PHP代码我会先解决这些问题,然后可能会显示您的youtube

你的html中有两个相同swf代码的实例尝试推销其中一个

<div style="display:none">
<div id="flashArea3" class="flashArea3" style="height:376;"><p>This content requires the Adobe Flash Player.<br /><a href="http://www.adobe.com/go/getflashplayer">
                        <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /><br />Get Flash</a></p>

    </div>

  <script type="text/javascript">
    var mainswf = new SWFObject("youtube_player_standalone.swf", "main", "600", "250", "9", "#000000");
    mainswf.addParam("scale", "noscale");
    mainswf.addParam("wmode", "window");
    mainswf.addParam("allowFullScreen", "true");
    mainswf.addVariable("youtube_id", "_EC2tmFVNNE");
    mainswf.addVariable("title", "Harry Potter and the Deathly Hallows");
    mainswf.addVariable("controls_always_on", "false");
    mainswf.addVariable("controls_fade_out_time", "5");
    mainswf.addVariable("volume_cookie_on", "true");
    mainswf.write("flashArea3");
  </script>