首页 > 代码库 > asp.net 后台获取flv视频地址进行播放【转】
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=http://www.mamicode.com/"vcastr_file=" + url + "&LogoText=www.um173.com&BufferTime=3\">"); sb.Append("<param name=\"Movie\" value=http://www.mamicode.com/"Flvplayer.swf\">"); sb.Append("<param name=\"allowFullScreen\" value=http://www.mamicode.com/"true\">"); sb.Append("<param name=\"WMode\" value=http://www.mamicode.com/"Window\">"); sb.Append("<param name=\"Play\" value=http://www.mamicode.com/"1\">"); sb.Append("<param name=\"Loop\" value=http://www.mamicode.com/"-1\">"); sb.Append("<param name=\"Quality\" value=http://www.mamicode.com/"High\">"); sb.Append("<param name=\"SAlign\" value=http://www.mamicode.com/"\">"); sb.Append("<param name=\"Menu\" value=http://www.mamicode.com/"0\">"); sb.Append("<param name=\"Base\" value=http://www.mamicode.com/"\">"); sb.Append("<param name=\"AllowScriptAccess\" value=http://www.mamicode.com/"always\">"); sb.Append("<param name=\"Scale\" value=http://www.mamicode.com/"ShowAll\">"); sb.Append("<param name=\"DeviceFont\" value=http://www.mamicode.com/"0\">"); sb.Append("<param name=\"EmbedMovie\" value=http://www.mamicode.com/"0\">"); sb.Append("<param name=\"BGColor\" value=http://www.mamicode.com/"\">"); sb.Append("<param name=\"SWRemote\" value=http://www.mamicode.com/"\">"); sb.Append("<param name=\"MovieData\" value=http://www.mamicode.com/"\">"); sb.Append("<param name=\"SeamlessTabbing\" value=http://www.mamicode.com/"1\">"); sb.Append("<param name=\"Profile\" value=http://www.mamicode.com/"0\">"); sb.Append("<param name=\"ProfileAddress\" value=http://www.mamicode.com/"\">"); sb.Append("<param name=\"ProfilePort\" value=http://www.mamicode.com/"0\">"); sb.Append("<embed src=http://www.mamicode.com/"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
asp.net 后台获取flv视频地址进行播放【转】
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。