編輯我想通了,第一個問題(不加載在所有),所以我把那部分了我有一個FlashPlayer,我這樣做:
<div id="video_content"><div id="flash_wrapper">
<object classid="MyID" width="402" height="285" id="videoplayer" align="middle">
<param name="movie" value="videoplayer.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#000000" />
<param name="play" value="true" />
<param name="loop" value="true" />
<param name="wmode" value="window" />
<param name="scale" value="showall" />
<param name="menu" value="true" />
<param name="devicefont" value="false" />
<param name="salign" value="" />
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="true" />
<param name="FlashVars" value="screencast_url=myVideo.flv" id="flash" />
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="videoplayer.swf" width="402" height="285">
<param name="movie" value="videoplayer.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#000000" />
<param name="play" value="true" />
<param name="loop" value="true" />
<param name="wmode" value="window" />
<param name="scale" value="showall" />
<param name="menu" value="true" />
<param name="devicefont" value="false" />
<param name="salign" value="" />
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="true" />
<param name="FlashVars" value="screencast_url=myVideo.flv" id="flash" />
<!--<![endif]-->
<a href="http://www.adobe.com/go/getflash">
<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />
</a>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
</div>
我有我想用來改變視頻播放的按鈕。 js的方法來改變視頻看起來是這樣的:
function ChangeVideo(videoIndex) {
//Video Location String
var vidLocation = "screencast_url=";
//Determines what video to load
switch (videoIndex) {
case 1:
//Change Video Location
vidLocation += "myVideo.flv";
break;
case 2:
//Change Video Location
vidLocation += "myVideo2.flv";
break;
case 3:
//Change Video Location
vidLocation += "myVideo3.flv";
break;
case 4:
//Change Video Location
vidLocation += "myVideo4.flv";
break;
}
//Change value of flashplayer FlashVar
$('#flash').val(vidLocation);
}
視頻看起來正確加載,並且所有的信息似乎是正確的,但視頻不會玩的時候我打的播放按鈕(在播放當前視頻)。
如何在加載後將其他視頻加載到Flash播放器中?
EDIT2如果我試試這個:
//Creates empty values
var flashvars = vidLocation;
var params = {};
var attributes = {};
//Change video
swfobject.embedSWF("videoplayer.swf", "video_content", "300", "120", "9.0.0", "expressInstall.swf", flashvars, params, attributes);
相反的:
//Change value of flashplayer FlashVar
$('#flash').val(vidLocation);
這似乎現在重新加載播放器,但它仍然不能播放。
我看到的一個問題是您將「flash」定義爲多個節點的ID。不知道這是否是問題的原因,但可能值得研究。也可能想嘗試$('#flash')。attr('value',vidLocation);並看看它是否有所作爲。 – 2011-05-17 18:50:12
我試過,並沒有工作。我認爲我需要做更多的閱讀,才能完成這一工作 – 2011-05-17 19:25:07