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";
if (Exts.IndexOf("isExt") >= -1)
{
switch (isExt)
{
case "avi":
case "wmv":
case "asf":
case "mov":
this.Response.Write("<EMBED id=MediaPlayer src=" + strUrl + " width=" + strWidth + " height=" + StrHeight + " loop=false autostart=true ></EMBED>");
break;
case "rm":
case "ra":
case "ram":
Response.Write("<OBJECT height=" + StrHeight + " width=" + strWidth + " classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA>");
Response.Write("<PARAM NAME=_ExtentX VALUE=12700>");
Response.Write("<PARAM NAME=_ExtentY VALUE=9525>");
Response.Write("<PARAM NAME=AUTOSTART VALUE=-1>");
Response.Write("<PARAM NAME=SHUFFLE VALUE=0>");
Response.Write("<PARAM NAME=PREFETCH VALUE=0>");
Response.Write("<PARAM NAME=NOLABELS VALUE=0>");
Response.Write("<PARAM NAME=SRC VALUE=" + strUrl + ">");
Response.Write("<PARAM NAME=CONTROLS VALUE=ImageWindow>");
Response.Write("<PARAM NAME=CONSOLE VALUE=Clip>");
Response.Write("<PARAM NAME=LOOP VALUE=0>");
Response.Write("<PARAM NAME=NUMLOOP VALUE=0>");
Response.Write("<PARAM NAME=CENTER VALUE=0>");
Response.Write("<PARAM NAME=MAINTAINASPECT VALUE=0>");
Response.Write("<PARAM NAME=BACKGROUNDCOLOR VALUE=#000000>");
Response.Write("</OBJECT>");
Response.Write("<BR>");
Response.Write("<OBJECT height=32 width=" + strWidth + " classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA>");
Response.Write("<PARAM NAME=_ExtentX VALUE=12700>");
Response.Write("<PARAM NAME=_ExtentY VALUE=847>");
Response.Write("<PARAM NAME=AUTOSTART VALUE=0>");
Response.Write("<PARAM NAME=SHUFFLE VALUE=0>");
Response.Write("<PARAM NAME=PREFETCH VALUE=0>");
Response.Write("<PARAM NAME=NOLABELS VALUE=0>");
Response.Write("<PARAM NAME=CONTROLS VALUE=ControlPanel,StatusBar>");
Response.Write("<PARAM NAME=CONSOLE VALUE=Clip>");
Response.Write("<PARAM NAME=LOOP VALUE=0>");
Response.Write("<PARAM NAME=NUMLOOP VALUE=0>");
Response.Write("<PARAM NAME=CENTER VALUE=0>");
Response.Write("<PARAM NAME=MAINTAINASPECT VALUE=0>");
Response.Write("<PARAM NAME=BACKGROUNDCOLOR VALUE=#000000>");
Response.Write("</OBJECT>");
break;
}
}
else
{
this.Response.Write("非法視頻文件");
}
本文介绍了一段用于判断视频文件格式并根据不同格式输出相应播放代码的C#程序。该程序首先从URL中提取文件扩展名,然后根据扩展名确定视频类型,并针对不同类型的视频文件(如AVI、WMV、RM等)输出特定的HTML代码以实现网页内嵌播放。

被折叠的 条评论
为什么被折叠?



