Search code examples
jqueryjplayer

get duration of song before the player loads


Can I get it with something similar to :

$("#jquery_jplayer_1").jPlayer("getDuration") ?

Thank you in advance!


Solution

  • jPlayer puts information about the file being played into the data collection for the element it's bound to. Try this:

    var duration = $("#jquery_jplayer_1").data("jPlayer").status.duration;