如何播放从资源音频 [英] How to Play audio from resource
本文介绍了如何播放从资源音频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图使用Dot.net CF资源播放音频,我增加了一个音频文件,在我的应用程序的资源属性,并正在尝试使用下面的示例资源文件引用$ C $下。
Am trying to play audio from resource using Dot.net CF, I added an audio file for the resource Property in my application, and am try to using below sample resource file reference code for..
SoundPlayer player = new SoundPlayer(Assembly.GetExecutingAssembly().
GetManifestResourceStream("blessedwav.wav"));
player.Play();
但是,这code不播放wav声音,如果有谁知道怎么玩CF使用3.5资源的音频文件,请给我这方面的一些建议。
But this code doesn't play wav sound, If anyone know How to play the resource audio file using CF 3.5, Please give me some suggestion regarding this.
推荐答案
我得到了solution.This code的工作非常好,在净CF:
I got the solution.This code is working very well in .Net CF:
// Convert a byte array to a stream
using (var audioStream = new MemoryStream(Properties.Resources.full_song_wav))
{
using (var player = new SoundPlayer(audioStream))
{
player.Play()
}
}
这篇关于如何播放从资源音频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文