SimformSolutionsPvtLtd / react-native-audio-waveform

React Native component to show audio waveform with ease in react native application ✨
MIT License
141 stars 22 forks source link

[BUG] iOS `getDuration` leaks when no player + promise rejection with `NSError()` crash the iOS app #116

Open dprevost-LMI opened 4 weeks ago

dprevost-LMI commented 4 weeks ago

When getting the duration on iOS, if the player is not on the map, it will not reject the promise correctly and leak it.

Also, all usage of NSError() in reject ton iOS crashes the app. I tested the below (on simulator iOS 17), and it does not work. Using nil instead correctly rejects the promise and does not crash the app.

  @objc func extractWaveformData(_ args: NSDictionary?, resolver resolve: @escaping RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) -> Void {
    reject(Constants.audioWaveforms,"Can not get waveform data",NSError())
  }

Please take a look at the fixes in the following PR: https://github.com/SimformSolutionsPvtLtd/react-native-audio-waveform/pull/117