This is possible using asp.net SoundPlayer Class
aspx page:
<asp:Button ID="Button1" runat="server" Text="Play" />
<asp:Button ID="Button2" runat="server" Text="Pause" />
HTML mark up you need to include this for previous versions,
<object data="sound1.wav"></object>
for the newer html5 you can use this:
<audio src="sound1.wav">
<p>Your browser does not support the audio element.</p>
</audio>
code behind file:
protected void Button1_Click(object sender, EventArgs e)
{
SoundPlayer playthewavfile = new SoundPlayer(@"C:/sound1.wav");
playthewavfile.Play();
}
protected void Button2_Click(object sender, EventArgs e)
{
SoundPlayer playthewavfile = new SoundPlayer(@"C:/sound1.wav");
playthewavfile.Stop();
}
EDIT:
If you want to do this purely with javascript and html try this:
I have not tested this, as I am very rusty using embed tag to parse audio file ever since html5 came out, you can try it and let me know if it works.
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
function play() {
window.document.embeds[0].Play()
window.document.embeds[1].Play()
}
function stop() {
window.document.embeds[0].Stop()
window.document.embeds[1].Stop()
}
</SCRIPT>
</HEAD>
<BODY>
<EMBED SRC="sound1.wav" NAME="video" AUTOSTART="false">
<EMBED SRC= "sound1.wav" AUTOSTART="false">
<FORM>
<INPUT TYPE="BUTTON" VALUE="Play" onClick="play()">
<INPUT TYPE="BUTTON" VALUE="Pause" onClick="stop()">
</FORM>
</BODY>
</HTML>