function intilizePlayer(){
$("#jquery_jplayer_1").jPlayer({
ready: function (event) {
$(this).jPlayer("setMedia", {
oga:song
});
songDuration = $(this).jPlayer.status.duration;
},
ended: function (event) {
$(this).jPlayer("play");
},
swfPath: "swf",
supplied: "oga"
}).bind($.jPlayer.event.play, function() {
$(this).jPlayer("pauseOthers");
});
}
Here i try to get the duration of the song. But it says "undefined". Other than this i tried to use the following, after calling the above function.
var duration = $("#jquery_jplayer_1").data("jPlayer").status.duration;
Then the duration became 0. How to get the real duration?
function intilizePlayer(){
$("#jquery_jplayer_1").jPlayer({
ready: function (event) {
$(this).jPlayer("setMedia", {
oga:song
});
},
ended: function (event) {
$(this).jPlayer("play");
},
loadeddata: function(event){ // calls after setting the song duration
songDuration = event.jPlayer.status.duration;
},
swfPath: "swf",
supplied: "oga"
}).bind($.jPlayer.event.play, function() {
$(this).jPlayer("pauseOthers");
});
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With