All Projects β†’ alexmercerind β†’ dart_vlc

alexmercerind / dart_vlc

Licence: LGPL-2.1 license
🎞 Flutter audio / video playback, broadcast & recording library for Windows & Linux.

Programming Languages

C++
36643 projects - #6 most used programming language
dart
5743 projects
CMake
9771 projects
c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to dart vlc

Shaka Player Embedded
Shaka Player in a C++ Framework
Stars: ✭ 153 (-65.15%)
Mutual labels:  video-player, playback
Celluloid
A simple GTK+ frontend for mpv
Stars: ✭ 541 (+23.23%)
Mutual labels:  video-player, audio-player
Qmplay2
QMPlay2 is a video and audio player which can play most formats and codecs.
Stars: ✭ 310 (-29.38%)
Mutual labels:  video-player, audio-player
Web
Angular6 music player to search and play YouTube, SoundCloud and Mixcloud tracks
Stars: ✭ 156 (-64.46%)
Mutual labels:  video-player, audio-player
Abmediaview
Media view which subclasses UIImageView, and can display & load images, videos, GIFs, and audio and from the web, and has functionality to minimize from fullscreen, as well as show GIF previews for videos.
Stars: ✭ 79 (-82%)
Mutual labels:  video-player, audio-player
tutorials-hg1
These tutorials demonstrate the usage of the Harfang API
Stars: ✭ 12 (-97.27%)
Mutual labels:  video-player, audio-player
Shaka Player
JavaScript player library / DASH & HLS client / MSE-EME player
Stars: ✭ 5,386 (+1126.88%)
Mutual labels:  video-player, playback
Multicast Relay
Relay multicast and broadcast packets between interfaces.
Stars: ✭ 111 (-74.72%)
Mutual labels:  chromecast, broadcast
Media player
An flutter media player to make media streaming apps effortlessly! read getting started tutorial on https://medium.com/@tamhanekar.siddhesh95/integrate-media-player-into-your-flutter-application-23040213f0c9
Stars: ✭ 45 (-89.75%)
Mutual labels:  video-player, audio-player
Mpv.net
🎞 mpv.net is a modern media player for Windows that works just like mpv.
Stars: ✭ 737 (+67.88%)
Mutual labels:  video-player, audio-player
shaka-player-react
A simple React component wrapper for shaka-player
Stars: ✭ 79 (-82%)
Mutual labels:  video-player, playback
Sbplayerclient
ζ”―ζŒε…¨ζ ΌεΌηš„macη‰ˆθ§†ι’‘ζ’­ζ”Ύε™¨
Stars: ✭ 110 (-74.94%)
Mutual labels:  video-player, audio-player
api.video-player-sdk
SDK to control and interact with the api.video HTML5 Player
Stars: ✭ 31 (-92.94%)
Mutual labels:  video-player, playback
Bettervideoplayer
Video playback on Android, made better in Kotlin, wrapping around the stock MediaPlayer API.
Stars: ✭ 266 (-39.41%)
Mutual labels:  video-player, playback
flex-originals
🎧 A video and audio streaming web application
Stars: ✭ 36 (-91.8%)
Mutual labels:  video-player, audio-player
Vue Plyr
A Vue component for the plyr (https://github.com/sampotts/plyr) video & audio player.
Stars: ✭ 531 (+20.96%)
Mutual labels:  video-player, audio-player
cast control
πŸ“Ί Control Chromecasts from Linux and D-Bus
Stars: ✭ 443 (+0.91%)
Mutual labels:  chromecast, playback
Chromecast mpris
πŸ“Ί Control Chromecasts from Linux and D-Bus
Stars: ✭ 413 (-5.92%)
Mutual labels:  chromecast, playback
Server
CasparCG Server is a Windows and Linux software used to play out professional graphics, audio and video to multiple outputs. It has been in 24/7 broadcast production since 2006. Ready-to-use downloads are available under the Releases tab https://casparcg.com.
Stars: ✭ 572 (+30.3%)
Mutual labels:  video-player, broadcast
Nymphcast
Audio and video casting system with support for custom applications.
Stars: ✭ 2,010 (+357.86%)
Mutual labels:  video-player, audio-player

dart_vlc

Flutter audio / video playback, broadcast & recording library for Windows & Linux.


Sponsored with πŸ’– by
Stream Chat

Rapidly ship in-app messaging with Stream's highly reliable chat infrastructure and feature-rich SDKs, including Flutter!

Try the Flutter Chat tutorial


Installation

pub.dev

dependencies:
  ...
  dart_vlc: ^0.1.9

GitHub

dependencies:
  dart_vlc:
    git:
      url: https://github.com/alexmercerind/dart_vlc.git
      ref: master

dependency_overrides:
  dart_vlc_ffi:
    git:
      url: https://github.com/alexmercerind/dart_vlc.git
      ref: master
      path: ffi

Feel free to open a new issue or discussion, if you found a bug or need assistance.

Documentation

Checkout Setup section to configure plugin on your platform.

Initialize the library.

void main() {
  DartVLC.initialize();
  runApp(MyApp());
}

Create a new player instance.

final player = Player(id: 69420);

For passing VLC CLI arguments, use commandlineArguments argument.

final player = Player(
  id: 69420,
  commandlineArguments: ['--no-video'],
);

Create a media for playback.

final file = Media.file(File('C:/music.mp3'));
final asset = Media.asset('assets/audio/example.mp3');
final network = Media.network('https://www.example.com/music.aac');

// Clip [Media] playback duration.
final media2 = Media.network(
  'https://www.example.com/music.aac',
  startTime: Duration(seconds: 20),
  stopTime: Duration(seconds: 60),
);

Create a list of medias using playlist.

final playlist = Playlist(
  medias: [
    Media.file(File('C:/music.mp3')),
    Media.file(File('C:/audio.mp3')),
    Media.asset('assets/audio/example.mp3'),
    Media.network('https://www.example.com/music.aac'),
  ],
);

Open a media or playlist into a player.

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

Control playback.

player.play();

player.seek(Duration(seconds: 30));

player.pause();

player.playOrPause();

player.stop();

Controls the playlist.

player.next();

player.previous();

player.jumpToIndex(10);

Manipulate an already playing playlist.

player.add(
  Media.file(File('C:/music0.mp3')),
);

player.remove(4);

player.insert(
  2,
  Media.file(File('C:/music0.mp3')),
);

player.move(0, 4);

Set playback volume & rate.

player.setVolume(0.5);

player.setRate(1.25);

Get & change playback device.

List<Device> devices = Devices.all;

player.setDevice(devices[0]);

Save the video screenshot

player.takeSnapshot(file, 1920, 1080);

Show the video inside widget tree.

Show Video in the Widget tree.

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Video(
        player: player,
        height: 1920.0,
        width: 1080.0,
        scale: 1.0, // default
        showControls: false, // default
      ),
    );
  }
}

