Audio in Linux

I’ve started writing the page to actually play the audio clips in my language learning app.

At the moment it loads the Windows Media Play plug in. This obviously won’t work on Linux so I have to ask, how do you play media files in a web browser when not on Windows? Flash would be the obvious answer I suppose but I have an uncommon requirement - I need to be able to access the object via Javascript. Specifically, I need to know when a track is finished and the next one begins (from a play list) and none of the freely available Flash media players do that.

Any advice from anyone?