Music clips on a website

I working on a website for a musician, and on it he would like to have some 30 second song previews. I would like to have the user click a “preview” link or icon to play the 30 second preview clip. I would like it to play in the browser without downloading the sound file or opening a third party player. What is the best method to do this, and which is the preferred file formats?

You can’t play music or video—or even view a web page—without downloading it. For the file to play, you need a player, and that’s why 3rd party players are very handy. Check out FlowPlayer or JW Player, as they have nice controls that allow you to start and stop the track.

I’ve used some time ago jPlayer. maybe it will help you to. If the browser support html5 (audio) then it relays on that, else it use a small flash player.

Yeah, you have to offer the clip in one of two ways (just like video). You either have to expose the file itself for download, or you have to expose an interface (like the YouTube player does for video) which let’s visitors access the benefit of the clip without giving them direct access to it.

You could always try HTML5 audio tag

However, older browsers do not support it and you still have to provide a fall back through a plugin as mentioned by ralph.m.

There’s currently no one preferred format for the audio tag. But the audio tag allows you to specify more than one format (eg. .ogg and .mp3).