question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

getDuration() not working

See original GitHub issue

I am trying to use getDuration() to determine when the user is at the end of their playback, but it is returning incorrect values. For example I have a 7 minute 12 second recording for which it should be returning something in the vicinity of 432 seconds, but it is currently returning approximately 410.5. This is on iOS, have not tested on Android. I know for sure the recording is 7 minutes and 12 seconds because I can sit there and listen to it, and watch the timer based on getCurrentTime() count all the way up…

EDIT: To add some more context for this, I was playing an .aac audio file recorded using the package react-native-audio

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:3
  • Comments:15 (2 by maintainers)

github_iconTop GitHub Comments

14reactions
scruff311commented, Dec 12, 2017

I have this issue on Android. It works fine on iOS, but on Android the call to getDuration() is returning -0.001 seconds. Any idea why?

3reactions
deepgosalia1commented, Jun 3, 2020

Seems it is still not resolved

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android MediaPlayer seekTo() / getDuration() not working as ...
When I call mediaPlayer.seekTo(50000) the value that is outputted in the OnSeekCompleteListener using mediaPLayer.getCurrentPosition() is the ...
Read more >
player.getDuration() is NOT working in YouTube Live ...
Hi, please be advised that if the currently playing video is a live event, getDuration() function will return the elapsed time since the...
Read more >
Date.prototype.getTime() - JavaScript - MDN Web Docs - Mozilla
The getTime() method returns the number of milliseconds since the epoch, which is defined as the midnight at the beginning of January 1, ......
Read more >
MediaPlayer - Android Developers
Calling stop() stops playback and causes a MediaPlayer in the Started, ... to allow configuration of the DRM properties before opening the DRM...
Read more >
'sound.getDuration()' not working - Builder - PsychoPy Discourse
I want the mouse to get activated only after the sound has completed playing. ... I used a 'sound.getDuration()' and selected 'Condition' instead ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found