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?
Yes, you can; you can listen to the
soundCompleteevent 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
soundCompletedemonstrates how to load and play the next song upon completing the currently played one – basically you load the next song from thesoundCompleteevent handler of the current song.