views:

34

answers:

2

I am currentyl developing a site for a client who requires artist to upload their music but only play samples of it, sorta like iTunes. The site has a php backend and is currently using a basic mp3 flash player to play mp3s.

My question is there a flash player that can be configured to play only samples or is there a way through php or another method to load only a portion of the song and have it play in a player?

+1  A: 

I think probably the easiest, and safest way to give access to a sample is to make different versions of the mp3-files that are only the sample. You can use free tools such as Audacity to create a shorter version of the MP3.

If you would be using a Flash player to play only a short clip of the MP3, the browser would still have to download the whole MP3 and the user could then easily figure out the file URL and download it. On the otherhand, clipping it shorter with PHP would most likely be resource intensive, so just clip it beforehand using an audio editing tool.

TuomasR
Clipping it from PHP (for example with ffmpeg or any other commandline program) isn't particularly resource expensive if you do it when uploading.
Emil Vikström
+1  A: 

You have a few options:

  1. You could programatically interface with a tool like Silverlight or Flex to access a media player control and set properties.
  2. You could use a tool like ffmpeg programatically to create a clipped version of the file, similar to what BitPim does for creating ringtones, then serve that up.

I would go with the second approach.

Visionary Software Solutions