zoukankan      html  css  js  c++  java
  • 播放视频(nly)

    /// <summary>

            /// 视频播放器(支持avi,wmv,asf,mov,rm,ra,ram),前台使用<%=SelPlay(strUrl, strWidth, StrHeight) %>

            /// </summary>

            /// <param name="strUrl">视频文件路径</param>

            /// <param name="strWidth">播放器显示宽度</param>

            /// <param name="StrHeight">播放器显示高度</param>

            /// <returns>播放器内容</returns>

            public static string SelPlay(string strUrl, int strWidth, int StrHeight)

            {

                // 播放器内容

                string html = "";

     

                string Exts = string.Empty;

                string isExt = string.Empty;

     

                if (strUrl != "")

                {

                    isExt = strUrl.Substring(strUrl.LastIndexOf('.') + 1).ToLower();

                }

                else

                {

                    isExt = "";

                }

     

                Exts = "avi,wmv,asf,mov,rm,ra,ram,mp3";

     

                if (Exts.IndexOf("isExt") >= -1)

                {

                    switch (isExt)

                    {

                        case "avi":

                        case "wmv":

                        case "asf":

                        case "mov":

                            html += "<EMBED id=MediaPlayer type='audio/x-pn-realaudio-plugin' src=" + strUrl + " width=" + strWidth + " height=" + StrHeight + " loop=false autostart=true ></EMBED>";

                            break;

                        case "mp3"://没有成功

                            html += "<EMBED id=MediaPlayer src=" + strUrl + " soundFile="+strUrl+" width=" + strWidth + " height=" + StrHeight + " loop=false autostart=true ></EMBED>";

                            break;

                        case "rm":

                        case "ra":

                        case "ram":

                        case "rmvb":

                            html += "<OBJECT height=" + StrHeight + " width=" + strWidth + " classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA>";

                            html += "<PARAM NAME=_ExtentX VALUE=12700>";

                            html += "<PARAM NAME=_ExtentY VALUE=9525>";

                            html += "<PARAM NAME=AUTOSTART VALUE=-1>";

                            html += "<PARAM NAME=SHUFFLE VALUE=0>";

                            html += "<PARAM NAME=PREFETCH VALUE=0>";

                            html += "<PARAM NAME=NOLABELS VALUE=0>";

                            html += "<PARAM NAME=SRC VALUE=" + strUrl + ">";

                            html += "<PARAM NAME=CONTROLS VALUE=ImageWindow>";

                            html += "<PARAM NAME=CONSOLE VALUE=Clip>";

                            html += "<PARAM NAME=LOOP VALUE=0>";

                            html += "<PARAM NAME=NUMLOOP VALUE=0>";

                            html += "<PARAM NAME=CENTER VALUE=0>";

                            html += "<PARAM NAME=MAINTAINASPECT VALUE=0>";

                            html += "<PARAM NAME=BACKGROUNDCOLOR VALUE=#000000>";

                            html += "</OBJECT>";

                            html += "<BR>";

                            html += "<OBJECT height=50 width=" + strWidth + " classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA>";

                            html += "<PARAM NAME=_ExtentX VALUE=12700>";

                            html += "<PARAM NAME=_ExtentY VALUE=847>";

                            html += "<PARAM NAME=AUTOSTART VALUE=0>";

                            html += "<PARAM NAME=SHUFFLE VALUE=0>";

                            html += "<PARAM NAME=PREFETCH VALUE=0>";

                            html += "<PARAM NAME=NOLABELS VALUE=0>";

                            html += "<PARAM NAME=CONTROLS VALUE=ControlPanel,StatusBar>";

                            html += "<PARAM NAME=CONSOLE VALUE=Clip>";

                            html += "<PARAM NAME=LOOP VALUE=0>";

                            html += "<PARAM NAME=NUMLOOP VALUE=0>";

                            html += "<PARAM NAME=CENTER VALUE=0>";

                            html += "<PARAM NAME=MAINTAINASPECT VALUE=0>";

                            html += "<PARAM NAME=BACKGROUNDCOLOR VALUE=#000000>";

                            html += "</OBJECT>";

                            break;

                    }

                }

                else

                {

                    html += "非法视频文件";

                }

     

                return html;

            }

  • 相关阅读:
    ScrollView反弹效果的实现
    Unity 3D本地公布WebPlayer版时&quot;Failed to download data file&quot;解决方式
    win7休眠的开启与关闭方法命令行操作和图文结合的鼠标操作
    使用Javascript D3创建属于你的涂鸦作品
    android获取自己定义控件位置坐标,屏幕尺寸,标题栏,状态栏高度
    [Python]Use Flask-Admin with PostgreSQL
    [LeetCode] Best Time to Buy and Sell Stock
    spring实战五之Bean的自动检测
    FireBug使用总结
    javascript的window.onload()方法和jQuery的$(document).ready()的对比
  • 原文地址:https://www.cnblogs.com/nanxiaoxiang/p/2703605.html
Copyright © 2011-2022 走看看