Slice/Cut a portion of uploaded mp3 file

Hi,

I am working on an e-commerce website where the vendor uploads mp3 files to the website for sale.

The functionality is that the uploaded files are available for visitors to listen to, and then if they want, they can purchase them.

Now, i want the visitors to be able to listen to only a portion of mp3 file, say 20 seconds, so, i feel, i’ll be needed to slice/cut the mp3 file, however, the user shouldn’t be able to download mp3 without purchasing the file.

please suggest me a solution for that, because i don’t want users to upload a separate demo file.

Thanks,
Kul.

Hi kuldeepkaundal,

You could create a timer instance for each user as they choose a song. When the timer stops unlink the media url they are using. This would be done with JavaScript, the downside being that if they turn-off JS then they could listen to the full song.

Creating short versions would be easy. Use one of the scriptable audio programs to drop files into a folder and for them to be reencoded bases on the parameters you set, which include file names.

Steve

If you use any form of client side processing, it can be easily bypassed as mentioned to allow a user to listen to the whole file.

You can automate server side automation of audio file processing using the applications ffmpeg or sox, which can be sent commands from php