PDA

View Full Version : play .wav file



andryi
14 Aug 2009, 3:46 PM
Hi all, I try to replay .wav file,

here is the path of the file(well is a String)


var say02="JS/resources/sounds/ventanilla.wav"


here is a panel


var top2 = new Ext.FormPanel({
frame:true,
autoHeight: true,
bodyStyle:'padding:5px',
width: 807,
items: [
table
,{
xtype: 'box',
autoEl: {html: '<span name="sound" id="sound" loop="true" autostart="false" >&nbsp;</span>'}
//SRC="resources/sonido/Windows Ding.wav"
//<bgsound id="sound" loop="-1" HIDDEN="true" SRC="JS/resources/sounds/ventanilla.wav" autostart="true" >&nbsp;</bgsound>'
}
]
});


and here is how I try to play the file


document.getElementById("sound").src=say02;


so, Can anyone help me?

15 Aug 2009, 5:29 AM
Why not use one of the flash tools available? not all browsers are configured to automagically play files if presented.

andryi
15 Aug 2009, 7:15 PM
thank's for your answer JGarcia, and well I could play a .wav file, the shape in how I did it \:D/ is with this:

here I declare the sound, like html element


{
xtype: 'box',
autoEl: {html: '<embed src="JS/resources/sound.wav" name="window" id="window" loop="-1" HIDDEN="true" autostart="false" >&nbsp;</embed>'}
}


and here I play the sound:


var thissound=Ext.get("window");
thissound.Play();


I read some articles about soundmanager, but how is the implement can you put a single example, please?