views:

33

answers:

2

What is the best way to construct a audio player that can communicate with the jquery on my site?

Can I have flash send jquery commands when a song is finished playing?

Does html5 audio support a onSongEnd or similar function?

Songs on my site are a series of links that trigger jquery to reload a flash audio player with the appropriate song info. I would like to improve it so that I will automatically move on to the next song, or not depending on the users listening preferences. I would also like to be able to randomly play a promotional clip before playing the chosen song.

Do I need a custom flash player for this?

What is the best way to go about this?

+2  A: 

Can I have flash send jquery commands when a song is finished playing?

Yes, you can; you can listen to the soundComplete event on the corresponding SoundChannel object and call the appropriate JavaScript (and hence jQuery) function from Flash using ExternalInterface.call().

You can find sample code for both classes in the examples section of their corresponding pages. The example for soundComplete demonstrates how to load and play the next song upon completing the currently played one - basically you load the next song from the soundComplete event handler of the current song.

Amarghosh
A: 

I think Flash is still a safe bet. Take a look at jPlayer; it is a JQuery plugin for playing audio files. It has a beautiful with some useful items, user interface.

Kaveh Shahbazian