I did it this way:
self.update_timer = function (event) {
var status = event.jPlayer.status;
$('.jtimer').text($.jPlayer.convertTime(status.duration - status.currentTime));
};
$('.jplayer')
.jPlayer('setMedia', {
mp3: mp3_link
})
.jPlayer('play')
.bind($.jPlayer.event.timeupdate, self.update_timer);
The important is that timeupdate
event sends status object with duration
and currentTime
properties that contain exactly what you need. The event is fired 4 times per second.
$.jPlayer.convertTime
converts plain seconds (4225) into hours:minutes:seconds (01:10:25).
I don't know exactly if this was available in 2.0, but in jPlayer 2.1.0 that I use this is written in the docs.