日期:2014-05-19  浏览次数:20704 次

Asp.net里怎么做视频
我想做在先聊天或会仪室类,请问怎么做在线视频啊??提供点线索哦!!
给点代码就太谢谢了...

------解决方案--------------------
///C#中的媒体播放类
using System;
namespace ConfigTools
{
/// <summary>
/// PlayClass 的摘要说明。
///原作CSDN,经本人稍加修改
/// </summary>
public class PlayClass
{
public PlayClass()
{
//
// TOD 在此处添加构造函数逻辑
//
}
public string Play(string url,int width,int height)
{
string strTmp = url.ToLower();
if(strTmp.EndsWith( ".wmv ")||strTmp.EndsWith( ".mp3 ")||strTmp.EndsWith( ".wma ")||strTmp.EndsWith( ".avi ")||strTmp.EndsWith( ".asf ")||strTmp.EndsWith( ".mpg "))
{
return wmv(url,width, height);
}
else if(strTmp.EndsWith( ".mp3 "))
{
return mp3(url,width,height);
}
else if(strTmp.EndsWith( ".swf "))
{
return swf(url,width, height);
}
else if(strTmp.EndsWith( ".jpg ")||strTmp.EndsWith( ".gif "))
{
return img(url,width, height);
}
else if(strTmp.EndsWith( ".rm "))
{
return rm(url,width, height);
}

else
{
return "数据错误 ";
}
}


/// <summary>
/// wmv格式文件播放
/// </summary>
/// <param name= "url "> </param>
/// <returns> </returns>

private string wmv(string url, int width, int height)
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();

sb.Append( " <object id=\ "WMPlay\ " style=\ "WIDTH: "+width+ "px;height: "+height+ "px\ " \n ");
sb.Append( "classid=\ "CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6\ " type=application/x-oleobject standby=\ "Loading Windows Media Player components...\ " ");
sb.Append( "codebase=\ "downloads/mediaplayer9.0_cn.exe\ " VIEWASTEXT> \n ");
sb.Append( " <param name=\ "URL\ " value= ' "+url+ " '> \n ");
sb.Append( " <param name=\ "controls\ " value=\ "ControlPanel,StatusBa\ "> ");
// <PARAM NAME= "CONTROLS " VALUE= "ControlPanel,StatusBar ">
sb.Append( " <param name=\ "hidden\ " value=\ "1\ "> ");
sb.Append( " <param name=\ "ShowControls\ " VALUE=\ "0\ "> ");
sb.Append( " <param name=\ "rate\ " value=\ "1\ "> \n ");
sb.Append( " <param name=\ "balance\ " value=\ "0\ "> \n ");
sb.Append( " <param name=\ "currentPosition\ " value=\ "-1\ "> \n ");
sb.Append( " <param name=\ "defaultFrame\ " value=\ "\ "> \n ");
sb.Append( " <param name=\ "playCount\ " value=\ "100\ "> \n ");