1. //flash播放器
btnPlay.Enabled = true;
MySWF.Movie = openFlashDlg.FileName ;
//播放flash视频
MySWF.Play ();
//停止播放flash视频
MySWF.StopPlay ();
//暂停播放flash视频
MySWF.Playing = false;
//向后播放
MySWF.Back ();
//向前播放
MySWF.Forward ();
2.
//保存播放列表
private void savePlayList()
{
Stream mysavefile;
SaveFileDialog saveFileDialog1=new SaveFileDialog();
//过滤
saveFileDialog1.Filter = "播放列表文件|*.plt";
//最初的文件
saveFileDialog1.InitialDirectory=Application.StartupPath;
saveFileDialog1.Title = "Save an Image File";
//saveFileDialog1.ShowDialog();
if(saveFileDialog1.ShowDialog() == DialogResult.OK)
{
if((mysavefile = saveFileDialog1.OpenFile()) != null)
{
mysavefile.Close();
//保存播放列表
StreamWriter sw=new StreamWriter(saveFileDialog1.FileName);
this.listBox1.SelectedIndex=0;
for(int i=1;i<this.listBox1.Items.Count;i++)
{
sw.WriteLine(this.listBox1.SelectedItem.ToString());
this.listBox1.SelectedIndex+=1;
}
sw.Close();
}
}
3.
//打开Mp3播放列表
str=ofd.FileName;
StreamReader rsf=new StreamReader(str);
while(rsf.Peek()>=0)
{
this.listBox1.Items.Add(rsf.ReadLine());
}
注明:以上为flash播发器,以下为音乐播发器
1.
//设置当前位置
int iPos=this.listView1.SelectedItems[0].Index;
string FileName=this.listView1.Items[iPos].SubItems[3].Text;
this.axMediaPlayer1.FileName=FileName;
//播放
this.axMediaPlayer1.Play();
//暂停播放
this.axMediaPlayer1.pause();
//停止播放
this.axMediaPlayer1.stop();
//设置播放器的声音
axWindowsMediaPlayer1.settings.volume = trackBar1.Value;
2.
//双击列表中的文件进入播放
his.axWindowsMediaPlayer1.URL=this.listBox1.SelectedItem.ToString();
//若有歌曲播放则可最大化
if(this.axWindowsMediaPlayer1.playState==WMPLib.WMPPlayState.wmppsPlaying)
this.axWindowsMediaPlayer1.fullScreen=true;