zoukankan      html  css  js  c++  java
  • Asp.net网站如何播放Flv视频

    再有网友问及此问题。Insus.NET重新写个简单的例子,此次把Flv Object 代码写入cs类别中。在应用时,只new它即可。

    Flv objFlv = new Flv();
    objFlv.Player();

    你在这里就可以看到它:

    View Code
     public string Player()
            {
                
    string texts = string.Empty;
                
    string config = "1:自动播放|0:连续播放|100:默认音量|0:控制栏位置|2:控制栏显示|0x000033:主体颜色|60:主体透明度|0x66ff00:光晕颜色|0xffffff:图标颜色|0xffffff:文字颜色|:logo文字|:logo地址|:结束swf地址";
                
    string swffile = HttpContext.Current.Request.ApplicationPath + "/Flv/vcastr22.swf";

                
    return @"<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' width=" + _Width + " height=" + _Height + ">"
                 
    + @" <param name='movie' value=" + swffile + ">"
                 
    + @" <param name='quality' value='high'>"
                 
    + @" <param name='menu' value='false'>"
                 
    + @" <param name='wmode' value='opaque'>"
                 
    + @" <param name='allowFullScreen' value='true'>"
                 
    + @" <param name='FlashVars' value='vcastr_file=" + _File + "&vcastr_title=" + texts + "&vcastr_config=" + config + "'>"
                 
    + @" <embed src=" + swffile + " wmode='opaque' FlashVars='vcastr_file=" + _File + "&vcastr_title=" + texts + "&vcastr_config=" + config + "' menu='false' quality='high' width=" + _Width + " height=" + _Height + " type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"
                 
    + @" </object>";
            }


    把这个object写在cs类别中,会有网友问到,怎样把它放在网页指定的位置上呢。你可以在指定的位置拉上一个Literal控件。如:

    <asp:Literal ID="Literal1" runat="server"></asp:Literal>

    在aspx.cs处理不同的播放Flv文件,

    View Code
     protected void Page_Load(object sender, EventArgs e)
        {
            
    //这个你可以直接指定路径,当然可以接收从另外一页传过来的参数,再有一个就是从数据库取出来啦。
            string file =ResolveUrl("~/Flv/Wildlife_NEW.flv");

            Flv objFlv 
    = new Flv(800600, file);
            
    this.Literal1.Text = objFlv.Player();
        }

    完整代码,你可以从下面这个链接下载:

    http://download.cnblogs.com/insus/ASPDOTNET/InsusTutorials_Flv.rar

  • 相关阅读:
    python 报错:reduce failed to synchronize: device-side assert triggered
    pytorch 分割二分类的两种形式
    Leetcode 104. 二叉树的最大深度
    LeetCode 78. 子集
    python报错:1only batches of spatial targets supported (non-empty 3D tensors) but got targets of size
    PyTorch:The "freeze_support()" line can be omitted if the program is not going to be frozen
    pytorch创建tensor的四种方法
    Leetcode 四数之和
    C++的类和对象
    结构体
  • 原文地址:https://www.cnblogs.com/insus/p/2047360.html
Copyright © 2011-2022 走看看