anybody know how to read the first 30 seconds of an mp3 file using php, as a preview version of the original mp3?

Recommended Answers

All 3 Replies

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');
			$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;
Be a part of the DaniWeb community

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