Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

getDuration returns 0

Calling getDuration during the on('play') event in v7 returns 0. I understand the video needed to buffer first and that's why calling the function during on('ready') is not sufficient, but if the video has started to play, shouldn't the duration be known as well?

I have created a jsfiddle demonstrating this issue. From my tests it takes somewhere between 200-300ms AFTER a video starts playing before the duration is retrievable. This affects both the initially loaded video as well as subsequent loading of videos changed through the API

Is this a bug? or is there something I missed?

3 Community Answers


JW Player Support Agent  
0 rated :

Hi — We are looking to fix this with preload in JW 7.2.


0 rated :

Ok great! Any ETA on that release? I'll be on the lookout


0 rated :

Has this been updated? I'm still encountering situations where getDuration returns 0. Additionally and possibly related, I've noticed that if you seek on a file before it has properly recognized/calculated the duration value (before it's loaded enough?), that the player displays "NaN:NaN" in the duration portion of the control bar.

This question has received the maximum number of answers.