rushabhmakwana-multidots opened a new issue #254: How to get media file 
duration before playing it?
   I am developing an ionic app in which I need to display media duration 
immediately after downloading it. I tried to show it with the below code:
       let audio ='XXXX');
       let audioDuration = audio.getDuration(); // it returns me 'NaN'.
   But when I play this audio and trying to get the audio duration in 
getCurrentPosition() function it gives the audio duration. For this, my code is 
       let audio ='XXXX');; 
       // success callback
         (position) => {
           if (position > -1) {
             var seconds =; // returns no.of seconds.
         // error callback
         (e) => {
           console.log("Error getting pos=" + e);
   How can I get the audio duration before playing it? Please help.

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:

With regards,
Apache Git Services

To unsubscribe, e-mail:
For additional commands, e-mail:

Reply via email to