using System;
namespace webcam
{
public partial class WebForm2 : System.Web.UI.Page
{
public string DvUrl;
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
string DvUrlS = Request.QueryString["FilePath"].ToString();
DvUrl += "CamFiles/" + DvUrlS;
SelPlay(DvUrl, 380, 320);
}
}
protected void SelPlay(string strUrl, int strWidth, int StrHeight)
{
string isExt;
if (strUrl != "")
{
int i = strUrl.LastIndexOf(".");
isExt = strUrl.Substring(i + 1, strUrl.Length - i - 1);
}
else
{
Response.Write("<script>alert('所选择的影音文件不存在!');</script>");
return;
}
isExt = isExt.ToLower();
switch (isExt)
{
case "avi":
case "wmv":
case "asf":
case "mov":
Response.Write("<EMBED id=MediaPlayer src='" + strUrl + "' width='" + strWidth + "' height='" + StrHeight + "' loop='false' autostart='true'></EMBED>");
break;
case "rm":
case "ra":
case "rmvb":
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;
case "swf":
case "flv":
Response.Write("<OBJECT codeBase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' width='"+strWidth+"' height='"+StrHeight+"'> ");
Response.Write("<PARAM NAME='movie' VALUE='" + strUrl + "'> ");
Response.Write("<PARAM NAME='play' VALUE='false'> ");
Response.Write("<PARAM NAME='quality' VALUE='high'> ");
Response.Write("<embed src='" + strUrl + "' quality='high' pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width='"+strWidth+"' height='"+StrHeight+"'></embed> ");
Response.Write("</OBJECT> ");
break;
case "mpg":
Response.Write("<object classid='clsid:05589FA1-C356-11CE-BF01-00AA0055595A' id='ActiveMovie1' width='" + strWidth + "' height='" + StrHeight + "'>");
Response.Write("<param name='Appearance' value='0'>");
Response.Write("<param name='AutoStart' value='-1'>");
Response.Write("<param name='AllowChangeDisplayMode' value='-1'>");
Response.Write("<param name='AllowHideDisplay' value='0'>");
Response.Write("<param name='AllowHideControls' value='-1'>");
Response.Write("<param name='AutoRewind' value='-1'>");
Response.Write("<param name='Balance' value='0'>");
Response.Write("<param name='CurrentPosition' value='0'>");
Response.Write("<param name='DisplayBackColor' value='0'>");
Response.Write("<param name='DisplayForeColor' value='16777215'>");
Response.Write("<param name='DisplayMode' value='0'>");
Response.Write("<param name='Enabled' value='-1'>");
Response.Write("<param name='EnableContextMenu' value='-1'>");
Response.Write("<param name='EnablePositionControls' value='-1'>");
Response.Write("<param name='EnableSelectionControls' value='0'>");
Response.Write("<param name='EnableTracker' value='-1'>");
Response.Write("<param name='Filename' value='" + strUrl + "' valuetype='ref'>");
Response.Write("<param name='FullScreenMode' value='0'>");
Response.Write("<param name='MovieWindowSize' value='0'>");
Response.Write("<param name='PlayCount' value='1'>");
Response.Write("<param name='Rate' value='1'>");
Response.Write("<param name='SelectionStart' value='-1'>");
Response.Write("<param name='SelectionEnd' value='-1'>");
Response.Write("<param name='ShowControls' value='-1'>");
Response.Write("<param name='ShowDisplay' value='-1'>");
Response.Write("<param name='ShowPositionControls' value='0'>");
Response.Write("<param name='ShowTracker' value='-1'>");
Response.Write("<param name='Volume' value='-480'>");
Response.Write("</object>");
break;
case "smi":
Response.Write("<OBJECT id=RVOCX classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA width='" + strWidth + "' height='" + StrHeight + "'>");
Response.Write("<param name='_ExtentX' value='6350'>");
Response.Write("<param name='_ExtentY' value='4763'>");
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='-1'>");
Response.Write("<param name='SRC' value='" + strUrl + "'>");
Response.Write("<param name='CONTROLS' value='ImageWindow'>");
Response.Write("<param name='CONSOLE' value='console1'>");
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("<embed src='" + strUrl + "' type='audio/x-pn-realaudio-plugin' console='Console1' controls='ImageWindow' height='" + StrHeight + "' width='" + strWidth + "' autostart='true'>");
Response.Write("</OBJECT>");
break;
}
}
}
}