Search code examples
reactjsfirebasegoogle-cloud-functionsvideo-processing

How to upload videos to Firebase Storage for React app


I am working on a React project like a social media app where users can upload images or videos. I am using Firebase storage to store the image and videos.

I can able to accomplish image uploading by using React react-firebase-file-uploader package but as I am new to web development, I am struggling to find the solution for uploading videos for React.

I have searched the internet but I couldn't find a proper solution to accomplish these tasks.

  1. I required to upload only video/videos and want to preview it/them before uploading data to Firebase storage.

  2. I need to compress the video to reduce the file size before uploading or after uploading to Firebase storage using cloud functions.


Solution

  • May be is worth stating again that video files are compressed by default. If something, you can resize the file so that it has less resolution, or process it to add a watermark.

    Here is an answer that discribes how to resize a video file. And here is a tutorial on how to use moviepy on Cloud Functions.