There is an onClick event for a link, and I am playing some audio using these lines there:
tts = new Media(url, onSuccessTTS, onErrorTTS);
tts.play();
However, if user clicks second time on the link before it finishes playing the first media, it plays the same file simultaneously again. Is there any way to prevent playing if the media is currently being played?
There is a callback event for mediaStatus, but it is not documented.
http://docs.phonegap.com/en/1.0.0/phonegap_media_media.md.html
With the phonegap media api, you are manually creating an audio player. Therefore you must manage the state of your player programatically.
Since there should be one control for your media player, I would keep the state on the HTML DOM element that has the play button
BTW phonegap is up to version 2.0, so consider using the 2.0 media api.