A way to play mp3 samples
I am currentyl developing a site for a client who 开发者_如何学JAVArequires 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?
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.
You have a few options:
- You could programatically interface with a tool like Silverlight or Flex to access a media player control and set properties.
- 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.
精彩评论