本人写了一个类,实现播放FLASH功能
public class Play
{
public Play()
{
//
//TODO: 在此处添加构造函数逻辑
//
}
public string PlaySwf(string url,int width,int height)
{
string strTmp = url.ToLower(); if (strTmp.EndsWith(".swf"))
{
return swf(url, width, height);
}
else if (strTmp.EndsWith(".flv"))
{
return flv(url, width, height);
} else
{
return "FLASH格式错误!";
}
} public string swf(string url,int width,int height)
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("<OBJECT codeBase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" ");
sb.Append(" height=\""+height+"\" width=\""+width+"\" >");
sb.Append("<PARAM NAME=\"FlashVars\" VALUE=\"\">");
sb.Append("<PARAM NAME=\"Movie\" VALUE=\""+url+"\">");
sb.Append("<PARAM NAME=\"Src\" VALUE=\""+url+"\">");
sb.Append("<PARAM NAME=\"WMode\" VALUE=\"Window\">");
sb.Append("<PARAM NAME=\"Play\" VALUE=\"-1\">");
sb.Append("<PARAM NAME=\"Loop\" VALUE=\"-1\">");
sb.Append("<PARAM NAME=\"QualITy\" VALUE=\"High\">");
sb.Append("<PARAM NAME=\"SAlign\" VALUE=\"\">");
sb.Append("<PARAM NAME=\"Menu\" VALUE=\"0\">");
sb.Append("<PARAM NAME=\"BASE\" VALUE=\"\">");
sb.Append("<PARAM NAME=\"AllowScriptAccess\" VALUE=\"always\">");
sb.Append("<PARAM NAME=\"Scale\" VALUE=\"ShowAll\">");
sb.Append("<PARAM NAME=\"DeviceFont\" VALUE=\"0\">");
sb.Append("<PARAM NAME=\"EmbedMovie\" VALUE=\"0\">");
sb.Append("<PARAM NAME=\"BGColor\" VALUE=\"\">");
sb.Append("<PARAM NAME=\"SWRemote\" VALUE=\"\">");
sb.Append("<PARAM NAME=\"MovieData\" VALUE=\"\">");
sb.Append("<PARAM NAME=\"SeamlessTabbing\" VALUE=\"1\">");
sb.Append("<embed src=\""+url+"\" height=\""+height+"\" width=\""+width+"\" qualITy=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\"type=\"application/x-shockwave-flash\" menu=\"false\">"); sb.Append("</embed>");
sb.Append("</OBJECT>");
return sb.ToString();
}
}数据库中存储FLah路径,在页面中调用
protected void Page_Load(object sender, EventArgs e)
{ string path = Request.QueryString["path"].ToString(); Play play = new Play();
Label1.Text = play.PlaySwf(path, 375, 281); }可是播放不了.flv格式的视频,以及一部分.swf格式的视频,请问各位高手如何解决!
public class Play
{
public Play()
{
//
//TODO: 在此处添加构造函数逻辑
//
}
public string PlaySwf(string url,int width,int height)
{
string strTmp = url.ToLower(); if (strTmp.EndsWith(".swf"))
{
return swf(url, width, height);
}
else if (strTmp.EndsWith(".flv"))
{
return flv(url, width, height);
} else
{
return "FLASH格式错误!";
}
} public string swf(string url,int width,int height)
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("<OBJECT codeBase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" ");
sb.Append(" height=\""+height+"\" width=\""+width+"\" >");
sb.Append("<PARAM NAME=\"FlashVars\" VALUE=\"\">");
sb.Append("<PARAM NAME=\"Movie\" VALUE=\""+url+"\">");
sb.Append("<PARAM NAME=\"Src\" VALUE=\""+url+"\">");
sb.Append("<PARAM NAME=\"WMode\" VALUE=\"Window\">");
sb.Append("<PARAM NAME=\"Play\" VALUE=\"-1\">");
sb.Append("<PARAM NAME=\"Loop\" VALUE=\"-1\">");
sb.Append("<PARAM NAME=\"QualITy\" VALUE=\"High\">");
sb.Append("<PARAM NAME=\"SAlign\" VALUE=\"\">");
sb.Append("<PARAM NAME=\"Menu\" VALUE=\"0\">");
sb.Append("<PARAM NAME=\"BASE\" VALUE=\"\">");
sb.Append("<PARAM NAME=\"AllowScriptAccess\" VALUE=\"always\">");
sb.Append("<PARAM NAME=\"Scale\" VALUE=\"ShowAll\">");
sb.Append("<PARAM NAME=\"DeviceFont\" VALUE=\"0\">");
sb.Append("<PARAM NAME=\"EmbedMovie\" VALUE=\"0\">");
sb.Append("<PARAM NAME=\"BGColor\" VALUE=\"\">");
sb.Append("<PARAM NAME=\"SWRemote\" VALUE=\"\">");
sb.Append("<PARAM NAME=\"MovieData\" VALUE=\"\">");
sb.Append("<PARAM NAME=\"SeamlessTabbing\" VALUE=\"1\">");
sb.Append("<embed src=\""+url+"\" height=\""+height+"\" width=\""+width+"\" qualITy=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\"type=\"application/x-shockwave-flash\" menu=\"false\">"); sb.Append("</embed>");
sb.Append("</OBJECT>");
return sb.ToString();
}
}数据库中存储FLah路径,在页面中调用
protected void Page_Load(object sender, EventArgs e)
{ string path = Request.QueryString["path"].ToString(); Play play = new Play();
Label1.Text = play.PlaySwf(path, 375, 281); }可是播放不了.flv格式的视频,以及一部分.swf格式的视频,请问各位高手如何解决!
s.addParam("allowfullscreen","true");
要在IIS中的属性--》HTTP头--》MIME映射--》文件类型中添加.flv文件,
才能播放