-2
可能重复:
how to play a sound in asp.net web page?如何通过点击asp.net中的按钮播放声音?
嗨,我是想通过点击按钮来播放声音。但它不玩这个声音。它曾经扮演另一种声音。 我不想使用绝对地址我需要使用相对地址。 这是我在S的这段代码值代码
protected void Button1_Click1(object sender, EventArgs e)
{
System.Reflection.Assembly a = System.Reflection.Assembly.GetExecutingAssembly();
System.IO.Stream s = a.GetManifestResourceStream("chimes.wav");
SoundPlayer player = new SoundPlayer(s);
player.Play();
}
始终是NULL,我不知道为什么。
的图标,如果以帮助区分在服务器上运行:) – Aristos
以上答案都不对我读到这里帮助代码,问题是:每当你点击一个按钮时如何发出嘟嘟声? –
@RonaldinhoLearnCoding使用JavaScript和客户端Flash http://stackoverflow.com/questions/10648471/how-to-play-audio-and-video-files-in-web-browser/10648724#10648724 – Aristos