By default, Video widget's frame size will adapt to the currently playing video. To override this & define custom video frame size, pass videoDimensions argument while instanciating Player class as follows.

Player player = Player(
  id: 69420,
  videoDimensions: const VideoDimensions(640, 360),
);

Change user agent.

player.setUserAgent(userAgent);

Retrieve metadata of media.

Media media = Media.network(
  'https://www.example.com/media.mp3',
  parse: true,
  timeout: Duration(seconds: 10),
);

Map<String, String> metas = media.metas;

Listen to playback events.

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

Listen to currently loaded media & playlist index changes.

player.currentStream.listen((CurrentState state) {
  state.index;
  state.media;
  state.medias;
  state.isPlaylist;
});

Listen to playback position & media duration.

player.positionStream.listen((PositionState state) {
  state.position;
  state.duration;
});

Listen to playback states.

player.playbackStream.listen((PlaybackState state) {
  state.isPlaying;
  state.isSeekable;
  state.isCompleted;
});

Listen to volume & rate of the Player.

player.generalStream.listen((GeneralState state) {
  state.volume;
  state.rate;
});

Listen to dimensions of currently playing Video.

player.videoDimensionsStream.listen((VideoDimensions video) {
  video.width;
  video.height;
});

Listen to buffering progress of the playing Media.

