C#、VB.NET 使用System.Media.SoundPlayer播放音乐

来源:互联网 发布:golang实现tcp反向代理 编辑:程序博客网 时间:2024/05/16 18:00

 同步播放:

System.Media.SoundPlayer player = new System.Media.SoundPlayer();player.SoundLocation = @"d:/music/happy.wav";player.Load();player.Play();

异步播放:

System.Media.SoundPlayer player = new System.Media.SoundPlayer();player.SoundLocation = @"d:/music/happy.wav";player.LoadAsync();player.PlaySync();

循环播放:

System.Media.SoundPlayer player = new System.Media.SoundPlayer();player.SoundLocation = @"d:/music/happy.wav";player.Load();player.PlayLooping();
原创粉丝点击