Greetings,

Would some experts show me php code to play a .wav file?

Thank you very much in advance.

phpnovice

You can embed html code in php.

Example,
<EMBED SRC="yourfile.wav" HIDDEN="TRUE" AUTOSTART="TRUE"></EMBED>

Hope it helps.

You can embed html code in php.

Example,
<EMBED SRC="yourfile.wav" HIDDEN="TRUE" AUTOSTART="TRUE"></EMBED>

Hope it helps.

Hi PoA,

Thanks for your help. I tried your code and it only worked outside php. I use dynamic .wav file name that is generated by php, it can not be used outside php.

I will appreciate it very much if you have further suggestion.


phpnovice :cry:

Post your code or

Try the following code.

<?php

$wave_file = generate_wavfile(); //This is the example one.
//Generate/Get wave file name without .wav extension format.

echo "<EMBED SRC=\"$wave_file.wav\" HIDDEN=\"TRUE\" AUTOSTART=\"TRUE\"></EMBED>";

?>
Comments
good advice, and clean code --KT

Post your code or

Try the following code.

<?php

$wave_file = generate_wavfile(); //This is the example one.
//Generate/Get wave file name without .wav extension format.

echo "<EMBED SRC=\"$wave_file.wav\" HIDDEN=\"TRUE\" AUTOSTART=\"TRUE\"></EMBED>";

?>

Hi PoA,

Thank you very much. I will try it this evening and let you know.

phpnovice :lol:

Post your code or

Try the following code.

<?php

$wave_file = generate_wavfile(); //This is the example one.
//Generate/Get wave file name without .wav extension format.

echo "<EMBED SRC=\"$wave_file.wav\" HIDDEN=\"TRUE\" AUTOSTART=\"TRUE\"></EMBED>";

?>

Hi PoA,

I tried and it worked.

Thank you very very much.

phpnovice :cheesy:

This article has been dead for over six months. Start a new discussion instead.