anybody know how to read the first 30 seconds of an mp3 file using php, as a preview version of the original mp3?
Thanks that worked..
Before, I found another version of that class online, but it didn't work properly.
Here is the code for those it would help..
header('Content-type: audio/mp3'); header('Content-disposition: attachment; filename="afda.mp3"'); header('X-Pad: avoid browser bug'); header('Cache-Control: no-cache'); include_once('mp3.php'); $path = 'teachings/afda.mp3'; $mp3 = new mp3($path); $mp3_1 = $mp3->extract(0,30); header('Content-length: ' . sizeof($mp3_1->str)); echo $mp3_1->str;
Hey guys. I've put together a script that extracts out part of the MP3 without having to use any outside classes.
Check it out at http://www.stephenwalcher.com/blog/2012/01/17/how-to-extract-and-play-part-of-an-mp3-in-php/ and let me know what you think!