numandev1 / react-native-compressor

🗜️Compress Image, Video, and Audio same like Whatsapp 🚀✨
MIT License
852 stars 85 forks source link

error in compressing video in react native v0.65.1 #31

Closed rnqayush closed 2 years ago

rnqayush commented 2 years ago

1-earlier i was using react native 0.61.5 and used this library for video and image compression. it was working as expected. 2- I have upgraded react native version to 0.65.1 and now image compression is working as expected but in video compression i am having errors. 3- i am sharing the screenshot of my code and error kindly suggest some idea to resolve it. toshob3 toshob

numandev1 commented 2 years ago

@rnqayush I think this error is not from the compressor package. i think it is from https://github.com/uuidjs/uuid#getrandomvalues-not-supported

can you provide reproducible example repo? so I can see it

rnqayush commented 2 years ago

@nomi9995 thanks for you response, actually i have tested this after removing this video compressor code then it works fine but after implementing this code i get this error.

rnqayush commented 2 years ago

@nomi9995 i made a fresh react native project and then installed this package. unfortunately i am getting error kindly look on it and suggest some idea to resolve it. also i am sharing the github repo. GitHub: https://github.com/rnqayush/react-native-video-compressor

snapshot of error: toshob2

numandev1 commented 2 years ago

@rnqayush Actually this is due to jcenter, many libraries which were published on jcenter having this issue. we should have to publish all libraries to mavenCenter. I will create a ticket on mavenCenter so our library may not be down https://developer.android.com/studio/build/jcenter-migration image

rnqayush commented 2 years ago

@nomi9995 thanks a lot for your response, kindly let us know when it is expected to be updated.

numandev1 commented 2 years ago

@rnqayush actually I did not publish the library on mavenCenter before. I am going to make a ticket on mavenCenter and then d that the community will review the ticket and then will publish or reject it. it depends on the community review.

rnqayush commented 2 years ago

@nomi9995 sure thankyou .

rnqayush commented 2 years ago

also @nomi9995 do it will work on ios or there too it can have issues.

numandev1 commented 2 years ago

@rnqayush it is specifically for android

numandev1 commented 2 years ago

@rnqayush can you try 0.5.3-rc.0 version. it is working on my side

ymane commented 2 years ago

I am also facing same issue with "react-native-compressor": 0.5.3 and react-native: 0.64.2 [Error: crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported]

numandev1 commented 2 years ago

@ymane can you provide reproducible example in git repo because it is not reproducing on my side

numandev1 commented 2 years ago

@rnqayush @ymane I just release 1.0.0 can you try the 1.0.0 version

yarn add react-native-compressor@1.0.0
moowoonsunghoon commented 2 years ago

i have same issue

numandev1 commented 2 years ago

@moowoonsunghoon can you tell me your RN version and compressor version?

moowoonsunghoon commented 2 years ago

@nomi9995 my version is react-native: 0.64.1 react-native-compressor: 1.0.1

numandev1 commented 2 years ago

@moowoonsunghoon sorry for that. react-native-compressor>=1.0.0 is for react-native@0.65

you can use 0.5.6 version for the compressor

yarn add react-native-compressor@0.5.6

after this please do Invalidate Caches / Restart from android studio image

numandev1 commented 2 years ago

@moowoonsunghoon i will update documentation soon

moowoonsunghoon commented 2 years ago

@nomi9995 it's working!! thank you!!

DavidGonzalezGutierrez commented 2 years ago

Hello! Same issue on iOS. React Native version: 0.66.2 React Native Compressor: 1.0.2

numandev1 commented 2 years ago

@DavidGonzalezGutierrez can you try this Invalidate Caches / Restart from android studio image

DavidGonzalezGutierrez commented 2 years ago

Yes, but is in iOS. I clean the build folder in Xcode, and the caches of metro. But, when I try to compress a video I recieve the error crypto.getRandomValues() not supported.

DavidGonzalezGutierrez commented 2 years ago

When I use UUID version 4 in my app, I always use with DEV because I read the uuidv4 has problems in development mode

numandev1 commented 2 years ago

@DavidGonzalezGutierrez can you try this solution https://github.com/uuidjs/uuid/issues/416#issuecomment-651294527

import 'react-native-get-random-values'; in index.js or App.js file

let know if it fixes it. I will make this one as a part of this package

DavidGonzalezGutierrez commented 2 years ago

Yes, It works!

numandev1 commented 2 years ago

@DavidGonzalezGutierrez I also have published a new version 1.0.3 of the compressor where I added above fix

DavidGonzalezGutierrez commented 2 years ago

Nice work!

ahmad0303 commented 2 years ago

@nomi9995 Hello, When I use minimumFileSizeForCompress in video it changes the file format and didn't upload with the error TypeError: Network request failed "react-native-compressor": "^0.5.17", "react-native": "0.64.2", It perfectly works on images but didn't work on video

harleenarora commented 1 year ago

Compress video is not working on android

avyasradicle commented 12 months ago

Hi I am using "react-native": "0.70.1" and "react-native-compressor": "^1.7.2". Getting error in build-

numandev1 commented 12 months ago

@avyasradicle can you try this code and try to run project

    allprojects {
        repositories {
            ...
            maven { url 'https://jitpack.io' }
        }
    }
avyasradicle commented 12 months ago

It worked. Thank you!! :)