libmpv_dart 0.0.1 copy "libmpv_dart: ^0.0.1" to clipboard
libmpv_dart: ^0.0.1 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.

Platform status
Windows
Android
Linux
iOS
MacOS

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,libmpv_dart only support Debian-based Linux distributions now.

How to use? #

Generate a player instance(corresponding to mpv_handle)

import 'package:libmpv_dart/libmpv.dart' as mpv;
option={
"terminal":"yes",
"gapless-audio":"yes",
"log-file":logPath,    //corresponding to mpv_set_option_string()
};
  }
  mpv.Player player = mpv.Player(option);

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.
1
likes
0
points
215
downloads

Publisher

unverified uploader

Weekly Downloads

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

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

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

More

Packages that depend on libmpv_dart