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>";

?>
commented: good advice, and clean code --KT +1

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:

sounds great! and please don't double post :)

Aha! at last! i found here what ive been searchin for.... tnxs bro your the best!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.