lat_hdr_transcoder 1.0.2 copy "lat_hdr_transcoder: ^1.0.2" to clipboard
lat_hdr_transcoder: ^1.0.2 copied to clipboard

discontinued
PlatformAndroidiOS

It checks if the video file is in HDR format and converts HDR video to SDR video

example/lib/main.dart

import 'dart:io';

import 'package:flutter/material.dart';
import 'package:lat_hdr_transcoder/lat_hdr_transcoder.dart';
import 'package:photo_manager/photo_manager.dart';

import 'pick/photos_button.dart';
import 'presentation/selected_video.dart';

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

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

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

class _MyAppState extends State<MyApp> {
  String? selectedVideoPath;

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
          actions: [
            Builder(builder: (context) {
              return IconButton.outlined(
                onPressed: () async {
                  final result = await LatHdrTranscoder().clearCache();
                  debugPrint(result.toString());

                  if (mounted) {
                    ScaffoldMessenger.of(context).showSnackBar(
                      const SnackBar(content: Text('Clear cache')),
                    );
                  }
                },
                icon: const Icon(
                  Icons.cleaning_services_rounded,
                  color: Colors.white,
                ),
              );
            }),
            PhotosButton(
              onSelectedAsset: (asset) async {
                if (asset.type != AssetType.video) {
                  debugPrint("video file is not");
                  return;
                }
                File? file = await asset.loadFile(isOrigin: true);
                if (file == null) return;

                final extensionSplit = file.uri.pathSegments.last.split('.');
                final extension = extensionSplit.last;
                debugPrint(file.path);
                if (extension.toLowerCase() != "mp4") {
                  file = await file.rename('${file.path}.mp4');
                }

                selectedVideoPath = file.path;
                setState(() {});
              },
            ),
          ],
        ),
        body: _buildBody(),
      ),
    );
  }

  Widget _buildBody() {
    final path = selectedVideoPath;
    if (path == null) return const SizedBox();

    return SelectedVideo(
      key: ValueKey(path),
      path: path,
      onClear: () {
        selectedVideoPath = null;
        setState(() {});
      },
    );
  }
}
1
likes
150
pub points
0%
popularity

Publisher

unverified uploader

It checks if the video file is in HDR format and converts HDR video to SDR video

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on lat_hdr_transcoder