light_compressor_v2 1.9.0 copy "light_compressor_v2: ^1.9.0" to clipboard
light_compressor_v2: ^1.9.0 copied to clipboard

Native light video compression for Flutter (No FFmpeg) — single or batch, H.264/H.265, target size, trim, rotate and colour, with live progress and cancellation.

example/lib/main.dart

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

import 'batch_compress_view.dart';
import 'single_compress_view.dart';
import 'theme.dart';

void main() => runApp(const MyApp());

/// Root widget of the example app.
class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) => MaterialApp(
        title: 'LightCompressor',
        debugShowCheckedModeBanner: false,
        theme: AppTheme.light,
        home: const HomeScreen(),
      );
}

/// Home screen with two tabs: single-video and batch compression.
class HomeScreen extends StatefulWidget {
  const HomeScreen({super.key});

  @override
  State<HomeScreen> createState() => _HomeScreenState();
}

class _HomeScreenState extends State<HomeScreen> {
  final LightCompressor _compressor = LightCompressor();

  Future<void> _clearCache() async {
    await _compressor.clearCache();
    if (!mounted) return;
    ScaffoldMessenger.of(context).showSnackBar(
      const SnackBar(content: Text('Cache cleared')),
    );
  }

  @override
  Widget build(BuildContext context) => DefaultTabController(
        length: 2,
        child: Scaffold(
          appBar: AppBar(
            title: const Text('LightCompressor v2'),
            actions: [
              IconButton(
                icon: const Icon(Icons.delete_sweep_outlined),
                tooltip: 'Clear cache',
                onPressed: _clearCache,
              ),
            ],
            bottom: const TabBar(
              tabs: [
                Tab(icon: Icon(Icons.movie_outlined), text: 'Single'),
                Tab(icon: Icon(Icons.video_library_outlined), text: 'Batch'),
              ],
            ),
          ),
          body: TabBarView(
            children: [
              SingleCompressView(compressor: _compressor),
              BatchCompressView(compressor: _compressor),
            ],
          ),
        ),
      );
}
13
likes
160
points
7.66k
downloads

Documentation

API reference

Publisher

verified publishergurf.dev

Weekly Downloads

Native light video compression for Flutter (No FFmpeg) — single or batch, H.264/H.265, target size, trim, rotate and colour, with live progress and cancellation.

Repository (GitHub)
View/report issues

Topics

#video #compression #video-compression #media #compressor

License

MIT (license)

Dependencies

flutter

More

Packages that depend on light_compressor_v2

Packages that implement light_compressor_v2