Jump to content

mp3 - just first seconds

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1
DaQuark

DaQuark

    Newbie

  • Members
  • Pip
  • 2 posts
Hi there,

I have the following construct. Somebody uploads an mp3 file on a website and it will be stored via PHP somewhere in the file system. Let's say the mp3 is 30 seconds long. The user just uploads one version of the song (30 seconds)

Later I want to provide a 10 seconds preview of this file. This has to be totally secure, so the user can just listen to 10 seconds, not the 30 seconds full.

How can I do that? Is there a flash player which is able to just play the first 10 seconds of a song and how secure is that? Is there any other method with PHP or something else to reduce the song - I know it's really tricky and with PHP not really possible because PHP can't open/edit audio files.

How would a big music company do that?

Thanks a lot

#2
DaQuark

DaQuark

    Newbie

  • Members
  • Pip
  • 2 posts
I found a guy who programmed a PHP MP3 class. This class is able to merge two songs and even extract a part from a mp3.

PHP MP3 Class @ SourceRally.net PHP Community

It says this class has a bug, hopefully is the bug not too big.

#3
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
I could be wrong, but any script that uses the 30 second mp3 to play a 10 second segment could possible be hacked to gain access to the fill 30 seconds.

If it is embedded in flash, you can use a flash decompiler - if it is stored anywhere in your public_html directory it can be found using a directory sniffer.

The most secure way would be to: when the song is uploaded, make another mp3 (which is the 10 second segment), you then could store the 30 second mp3 somewhere on your server, and the 10 second mp3 in your public directory.

It doesn't have to be this sequence per se, but I'm pretty confident in saying there is no 100% secure way to play "part" of a single mp3, without making that "part" a separate mp3.