react-native-sound: getDuration() returns negative values for network files - android only

Actually I am trying to Load sound from the network. Its works in iOS. But not in android. I’m getting duration as -0.001 in it Screenshot 2019-08-14 at 8 03 33 PM

Is your issue with…

  • iOS
  • Android
  • Windows

Are you using…

  • React Native CLI (e.g. react-native run-android)
  • Expo
  • Other: (please specify)

Which versions are you using?

  • React Native Sound:0.10.9, 0.11.0
  • React Native:0.59.3
  • iOS: works fine on iOS
  • Android:7, 7.1, 8, 9
  • Windows: not implementing in windows

Does the problem occur on…

  • Simulator
  • Device

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Reactions: 2
  • Comments: 19

Most upvoted comments

Recently I discovered that some audio files can show different durations on different devices. So it was not this library bug. The only way to fix it - to format audio files to files with “constant bit rate”. In my case I used “Audacity” on mac to fix it

emmm,as you said,I have tried to put the video on the server and it worked. in the meantime,i found the video cannot be mp3,otherwise it will not work ,even report an error!(Android)

I noticed this problem only occurring when we are using local files but it is working fine when fetching from the server.

On Sun, Dec 29, 2019, 8:03 PM linyangcong notifications@github.com wrote:

hey.I got this problem . Have solved it?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/zmxv/react-native-sound/issues/607?email_source=notifications&email_token=ABH54CLR6AFP3NOWUUTIKADQ3CYNFA5CNFSM4IMEKWKKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHZAYRQ#issuecomment-569510982, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABH54CJ445SYPMX6FAKML4LQ3CYNFANCNFSM4IMEKWKA .