在HTML页面中的flvplayer.swf只能播放某一视频,如下
----------------------------------------------------
<html>
<body>
<object type="application/x-shockwave-flash" width="400" height="220"
wmode="transparent data="flvplayer.swf?file=a.flv">
<param name="movie" value="flvplayer.swf?file=a.flv" />
<param name="wmode" value="transparent" />
</object>
</body>
<html>
------------------------------------------------------------------
如何用JS控制,使其能播放用户选择的视频文件
1、在页面中设置一空白DIV作为视频播放区域
<div id="flvPlayDiv"></div><!--视频播放的div区域 -->
2、编写JS视频播放函数,该函数是动态生成HMTL播放代码嵌入DIV
function PlayFlv(filename) {
var videoname = filename; //视频文件名
var floder = "video"; //存放Flash视频的文件夹,注意是相对flvplayer.swf文件的位置(images/flvplayer.swf)
var div = document.getElementById("flvPlayDiv");
div.innerHTML = "<img src='images/wait.gif' alt=''>"; //增加等待图片已增加用户体验;
div.style.display = "none";
var result = "<table align='center'><tr><td align='center'><object type='application/x-shockwave-flash' width='640px' height='480px' ";
result += "data='flvplayer.swf?file=" + floder + "/" + filename + "'>";
result += "<param name='movie' value='images/flvplayer.swf?file=" + floder + "/" + filename + "&showfsbutton=true&autostart=true' />";
result += "<param name='wmode' value='transparent' />";
result += "<param name='quality' value='high' />";
result += "<param name='allowfullscreen' value='true' />";
result += "<param name='autostart' value='true' />";
result += "</object></td></tr></table> ";
div.innerHTML = result;
div.style.display = "inline"; //div显示方式
}