Background Video Upload to Firebase Storage with Flutter

Background Video Upload to Firebase Storage with Flutter

Background Video Upload to Firebase Storage with Flutter. Seems like the Firebase team are planning on adding this feature. We’ll use the flutter_uploader plugin to perform the background uploads. It’s based on WorkManager in Android and NSURLSessionUploadTask in iOS, which are the platform specific ways to perform upload tasks that continue in the background, even after exiting the app.

What we’re building

I’ve written a few posts about video uploading to Firebase Storage from Flutter.

One thing that I have found really missing is background uploads — a way to upload large video files that will continue uploading even if the app is closed.

Seems like the Firebase team are planning on adding this feature, but in the meanwhile, here is an alternative way to accomplish it.

We’ll use the flutter_uploader plugin to perform the background uploads. It’s based on WorkManager in Android and NSURLSessionUploadTask in iOS, which are the platform specific ways to perform upload tasks that continue in the background, even after exiting the app.

The plugin can only upload via a URL though, which is something that the Firebase client SDKs don’t provide. So we’ll outsource generating the upload URL to a Cloud Function.

System Design

These are the steps each video will go through:

Image for post

1. Client creates a new doc in Firestore, with the raw video path.

2. The uploadNewVideo Cloud Function is triggered by document creation.

3. The Cloud Function generates a resumable upload url pointing to a new file in Cloud Storage.

4. The Cloud Function updates the Firestore doc with the upload url.

5. Client receives updated doc with upload url, generates thumbnails, and uploads video in the background.

6. On upload complete, the newStorageFile Cloud Function is triggered, setting the uploadComplete field in Firestore to true.

7. Client generates a permanent download url and saves it to Firestore.

cloud flutter firebase programming developer

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Google's Flutter 1.20 stable announced with new features - Navoki

Google has announced new flutter 1.20 stable with many improvements, and features, enabling flutter for Desktop and Web

Hire Flutter Developer

Are you looking for next-generation mobile applications to increase business benefits? **[HourlyDeveloper.io](https://hourlydeveloper.io/ "HourlyDeveloper.io")** is one of the most reputable mobile app development company, which provides Flutter...

Hire Dedicated Flutter Developer

Are you planning for creating a native-like cross-platform app for your venture? **[Hire Dedicated Flutter Developer](https://hourlydeveloper.io/hire-dedicated-flutter-app-developer/ "Hire Dedicated Flutter Developer")** to develop cross-platform...

Multi-cloud Spending: 8 Tips To Lower Cost

Mismanagement of multi-cloud expense costs an arm and leg to business and its management has become a major pain point. Here we break down some crucial tips to take some of the management challenges off your plate and help you optimize your cloud spend.

Flutter App Development | Skenix Infotech

Hire Flutter Developers from foremost Flutter app development company, Skenix Infotech to get a full spectrum of cross-platform flutter development services.