player.bufferingProgressStream.listen(
  (double event) {
    this.setState(() {
      this.bufferingProgress = event;
    });
  },
);

Set an equalizer.

Create using preset.

Equalizer equalizer = Equalizer.createMode(EqualizerMode.party);
player.setEqualizer(equalizer);

Create custom equalizer.

Equalizer equalizer = Equalizer.createEmpty();
equalizer.setPreAmp(10.0);
equalizer.setBandAmp(31.25, -10.0);
equalizer.setBandAmp(100.0, -10.0);
player.setEqualizer(equalizer);

Get equalizer state.

equalizer.preAmp;
equalizer.bandAmps;

Broadcast a media.

Broadcasting to localhost.

final broadcast = Broadcast.create(
  id: 0,
  media: Media.file(File('C:/video.mp4')),
  configuration: BroadcastConfiguration(
    access: 'http',
    mux: 'mpeg1',
    dst: '127.0.0.1:8080',
    vcodec: 'mp1v',
    vb: 1024,
    acodec: 'mpga',
    ab: 128,
  ),
);
broadcast.start();

Dispose the Broadcast instance to release resources.

broadcast.dispose();

Record a media.

final record = Record.create(
  id: 205,
  media: Media.network('https://www.example.com/streaming-media.MP3'),
  pathFile: '/home/alexmercerind/recording.MP3',
);
record.start();

Setup

Windows

Everything is already set up.

Linux

For using this plugin on Linux, you must have VLC & libVLC installed.

On Ubuntu/Debian:

sudo apt-get install vlc
sudo apt-get install libvlc-dev

On Fedora:

sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
sudo dnf install vlc
sudo dnf install vlc-devel

Support

Consider sponsoring this project. Maintenance of open-source software & libraries is severely under-paid or not paid at all.

Writing C++ & native code is a very tedious process.

Acknowledgements

  • BIG thanks to @jnschulze for his awesome contributions to this project & to the Flutter engine itself like adding texture support & adding macOS support here. I have learnt a lot about modern C++ & good-practices when writing code from you, thanks a lot for your guidances, reviews, work & donation. I'm really really thankful to you.

  • BIG thanks to @DomingoMG for adding Record and Chromecast classes. Also, thanks a lot for donation to the project & giving me motivation to start building this. I would've never attempted this if you didn't motivate me. And now that it started, dart_vlc has grown a lot.

  • Thanks to @tomassasovsky for adding visual controls to Video widget.

  • Thanks to following members of libVLC community (irrespective of the order) for giving general ideas about libVLC APIs:

  • Finally, thanks to the VideoLAN team for creating libVLC & libVLC++. Really great guys really great at their work.

Contributions

The code in the project is nicely arranged and follows the clean architecture.

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 [email protected].

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

Vision

There aren't any media (audio or video) playback libraries for Flutter or Dart 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 files from Flutter or Dart apps.

As the project has grown, awesome people from community have added support for iOS & macOS aswell.

Example

You can see an example project here.

dart_vlc running on Ubuntu Linux.

Features

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.
  • Event streams.
  • add/insert/remove/move Media inside Playlist during playback with no interruption.
  • Device enumeration & changing.
  • Retrieving metadata/tags of a Media.
  • Embedding Video inside the Flutter window (using texture or natively).
  • Supporting live streaming links.
  • Broadcast class for broadcasting Media.
  • Record class for recording Media.
  • Chromecast class.
  • Equalizer configuration & presets.
  • Changing user agent.
  • Changing Video's frame size according to video.
  • Saving screenshot of the video.
  • Changing/retrieving audio track.
  • Media clipping.
  • Support for Windows, Linux or macOS.

Under progress or planned features (irrespective of order)...

  • Bringing project on Android and iOS.
  • Removing libVLC++ dependency.
  • Subtitle control.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].