
Get video duration
Hi all!
The first time I use a JW Player on my site and I ran into one problem that can not decide
a few days.
I am creating a video gallery on your site and upload videos with a brief description of each,
including the duration of the clip.
??? ??? ???:
bc.. jQuery(document).ready(function(){
jwplayer("container").setup({
flashplayer: "player.swf",
file: "http://www.youtube.com/watch?v=Dc-x4OqkhiQ",
height: 270,
width: 720,
'controlbar': 'bottom'
}).onTime(function (callback) {
var pos = parseFloat(startPos) + callback.position;
setText("elapsedText", pos.toString());
percentage = pos / callback.duration;
slider.setValue(percentage);
setText("percentageText", percentage.toString());
}).onPlay(function () {
videoLength = jwplayer().getDuration(); // here, I get the correct duration
setText("durationText", videoLength.toString()+" ??????????!OnPlay!");
slider.enable();
}).onReady(function () {
//jwplayer().play();
//jwplayer().seek(10);
videoLength = jwplayer().getDuration(); //but here I can not get the correct duration of video
setText("durationText", videoLength.toString()+" ??????????!OnReady!");
slider.enable();
//alert(videoLength);
});
function setText(id, messageText) {
document.getElementById(id).innerHTML = messageText;
}
});
Tell me please how do I get the duration of video of the event onReady. Since the duration of my
each video must be placed in a particular block. Thanks.