video_upload_sdk 0.0.1
video_upload_sdk: ^0.0.1 copied to clipboard
This is a SDK based on flutter which can be used for uploading videos less than 200 mb and within 5 minutes
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"),
),
),
);
}
}