flutter_video_info 0.1.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 70

flutter_video_info #

This plugin uses MediaMetadataRetriever class of native android to get basic meta information of a video file.

The following info can be extracted by this plugin:

title path author mimetype height width filesize duration orientation date framerate location

This plugin is presently working only on Android. (if anyone wants to contribute for ios feel free to PR here..)

Installation & Uses #

Add flutter_video_info as a dependency in your pubspec.yaml file (what?).

dependencies:
    flutter_video_info: <current version>

Import FlutterVideoInfo in your dart file.

import 'package:flutter_video_info/flutter_video_info.dart';

final videoInfo = FlutterVideoInfo();

String videoFilePath = "your_video_file_path";
var info = await videoInfo.getVideoInfo(videoFilePath);

//String title = info.title;   to get title of video
//similarly path,author,mimetype,height,width,filesize,duration,orientation,date,framerate,location can be extracted.

0.1.0 #

  • Warning removed, License added

0.0.1 #

  • initial release.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_video_info/flutter_video_info.dart';
import 'package:permission_handler/permission_handler.dart';

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

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  getExternalStoragePermission() async {
        await PermissionHandler().requestPermissions([PermissionGroup.storage]);
  }

  final videoInfo = FlutterVideoInfo();

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

  String info = "";

  getVideoInfo() async {
    /// here file path of video required
    String videoFilePath = "storage/emulated/0/Geocam/Videos/V.mp4";
    var a = await videoInfo.getVideoInfo(videoFilePath);
    setState(() {
      info =
          "title=> ${a.title}\npath=> ${a.path}\nauthor=> ${a.author}\nmimetype=> ${a.mimetype}";
      info +=
          "\nheight=> ${a.height}\nwidth=> ${a.width}\nfileSize=> ${a.filesize} Bytes\nduration=> ${a.duration} milisec";
      info +=
          "\norientation=> ${a.orientation}\ndate=> ${a.date}\nframerate=> ${a.framerate}";
      info += "\nlocation=> ${a.location}";
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        floatingActionButton: FloatingActionButton(
            child: Icon(Icons.plus_one),
            onPressed: () {
              getVideoInfo();
            }),
        appBar: AppBar(
          title: const Text('Flutter_Video_info example app'),
        ),
        body: Padding(
          padding: const EdgeInsets.all(30.0),
          child: Center(
            child: Text(
              info,
              style: TextStyle(fontSize: 21),
            ),
          ),
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  flutter_video_info: ^0.1.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:flutter_video_info/flutter_video_info.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
41
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
70
Learn more about scoring.

We analyzed this package on Mar 27, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6
  • Flutter: 1.12.13+hotfix.8

Health suggestions

Format lib/flutter_video_info.dart.

Run flutter format to format lib/flutter_video_info.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
path ^1.6.4 1.6.4
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test