简体   繁体   中英

How would you design a video upload system using gcp and Go?

I want to build a tiny story system where users can upload videos. I'm using Firebase and the frontend will be in flutter.

I'm struggling a bit to design the flow from frontend to my Go backend. What's the simplest way to achieve this?

From what I understand I could use different flows:

  1. Front ask for an upload signed url to Go backend
  2. Backend generate a gcp storage signed url
  3. Front uploads the video
  4. Front send the link to backend
  5. Backend transcode the video
  6. Backend store the link in firestore

Or

  1. Front use directly firebase storage
  2. Front send the link to backend?

What's the benefits of using an upload signed url vs directly firebase storage?

Thanks in advance

What's the benefits of using an upload signed url vs directly firebase storage?

Firebase storage offers simplicity of security rules to restrict access while using GCS directly will require you to have a backend to generate signed URLs. I would prefer signed URLs when it's the system does not use Firebase Authentication or you want some validation before the file is uploaded as first place. However most of that can be done using security rules as well.

When using Firebase storage, the upload is simpler just by using uploadBytes() function while signed URLs would require some additional code. An example can be found in this

I am not sure what you mean by 'transcode video' but you can use Cloud Storage Triggers for Cloud Functions and run any actions such as adding URL to Firestore or process video once a file is uploaded.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM