2
votes

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
/me votes for jquery and html5 audio!jAndy
@whoever-voted-to-close How is this subjective and argumentative - may be the last line is a little subjective, but I don't think that's a good enough reason to close this.Amarghosh
how is this question even remotely related to jQuery? doxdesk.com/img/updates/20091116-so-large.gifback2dos
@back he wants to call a jQuery function when a song completes playing in flash - a remote connection I must sayAmarghosh
@Amargosh: What I am saying is, that the problem is related do jQuery as much as it is related to Prototype. Either JavaScript can provide a solution for all requirements or it can't. Either it makes sense to do the playback using flash, or not. You might just as well ask, whether you can do this in PureMVC+Flex and JavaScript.back2dos

2 Answers

2
votes

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.

0
votes

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.