libmpv_dart 0.0.5 copy "libmpv_dart: ^0.0.5" to clipboard
libmpv_dart: ^0.0.5 copied to clipboard

A Flutter FFI plugin for libmpv that provides Dart bindings for libmpv.

libmpv_dart #

libmpv_dart is a Dart binding for libmpv,aiming to provide Dart users with an efficient and convenient way to use libmpv.

a package that provides ability to access libmpv feature in dart application.

Platform libmpv API Video Render
Windows
Linux
macOS
android

Setup #

First,add libmpv_dart to your pubspec.yaml:

flutter pub add libmpv_dart

For windows/android users,run following command in your terminal:

dart run libmpv_dart:setup --platform windows
dart run libmpv_dart:setup --platform android

For linux users,all you need to do is install libmpv.

sudo apt install libmpv-dart

How to use? #

Generate a player instance(corresponding to mpv_handle)

// initial options for players
_player = Player(
  {
    'config': 'yes',
    'input-default-bindings': 'yes',
  },
  videoOutput: true,
);
_player.setPropertyString('keep-open', 'yes');

then you can execute some command,for example.load a file:

player.command(["loadfile",inputPath]);

After all the jobs are done,destory the player to free memory:

player.destroy();

or you can wait for a mpv event:

while (true) {
  Pointer<mpv_event> event = player.waitEvent(0);
  if (event.ref.event_id == mpv_event_id.MPV_EVENT_SHUTDOWN) {
    break;
  } else if (event.ref.event_id == mpv_event_id.MPV_EVENT_END_FILE) {
    break;
  }
  //wait until event happen.
}

credits #

This project is based on open-source projects. Some of the source code has been adapted or reused from the following project:

media-kit LICENSE

1
likes
150
points
146
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter FFI plugin for libmpv that provides Dart bindings for libmpv.

Repository (GitHub)

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

archive, collection, ffi, flutter, http, package_config, path, plugin_platform_interface

More

Packages that depend on libmpv_dart