Skip to content

Dart & Flutter media playback, broadcast, recording & chromecast library for Windows & Linux. (Both ๐ŸŽต audio & ๐ŸŽž video)

License

Notifications You must be signed in to change notification settings

ChiragKr04/dart_vlc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

59 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

dart_vlc

[WIP] Bringing power of VLC to Flutter & Dart apps on Windows & Linux (presently).

Installation

dependencies:
  ...
  dart_vlc: ^0.0.1

Documentation

Create a new Player instance.

Player player = await Player.create(id: 69420);

Create a single Media.

Media media0 = Media.file(
  new File('C:/music.mp3')
);

Media media1 = Media.network(
  'https://alexmercerind.github.io/music.aac'
);

Media media2 = await Media.asset(
  'assets/music.ogg'
);

Open Media or Playlist into a Player instance.

player.open(
  new Playlist(
    medias: [
      Media.file(new File('C:/music0.mp3')),
      Media.file(new File('C:/music1.mp3')),
      Media.file(new File('C:/music2.mp3')),
    ],
  ),
  autoStart: true, //default
);

Create a list of Medias using Playlist.

Playlist playlist = new Playlist(
  medias: [
    Media.file(new File('C:/music.mp3')),
    await Media.asset('assets/music.ogg'),
    Media.network('https://alexmercerind.github.io/music.aac'),
  ],
);

Control playback.

player.play();
player.seek(Duration(seconds: 30));
player.pause();
player.playOrPause();
player.stop();

Set playback volume & rate.

player.setVolume(0.5);

player.setRate(1.25);

Listen to playback events.

(Same can be retrieved directly from Player instance without having to rely on stream).

player.currentStream.listen((CurrentState state) {
  // state.index;
  // state.media;
  // state.medias;
  // state.isPlaylist;
});
player.positionStream.listen((PositionState state) {
  // state.position;
  // state.duration;
});
player.playbackStream.listen((PlaybackState state) {
  // state.isPlaying;
  // state.isSeekable;
  // state.isCompleted;
});
player.generalStream.listen((GeneralState state) {
  // state.volume;
  // state.rate;
});

Support

Consider supporting the project by either/and:

  • Starring the repository, to get this hardwork noticed.
  • Buying me a coffee.

Example

You can see an example project here.

Progress

Done

  • Media playback from file.
  • Media playback from network.
  • Media playback from assets.
  • play/pause/playOrPause/stop.
  • Multiple Player instances.
  • Playlist.
  • next/back/jump for playlists.
  • setVolume.
  • setRate.
  • seek.
  • Events.
  • Automatic fetching of headers, libs & shared libraries.
  • Changing VLC version from CMake.
  • Event streams.
    • Player.currentState
      • index: Index of current media in Playlist.
      • medias: List of all opened Medias.
      • media: Currently playing Media.
      • isPlaylist: Whether a single Media is loaded or a Playlist.
    • Player.positionState
      • position: Position of currently playing media in Duration.
      • duration: Position of currently playing media in Duration.
    • Player.playbackState
      • isPlaying.
      • isSeekable.
      • isCompleted.
    • Player.generalState
      • volume: Volume of current Player instance.
      • rate: Rate of current Player instance.

Under progress (irrespective of order)...

  • Device enumeration.
  • add/insert Media to Playlist during playback.
  • Retrieving metadata of a file.
  • FFI version of the library for plain Dart applications.
  • Linux version.
  • Embeding video inside the Flutter window.
  • Supporting live streaming links.
  • Bringing project on other platforms like Android/iOS.
  • Supporting native volume control/lock screen notifications.

Contributions

The code in the project is very nicely arranged, I have added comments wherever I felt necessary.

Contributions to the project are open, it will be appreciated if you discuss the bug-fix/feature-addition in the issues first.

License

Copyright (C) 2021, Hitesh Kumar Saini.

This library & work under this repository is licensed under GNU Lesser General Public License v2.1.

Acknowledgements

Thanks to @DomingoMG for the donation & testing of the project.

Spoilers

Currenty video playback is also supported out of the box, but it doesnt show inside Flutter window.

Vision

There aren't any media (audio or video) playback libraries for Flutter on Windows/Linux yet. So, this project is all about that. As one might be already aware, VLC is one of the best media playback tools out there.

So, now you can use it to play audio or video [WIP] files from Flutter Desktop app.

The API style of this project is highly influenced by assets_audio_player due to its completeness. This project will serve as a base to add Windows & Linux support to already existing audio playback libraries like just_audio and assets_audio_player.

Although, the mentioned repositories above are for audio playback, video playback is also a part of consideration for this project.

Thanks to the VideoLAN team for creating libVLC & libVLC++.

About

Dart & Flutter media playback, broadcast, recording & chromecast library for Windows & Linux. (Both ๐ŸŽต audio & ๐ŸŽž video)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 55.0%
  • Dart 37.0%
  • CMake 7.0%
  • Other 1.0%