suma237 Posted August 18, 2007 Share Posted August 18, 2007 On click of a link i need to play the desired file Quote Link to comment https://forums.phpfreaks.com/topic/65571-solved-how-to-play-a-wav-file-using-php/ Share on other sites More sharing options...
NArc0t1c Posted August 18, 2007 Share Posted August 18, 2007 Not with php. Try flash. Quote Link to comment https://forums.phpfreaks.com/topic/65571-solved-how-to-play-a-wav-file-using-php/#findComment-327366 Share on other sites More sharing options...
suma237 Posted August 18, 2007 Author Share Posted August 18, 2007 means Quote Link to comment https://forums.phpfreaks.com/topic/65571-solved-how-to-play-a-wav-file-using-php/#findComment-327372 Share on other sites More sharing options...
NArc0t1c Posted August 18, 2007 Share Posted August 18, 2007 PHP isn't able to play media, it's a hypertext pre-processor. Try using flash, you can play media with it, and embed it in a php script. Quote Link to comment https://forums.phpfreaks.com/topic/65571-solved-how-to-play-a-wav-file-using-php/#findComment-327376 Share on other sites More sharing options...
suma237 Posted August 18, 2007 Author Share Posted August 18, 2007 Can you please check this code <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <SCRIPT TYPE="text/javascript"> <!-- function soundplay() { alert("fff"); if (navigator.appName == "Netscape") { document.MySound.play(false) return false; } else return true; } //--> </SCRIPT> </head> <body> <? $music=$_GET['music']; $dir ="song"; $dh = opendir($dir); while ( !(($file = readdir($dh)) === false) ) { if ($file == "." || $file == "..") continue; if (eregi(".wav",$file)) { echo' <a href="?music=true&file='. $dir . '/' . $file . '" onClick="return soundplay()">'.$file.'</A>'; } } if($music == 'true') { $file = $_GET['file']; echo '<EMBED src="'. $dir . '/' . $file . '" NAME="MySound" HEIGHT=144 WIDTH=166 MASTERSOUND HIDDEN >'; } ?> </body> </html> Inside the loop it is not working.Why? Quote Link to comment https://forums.phpfreaks.com/topic/65571-solved-how-to-play-a-wav-file-using-php/#findComment-327381 Share on other sites More sharing options...
suma237 Posted August 18, 2007 Author Share Posted August 18, 2007 help me.. Quote Link to comment https://forums.phpfreaks.com/topic/65571-solved-how-to-play-a-wav-file-using-php/#findComment-327411 Share on other sites More sharing options...
MadTechie Posted August 18, 2007 Share Posted August 18, 2007 PHP can not play WAV files.. you would be better off using Flash or javascript to play them. as for the code supplied it will only work on Netscape, see the javascript section for more info.. as for "Inside the loop it is not working.Why?" its working exactly how its been programmed to work.. please read How To Ask Questions The Smart Way Quote Link to comment https://forums.phpfreaks.com/topic/65571-solved-how-to-play-a-wav-file-using-php/#findComment-327413 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.