asp.net 后台获取flv视频地址进行播放
源码下载:http://download.csdn.net/detail/njxiaogui/7609687
前台:.aspx
<table> <tr> <td><div id="video_content" runat="server" style=""></div> </td> </tr> </table>
后台 .cs (通过后台获取flv的地址,进行视频播放)
protected void Page_Load(object sender, EventArgs e) { this.video_content.InnerHtml = Play("sp.flv", 472, 385); } public static string Play(string url, int width, int height) { string strTmp = url.ToLower(); if (strTmp.EndsWith(".flv")) { return flv(url, width, height); } else { return "视频文件数据错误"; } } private static string flv(string url, int width, int height) { System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append("<object codeBase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,22,87\" "); sb.Append("classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" "); sb.Append(" height=\"" + height + "\" width=\"" + width + "\" >"); sb.Append("<param name=\"FlashVars\" value=\"vcastr_file=" + url + "&LogoText=www.um173.com&BufferTime=3\">"); sb.Append("<param name=\"Movie\" value=\"Flvplayer.swf\">"); sb.Append("<param name=\"allowFullScreen\" value=\"true\">"); sb.Append("<param name=\"WMode\" value=\"Window\">"); sb.Append("<param name=\"Play\" value=\"1\">"); sb.Append("<param name=\"Loop\" value=\"-1\">"); sb.Append("<param name=\"Quality\" value=\"High\">"); sb.Append("<param name=\"SAlign\" value=\"\">"); sb.Append("<param name=\"Menu\" value=\"0\">"); sb.Append("<param name=\"Base\" value=\"\">"); sb.Append("<param name=\"AllowScriptAccess\" value=\"always\">"); sb.Append("<param name=\"Scale\" value=\"ShowAll\">"); sb.Append("<param name=\"DeviceFont\" value=\"0\">"); sb.Append("<param name=\"EmbedMovie\" value=\"0\">"); sb.Append("<param name=\"BGColor\" value=\"\">"); sb.Append("<param name=\"SWRemote\" value=\"\">"); sb.Append("<param name=\"MovieData\" value=\"\">"); sb.Append("<param name=\"SeamlessTabbing\" value=\"1\">"); sb.Append("<param name=\"Profile\" value=\"0\">"); sb.Append("<param name=\"ProfileAddress\" value=\"\">"); sb.Append("<param name=\"ProfilePort\" value=\"0\">"); sb.Append("<embed src=\"FLVPlayer_Progressive.swf\" flashvars=\"vcastr_file=" + url + "&LogoText=www.um173.com\" height=\"" + height + "\" width=\"" + width + "\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" menu=\"false\">"); sb.Append("</embed>"); sb.Append("</object>"); return sb.ToString(); }
需要支持的flv 视频播放插件为:Flvplayer.swf,FLVPlayer_Progressive.swf
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。