码迷,mamicode.com
首页 > Web开发 > 详细

asp.net 后台获取flv视频地址进行播放

时间:2014-07-22 22:55:52      阅读:314      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   os   文件   

源码下载: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

asp.net 后台获取flv视频地址进行播放,布布扣,bubuko.com

asp.net 后台获取flv视频地址进行播放

标签:style   blog   http   color   os   文件   

原文地址:http://www.cnblogs.com/smile-wei/p/3848911.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!