zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    hibernate的缓存机制
    [poj 3159]Candies[差分约束详解][朴素的考虑法]
    POJ 2773 Happy 2006
    给定一个循环链表,实现一个算法返回这个环的开始结点
    使用jQuery创建模态窗口登陆效果
    实战数据结构(3)_两个单链表间的合并操作
    sql的强大功能(看一条sql解决的复杂业务)
    uva 10905 Children's Game (排序)
    JFinal学习 & Gradle配置续 & Tomcat配置
    Gradle项目学习 & HttpAsyncClient学习 & CountDownLatch学习
  • 原文地址:https://www.cnblogs.com/fx2008/p/4224642.html
Copyright © 2011-2022 走看看