react-native-compressor icon indicating copy to clipboard operation
react-native-compressor copied to clipboard

Fix divide by zero error (iOS)

Open drash-course opened this issue 3 years ago • 1 comments

Hi, I encountered a crash when compressing a small video. Here is my fix.

Xcode debugger indicated that the error comes from a "divide by zero" in the minBitrate expression. When the width * height is larger than 1280 * 720, the integer division will yield 0, which causes the crash.

Another issue I found, the maxSize option is ignored in the manual compression method. It seems hardcoded to 1920. I changed it to actually read the option. I assume the maxSize has a default value coming from JS like the auto method.

drash-course avatar Dec 28 '21 11:12 drash-course

@drash-course can you give me a video link that is giving this error so I can test it on my side.

numandev1 avatar Feb 06 '22 12:02 numandev1