高手进来来改代码了,ASP.NET嵌入的FLV播放器不能播放FLV文件
private string GetVideo(string sql){
string Video = "";
try
{
DataRow dr = new DataBase().GetDataTable(sql).Rows[0];
Video = dr["Url"].ToString().Trim().Trim();
string temp = "";
string[] xxx = Video.Trim().Split('.');
if (xxx[xxx.Length - 1].ToString().ToUpper() == "FLV")
{
temp += "<!--Video strat-->\r\n";
temp += "<script type=\"text/javascript\">\r\n";
temp += "var swf_width=328\r\n";
temp += "var swf_height=284\r\n";
temp += "var texts='FLV&vcastr_title=FLV&BarColor=0xFF6600&BarPosition=1'\r\n";
temp += "var files='" + Video.Trim() + "'\r\n";
temp += "document.write('<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\"');\r\n";
temp += "document.write(' codebase=\" http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab');\r\n";
temp += "document.write('#version=6,0,0,0\" width=\"'+ swf_width +'\" height=\"'+ swf_height +'\">');\r\n";
temp += "document.write('<param name=\"movie\" value=\"images/flv.swf\"><param name=\"quality\" value=\"high\">');\r\n";
temp += "document.write('<param name=\"menu\" value=\"false\"><param name=\"allowFullScreen\" value=\"true\" />');\r\n";
temp += "document.write('<param name=\"FlashVars\" value=\"vcastr_file='+files+'&vcastr_title='+texts+'\">');\r\n";
temp += "document.write('<embed src=\"images/flv.swf\" allowFullScreen=\"true\" FlashVars=\"vcastr_file='+files+'&vcastr_title='+texts);\r\n";
temp += "document.write('\" menu=\"false\" quality=\"high\" width=\"'+ swf_width +'\" height=\"'+ swf_height);\r\n";
temp += "document.write(' type=\"application/x-shockwave-flash\" pluginspage=\" http://www.macromedia.com/go/getflashplayer\" />'); \r\n";
temp += "document.write('</object>');\r\n";
temp += "</script> \r\n";
temp += "<!--Video end-->\r\n";
Video = temp;
}
else
{
if (Video.Length > 10)
Video = "<embed id=\"5970\" src=\"" + Video + "\" width=\"270\" height=\"212\" autostart=\"true\"></embed>";
else
Video = "";
}
}
catch { }
return Video;
}
调试代码:
<!--Video strat-->
<script type="text/javascript">
var swf_width=328
var swf_height=284
var texts='FLV&vcastr_title=FLV&BarColor=0xFF6600&BarPosition=1'
var files='UploadFile/2011-3/201137104733781781.flv'
document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"');
document.write(' codebase=" http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab');
document.write('#version=6,0,0,0" width="'+ swf_width +'" height="'+ swf_height +'">');
document.write('<param name="movie" value="images/flv.swf"><param name="quality" value="high">');
document.write('<param name="menu" value="false"><param name="allowFullScreen" value="true" />');
document.write('<param name="FlashVars" value="vcastr_file='+files+'&vcastr_title='+texts+'">');
document.write('<embed src="images/flv.swf" allowFullScreen="true" FlashVars="vcastr_file='+files+'&vcastr_title='+texts);
document.write('" menu="false" quality="high" width="'+ swf_width +'" height="'+ swf_height);
document.write(' type="application/x-shockwave-flash" pluginspage=" http://www.macromedia.com/go/getflashplayer" />');
好人一生平安 应该是绝对路径问题 我的问题是不知道怎么改来能播放 求指教
--------------------编程问答-------------------- 我来也。
插件没有安装吧。 --------------------编程问答-------------------- 试了几台电脑 都装了插件了 就是点击没反应 --------------------编程问答-------------------- 你为代码又多又杂,不过肯定一点,就是路子不对,可能这样也行,但没可能这么多代码。
FLV播放器就是放进一下相对地址问题,还有一个问题就是要在IIS配置,配置FIV格式问题,IIS6.0之后,如果没配置相应格式,是没办法识别的。 --------------------编程问答-------------------- 嵌入就行了
<object classid= "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 " codebase= "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0 " width= "320 " height= "240 ">
<param name= "movie " value= "flvplayer.swf?playlist_xml_url=http://www.testweb.cn/114sp/playlist.xml ">
<param name= "quality " value= "high ">
<embed src=“flvplayer.swf?playlist_xml_url=http://www.testweb.cn/114sp /playlist.xml " quality= "high " pluginspage= "http://www.macromedia.com/go/getflashplayer " type= "application/x-shockwave-flash " width= "320 " height= "240 "> </embed>
</object>
动态改变视频 --------------------编程问答-------------------- 这怎么嵌入?视频列表传值过来的,代码可能多一点。但是调试代码摆在那里,我觉得就是路径的问题吧,不想用XML 我就想用我这个方法实现,难道这个方法有问题?在线求指教....... --------------------编程问答-------------------- 问题是嵌入后带值的路径问题
补充:.NET技术 , ASP.NET