首页 > 代码库 > flv mp4视频播放
flv mp4视频播放
protected void Page_Load(object sender, EventArgs e) { //这个你可以直接指定路径,当然可以接收从另外一页传过来的参数,再有一个就是从数据库取出来啦。 string file = ResolveUrl("~/Flv/歌曲:王菲《传奇》.flv");
Flv objFlv = new Flv(800, 600, file); this.Literal1.Text = objFlv.Player(); }
public class Flv { private string _File; private int _Width; private int _Height;
public int Width { set { _Width = value; } }
public int Height { set { _Height = value; } }
public string File { set { _File = value; } }
public Flv() { // // TODO: Add constructor logic here // }
public Flv(int Width, int Height, string File) { this._Width = Width; this._Height = Height; this._File = File; }
public string Player() { string texts = string.Empty; string config = "0:自动播放|0:连续播放|100:默认音量|0:控制栏位置|2:控制栏显示|0x000033:主体颜色|60:主体透明度|0x66ff00:光晕颜色|0xffffff:图标颜色|0xffffff:文字颜色|:logo文字|:logo地址|:结束swf地址"; //string swffile = HttpContext.Current.Request.ApplicationPath + "/Flv/vcastr22.swf"; string swffile = "/Flv/vcastr22.swf"; return @"<object classid=‘clsid:d27cdb6e-ae6d-11cf-96b8-444553540000‘ codebase=‘http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0‘ width=" + _Width + " height=" + _Height + ">" + @" <param name=‘movie‘ value="http://www.mamicode.com/+ swffile +">" + @" <param name=‘quality‘ value=http://www.mamicode.com/‘high‘>" + @" <param name=‘menu‘ value=http://www.mamicode.com/‘false‘>" //+ @" <param name=‘IsAutoPlay‘ value=http://www.mamicode.com/‘1‘>"autoPlay="true" + @" <param name=‘autoPlay‘ value=http://www.mamicode.com/‘true‘>" + @" <param name=‘wmode‘ value=http://www.mamicode.com/‘opaque‘>" + @" <param name=‘allowFullScreen‘ value=http://www.mamicode.com/‘true‘>" + @" <param name=‘FlashVars‘ value=http://www.mamicode.com/‘vcastr_file=" + _File + "&vcastr_title=" + texts + "&vcastr_config=" + config + "‘>" + @" <embed src="http://www.mamicode.com/+ swffile +" wmode=‘opaque‘ FlashVars=‘vcastr_file=" + _File + "&vcastr_title=" + texts + "&vcastr_config=" + config + "‘ menu=‘false‘ quality=‘high‘ width=" + _Width + " height=" + _Height + " type=‘application/x-shockwave-flash‘ pluginspage=‘http://www.macromedia.com/go/getflashplayer‘ />" + @" </object>"; } }