tags:

views:

441

answers:

4

I want to embed multiple audio to my site. I want the file to load but not play until the user hits the button. I also want the ablity to jump to places not yet loaded like youtube does. It would be great if i can play ogg, aac, mp4, etc but i dont expect that would be possible so I wouldnt mind having another version converted by ffmpeg (or anything else)

What can i use to have this youtube like audio player?

-edit- sorry guys i was away and didnt select the best answer in time. I find http://stackoverflow.com/questions/448871/web-nonstreaming-audio-solutions/550427#550427 is the best with sorin following closely behind http://stackoverflow.com/questions/448871/web-nonstreaming-audio-solutions/562958#562958

+7  A: 

I don't understand why you do not want streaming? Because that is exactly what I would recommend here. Note that streaming does not neccessarily mean a big, ugly, embedded player a la Windows Media, QuickTime or Real Player.

I would recommend using MP3 Audio and Flash, using the free JW FLV Media Player which should do everything that you want, except for the "low/high quality" thing, but maybe you can just use two players if you need.

Michael Stum
The JW FLV player works great.
Kibbee
+7  A: 

I would second Michael's suggestion with a small modification:

You could use an open-source flash player (like the XSPF Flash player) and hack it such that it starts loading the sound even before you start the playback. This way you can have all the sounds at the client after a certain period of time (which depends on the connection between the client and the server).

You might also want to take a look at Soundmanager v2, which offers a tight integration with Javascript, without the need for additional hacks.

Cd-MaN
I spent a couple of weeks on this subject in December, and SoundManager v2 is by far the best Javascript-scriptable player out there.
Jens Roland
Does it make sense to "start loading" if the sound is streamed ??? you may want to pre-buffer but you cannot cache an entire stream as far as I know.
Theo.T
Usually streaming is used in the sense of "start playing a finite sized file sooner" rather than the precise meaning of "play a - possible infinite - stream". This is the sense I've used in (so I was referring to pre-buffering the whole file).
Cd-MaN
+2  A: 

Have you seen Wimpy Player? They have various products, from a simple audio button to a video player with a play list.

I'm not sure about skipping to different parts of the file, but they say it is programmable with Ajax, and I know you can set whether it starts playing automatically or not.

I used this for a while, but later changed to something with a simple "play/pause" button.

(By the way, I don't understand your interest in a non-streaming player. If the user has to download the file first, why do you need to provide an interface? Won't they just open it with whatever program they use on their computer?)

Nathan Long
+2  A: 
  1. If you want to have this in the browser I suggest going for something Flash-based (it's much more straightforward for the end user, is based on a much better API and has a much better penetration than any media player you would like to count on).
  2. In Flash you can load audio/video by two protocols: HTTP or RTMP.
  3. RTMP is a sleek protocol for audio/video and has tight support for "seeking" within the document. It's implemented in the Flash Media Server, but also in the open source Red5. However, this means that you will need to run this server or buy the RTMP service.
  4. HTTP supports retrieving a part of a file (by specifying the Range header) but the protocol itself is format agnostic so if it's a variable bit rate you will probably have some issues. So technically you should be able to jump in the file to a section that's not loaded although Flash may not allow this for ... let's say proprietary reasons.
  5. mp4, ogg, aac will be problematic even with Flash. The best would be to convert them in a common format at upload time - I think Flash supports only mp3 before version 9 and AAC starting with Flash Player 9. ffmpeg and mplayer can handle/convert to/from many formats.
  6. Sorry to say, there is no silver bullet here. If you want something flexible you will have to trade off some development time and build something flexible (not only the web player but also some magic behind the scenes).
Sorin Mocanu