我把一个存储在数据库中的声音文件作为Byte[]
。现在,我想在我的WPF程序中播放这个声音文件。我怎么能这样做?
答案 0 :(得分:2)
也许此链接与您的情况相关:
http://vbcity.com/blogs/xtab/archive/2009/06/29/how-to-play-sounds-and-music-in-wpf.aspx
答案 1 :(得分:2)
您需要执行以下操作:
private void PlaySoundFromBytes(byte[] rawSoundBytes)
{
Stream rawStream = new MemoryStream(rawSoundBytes);
var player = new SoundPlayer(rawStream);
player.Play();
}