1.html 使用embed 嵌入wmv格式的视频,怎么做一个图片封面,就是说在我没有点播放按钮之前,播放器显示的是视频开头的画面或者某个图片也可.注意是wmv格式的,不是AVI的,<img dynsrc >我浏览器不支持,故不考虑.
请贴完整代码.再次感谢
在前台直接调用
比如你路径放在 E:\1.wmv,
<%=SelPlay(@"E:\1.wmv", 500, 400)%>这样就ok了
.cs文件 直接拷贝,,
/// <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 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";
if (Exts.IndexOf("isExt") >= -1)
{
switch (isExt)
{
case "avi":
case "wmv":
case "asf":
case "mov":
html += "<EMBED id=MediaPlayer src=" + 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;
}
比如你路径放在 E:\1.wmv,
<%=SelPlay(@"E:\1.wmv", 500, 400)%>这样就ok了
.cs文件 直接拷贝,,
/// <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 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";
if (Exts.IndexOf("isExt") >= -1)
{
switch (isExt)
{
case "avi":
case "wmv":
case "asf":
case "mov":
html += "<EMBED id=MediaPlayer src=" + 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;
}
温馨提示:答案为网友推荐,仅供参考