libwinmedia 0.0.1 copy "libwinmedia: ^0.0.1" to clipboard
libwinmedia: ^0.0.1 copied to clipboard

discontinuedreplaced by: dart_vlc
outdated

Dart bindings to libwinmedia.

libwinmedia.dart

Dart bindings to libwinmedia.



libwinmedia is a high-level and powerful media playback, tag parsing library (currently only working on Windows).

Majority of the Dart bindings in the repository (except the object oriented wrapper built around it & NativePorts based event handling) are automatically generated using ffigen.

Example #

A very simple example can be as follows.

import 'package:libwinmedia/libwinmedia.dart';

void main() {
  var path = 'C:/absolute/path/to/libwinmedia.dll';
  LWM.initialize(DynamicLibrary.open(path));
  var player = Player(id: 0);
  player.streams.medias.listen((List<Media> medias) {});
  player.streams.isPlaying.listen((bool isPlaying) {});
  player.streams.isBuffering.listen((bool isBuffering) {});
  player.streams.isCompleted.listen((bool isCompleted) {});
  player.streams.position.listen((Duration position) {});
  player.streams.duration.listen((Duration duration) {});
  player.streams.index.listen((int index) {});
  player.open([
    Media(uri: 'https://www.example.com/media/music.mp3'),
    Media(uri: 'file://C:/documents/video.mp4'),
  ]);
  player.play();
  player.seek(Duration(seconds: 20));
  player.nativeControls.update(
    album: 'Fine Line',
    albumArtist: 'Harry Styles',
    trackCount: 12,
    artist: 'Harry Styles',
    title: 'Lights Up',
    trackNumber: 1,
    thumbnail: File('album_art.png'),
  );
}

Checkout the other APIs & docstrings within the project for more details information & are the most updated source of documentation.

Setup #

For getting this library to work, you must have libwinmedia-dart-vm.dll. Releases page on libwinmedia repository is the recommended way to retrieve it. Or you can compile it yourself, you can see GitHub actions for more details about this.

Workings #

Due to current limitations in the Dart FFI (as of v1.1.2), we cannot make C callbacks from another thread. To circumvent this (and support event callbacks as in example above), a custom & specialized shared library libwinmedia-dart-vm.dll should be used for these Dart bindings. Not going in much detail, it's maintained and is part of parent libwinmedia repository itself.

Contributions #

Contributions to the project are welcomed, either it be API improvements or documentation changes. Let's make it better.

License #

This library & work under this repository is MIT licensed, just like libwinmedia.

Copyright (C) 2021 libwinmedia.dart contributors.

13
likes
0
pub points
36%
popularity

Publisher

unverified uploader

Dart bindings to libwinmedia.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

ffi, path

More

Packages that depend on libwinmedia