Play an audio file on a site

I am just wondering how and which audio player I should use to allow my visitors to play audio files on my PHP site.

Thank!

0
source share
6 answers

try it

<?php
$path = "PATH OF YOUR AUDIO FILE";
$image = "PATH OF YOUR IMAGEFILE";;?>

<div class="demomain">
<br>
<div style="margin: 0 0 0 30px;" id="mediaspace" name="mediaspace"><embed height="395"  width="500" flashvars="javascriptid=JW&amp;autostart=false&amp;width=500&amp;height=395&amp;image=<?php echo $image; ?>&amp;file=<?php echo $path; ?>" allowfullscreen="true" wmode="transparent" allowscriptaccess="always" quality="high" name="JW" id="JW" style="undefined" src="http://player.longtailvideo.com/player4.6.swf" type="application/x-shockwave-flash">       </div>
<?php
echo '<script type="text/javascript">
var s1 = new SWFObject("","JW","500","395","9");
s1.addParam("allowscriptaccess", "always");
s1.addParam("wmode","transparent");
s1.addParam("allowfullscreen","true");
s1.addVariable("javascriptid", "JW");
s1.addVariable("autostart","false");
s1.addVariable("image","' . $image . '"));
s1.addVariable("width","500");
s1.addVariable("height","395");';
echo 's1.addVariable("file","' . $path . '");'; 
echo 's1.write("mediaspace");';
echo '</script>';
?>
</div>
+2
source

HTML 5 has an audio player tag, see this: http://www.w3schools.com/html5/att_audio_src.asp it is supported in major browsers, but depends on the format of the audio file

you can see this: http://jplayer.org/ jquery one,

+2
source

JPlayer - HTML/CSS . HTML5, , Flash, . jQuery.

-: http://jplayer.org/

+1

<object height="81" width="100%">
  <param name="movie" value="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F32222617&amp;show_comments=true&amp;auto_play=true">
  </param>
  <param name="allowscriptaccess" value="always"></param>
  <embed allowscriptaccess="always" height="81" src="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F32222617&amp;show_comments=true&amp;auto_play=true&amp;repeat=1" type="application/x-shockwave-flash" width="100%" loop="yes" autoresume="1" repeat="1">
  </embed>
</object>
0

You can try Flash Player. I think it will meet your requirements. Of course, you must install a flash player, but almost all Internet users have a flash player installed on their machines.

0
source

use it <audio controls><source src="<?php echo $pathtofile ?>" type="audio/mpeg">Error loading</audio>This works for me.

0
source

All Articles