Video Upload SDK

A Flutter SDK that enables users to upload videos easily within your app. It handles validations for file size and video duration, making integration smooth and reliable.

This SDK is ideal for platforms where users are allowed to upload videos less than 200MB in size and not more than 5 minutes in duration. It includes built-in validations, preview support for smaller files, and a callback-based submission flow for seamless integration.


โœจ Features

  • ๐Ÿ“น Pick video files from the user's device
  • โœ… Validates file size (max 200MB)
  • โฑ๏ธ Validates video duration (max 5 minutes)
  • ๐Ÿ‘€ Preview support for videos smaller than 100MB
  • ๐Ÿง  Callback-based submission: you handle what happens after validation
  • ๐Ÿงผ Built-in UI for form input and error handling

๐Ÿ›  Getting Started

โœ… Prerequisites

Ensure the following permissions are added in your project:

Android

In android/app/src/main/AndroidManifest.xml, add:

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />

IOS

<key>NSPhotoLibraryUsageDescription</key>
<string>This app needs access to photo library to select videos</string>

Usage

import 'package:flutter/material.dart';
import 'package:video_upload_sdk/video_upload_sdk.dart';

void main() {
  runApp(const MainApp());
}

class MainApp extends StatelessWidget {
  const MainApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(debugShowCheckedModeBanner: false,home: MyApp());
  }
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  bool isSubScribed = true;
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: ElevatedButton(
          style: ElevatedButton.styleFrom(
            backgroundColor: Colors.blue,
            foregroundColor: Colors.white,
            padding: const EdgeInsets.symmetric(horizontal: 32, vertical: 16),
            textStyle: const TextStyle(fontSize: 16),
          ),
          onPressed: () {
            if (!isSubScribed) {
              ScaffoldMessenger.of(context).showSnackBar(
                const SnackBar(
                  content: Text("Unsubscribed users cannot upload videos"),
                  backgroundColor: Colors.red,
                ),
              );
              return;
            }
            Navigator.of(context).push(
              MaterialPageRoute(
                builder: (_) => VideoUploadScreen(
                  onSubmit: (video) async {
                    debugPrint(video.toJson().toString());
                  },
                ),
              ),
            );
          },
          child: Text("Upload video"),
        ),
      ),
    );
  }
}