62,074
社区成员
发帖
与我相关
我的任务
分享
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
//this.Response.Write("<script>alert('aaaa!!');</script>");
string path = "flash/love.rm";
this.lblFlash.Text = GetPlayHtml(path, "188", "130");
}
}
/// <summary>
/// 生成视频播放器的HTML源码
/// </summary>
/// <remarks>
/// 调用方法<div><%=playHtml %></div>
/// </remarks>
/// <param name="strUrl">视频存放路径</param>
/// <param name="strWidth">播放器宽度</param>
/// <param name="strHeight">播放器高度</param>
/// <returns></returns>
public static string GetPlayHtml(string strUrl, string strWidth, string strHeight)
{
string resultHtml = "";
if (strUrl != "")
{
string Exts = "avi,wmv,asf,mov,rm,ra,ram";
string isExt = "";
if (strUrl != "")
{
isExt = strUrl.Substring(strUrl.LastIndexOf(".") + 1);//获取后缀名
}
if (!Exts.Contains(isExt))
{
resultHtml = "非法视频文件";
}
else
{
switch (isExt)
{
case "avi":
case "wmv":
case "asf":
case "mov":
resultHtml += "<EMBED id=MediaPlayer src=" + "\"" + strUrl + "\"" + " width=" + strWidth + " height=" + strHeight + " loop='false' autostart='true'></EMBED>";
break;
//case "mov":
case "rm":
case "ra":
case "ram":
resultHtml += "<OBJECT height=" + strHeight + " width=" + strWidth + " classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA>";
break;
}
resultHtml += "<PARAM NAME='_ExtentX' VALUE='12700'>";
resultHtml += "<PARAM NAME='_ExtentY' VALUE='9525'>";
resultHtml += "<PARAM NAME='AUTOSTART' VALUE='-1'>";//VALUE='-1'
resultHtml += "<PARAM NAME='SHUFFLE' VALUE='0'>";
resultHtml += "<PARAM NAME='PREFETCH' VALUE='0'>";
resultHtml += "<PARAM NAME='NOLABELS' VALUE='0'>";
resultHtml += "<PARAM NAME='SRC' VALUE='" + strUrl + "'>";
resultHtml += "<PARAM NAME='CONTROLS' VALUE='ImageWindow'>";
resultHtml += "<PARAM NAME='CONSOLE' VALUE='Clip'>";
resultHtml += "<PARAM NAME='LOOP' VALUE='0'>";
resultHtml += "<PARAM NAME='NUMLOOP' VALUE='0'>";
resultHtml += "<PARAM NAME='CENTER' VALUE='0'>";
resultHtml += "<PARAM NAME='MAINTAINASPECT' VALUE='0'>";
resultHtml += "<PARAM NAME='BACKGROUNDCOLOR' VALUE='#000000'>";
resultHtml += "</OBJECT>";
resultHtml += "<BR>";
resultHtml += "<OBJECT height=32 width=" + strWidth + " classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA>";
resultHtml += "<PARAM NAME='_ExtentX' VALUE='12700'>";
resultHtml += "<PARAM NAME='_ExtentY' VALUE='847'>";
resultHtml += "<PARAM NAME='AUTOSTART' VALUE='0'>";
resultHtml += "<PARAM NAME='SHUFFLE' VALUE='0'>";
resultHtml += "<PARAM NAME='PREFETCH' VALUE='0'>";
resultHtml += "<PARAM NAME='NOLABELS' VALUE='0'>";
resultHtml += "<PARAM NAME='CONTROLS' VALUE='ControlPanel,StatusBar'>";
resultHtml += "<PARAM NAME='CONSOLE' VALUE='Clip'>";
resultHtml += "<PARAM NAME='LOOP' VALUE='0'>";
resultHtml += "<PARAM NAME='NUMLOOP' VALUE='0'>";
resultHtml += "<PARAM NAME='CENTER' VALUE='0'>";
resultHtml += "<PARAM NAME='MAINTAINASPECT' VALUE='0'>";
resultHtml += "<PARAM NAME='BACKGROUNDCOLOR' VALUE='#000000'>";
resultHtml += "</OBJECT>";
}
}
return resultHtml;
}
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="500" height="400">
<param name="movie" value="Flvplayer.swf" />
<param name="quality" value="high" />
<param name="allowFullScreen" value="true" />
<param name="FlashVars" value="vcastr_file=http://www.***.com/123.flv&LogoText=www.***.com&BufferTime=3" />
<embed src="Flvplayer.swf" allowfullscreen="true" flashvars="vcastr_file=http://www.***.com/123.flv&LogoText=www.***.com" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="500" height="400"></embed>
</object>