Hi,
I want to compress video size before upload .there are so many package foer that.but when use that it will show error only .is there any option for compress video in react native or asp .net core web api.
Hi,
I want to compress video size before upload .there are so many package foer that.but when use that it will show error only .is there any option for compress video in react native or asp .net core web api.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Tuhin PaulPosted Feb 14, 2023, 9:11 AM
Yes, there are several options for compressing video in React Native. One popular option is to use the
react-native-video-processingpackage, which provides a simple API for compressing and resizing videos.Here's an example code snippet that shows how you can use
react-native-video-processingto compress a video file before uploading it:In this example,
uriis the file URI of the original video that you want to compress, andcompressedUriis the file URI of the compressed video that is generated by theVideo.compressmethod. You can then upload the compressed video to your server using your preferred method (e.g.fetch).The
qualityandbitrateMultiplieroptions control the compression settings. You can adjust these options to achieve the desired level of compression. ThesaveToLibraryoption specifies whether to save the compressed video to the user's camera roll. In this example, we set it tofalseto avoid cluttering the user's camera roll with unnecessary files.Note that
react-native-video-processinghas some native dependencies that you'll need to install and link in your project. You can follow the installation instructions on the package's README file to set it up correctly.