c#mediaplayer怎样实现循环播放视频音乐啊 10
2个回答
展开全部
用 .NET 自带的类库 System.Media 下面的 SoundPlayer 来播放音乐的方式,此种方式使用托管代码,应该是更为可取的方式吧
使用起来非常简单,下面稍作说明:
1. 支持同步、异步播放
2. 支持循环播放
3. 支持文件和流播放
同步播放:
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.mid";
player.LoadAsync();
player.PlaySync();
循环播放:
System.Media.SoundPlayer player = new System.Media.SoundPlayer();
player.SoundLocation = @"d:\music\happy.wav";
player.Load();
player.PlayLooping();
使用起来非常简单,下面稍作说明:
1. 支持同步、异步播放
2. 支持循环播放
3. 支持文件和流播放
同步播放:
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.mid";
player.LoadAsync();
player.PlaySync();
循环播放:
System.Media.SoundPlayer player = new System.Media.SoundPlayer();
player.SoundLocation = @"d:\music\happy.wav";
player.Load();
player.PlayLooping();
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询