[WIP] A media playback library for Dart & Flutter apps on Windows & Linux. Based on libVLC & libVLC++.

Related tags

Graphics dart_vlc
Overview

dart_vlc

Bringing power of VLC to Flutter & Dart apps on Windows & Linux

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();

Manipulate playlist.

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

player.remove(4);

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

player.move(0, 4);

Set playback volume & rate.

player.setVolume(0.5);

player.setRate(1.25);

Get & change playback devices.

List<Device> devices = await Devices.all;

player.setDevice(
  devices[0],
);

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;
});

NOTE: For using this plugin on Linux, you must have libVLC installed. On debian based distros, run:

sudo apt-get install libvlc-dev

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.

Windows

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.
  • Working on Linux.
  • Working on Windows.
  • add/insert/remove/move Media inside Playlist during playback.
  • Device enumeration & changing.

Under progress (irrespective of order)...

  • Retrieving metadata of a file.
  • Embeding video inside the Flutter window.
  • FFI version of the library for plain Dart applications.
  • 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++.

Comments
  • Player::Open causes crash in release mode.

    Player::Open causes crash in release mode.

    I want to change video by click on each videos url.

    Player player = Player(id: 123); String url = 'http://company.com/video/1.mp4'; player.open( Media.network(url), );


    setState(() { url = 'https://flutter.github.io/assets-for-api-docs/assets/videos/bee.mp4'; });

    Thank you!

    bug critical 
    opened by huonsokly 35
  • `NativeVideo`: flickering under certain arrangements

    `NativeVideo`: flickering under certain arrangements

    Describe the bug Using the native video widget some times application crash(without showing any errors) and if it works the audio is playing correctly but with no output (black screen ) also a small window pops up in the center of the black screen and then disappers (doesent have text inside it from what i saw)

    Media

    both url and local files does the same bug

    Minimal reproducible code

    followed example code
    

    Flutter logs output is too long so i cant provide it

    [√] Flutter (Channel stable, 2.10.4, on Microsoft Windows [Version 10.0.19043.1586], locale en-US)
        • Flutter version 2.10.4 at G:\My Work HDD2\flutter
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision c860cba910 (2 weeks ago), 2022-03-25 00:23:12 -0500
        • Engine revision 57d3bac3dd
        • Dart version 2.16.2
        • DevTools version 2.9.2
    
    [√] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
        • Android SDK at C:\Users\zezo_\AppData\Local\Android\sdk
        • Platform android-31, build-tools 31.0.0
        • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
        • Java version OpenJDK Runtime Environment (build 11.0.11+9-b60-7590822)
        • All Android licenses accepted.
    
    [√] Chrome - develop for the web
        • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
    
    [√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.11.8)
        • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
        • Visual Studio Community 2019 version 16.11.32002.261
        • Windows 10 SDK version 10.0.19041.0
    
    [√] Android Studio (version 2021.1)
        • Android Studio at C:\Program Files\Android\Android Studio
        • Flutter plugin can be installed from:
           https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin can be installed from:
           https://plugins.jetbrains.com/plugin/6351-dart
        • Java version OpenJDK Runtime Environment (build 11.0.11+9-b60-7590822)
    
    [√] IntelliJ IDEA Community Edition (version 2021.3)
        • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2021.3
        • Flutter plugin can be installed from:
           https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin can be installed from:
           https://plugins.jetbrains.com/plugin/6351-dart
    
    [√] VS Code, 64-bit edition (version 1.65.2)
        • VS Code at C:\Program Files\Microsoft VS Code
        • Flutter extension can be installed from:
           https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
    
    [√] Connected device (3 available)
        • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.19043.1586]
        • Chrome (web)      • chrome  • web-javascript • Google Chrome 100.0.4896.75
        • Edge (web)        • edge    • web-javascript • Microsoft Edge 100.0.1185.29
    
    [√] HTTP Host Availability
        • All required HTTP hosts are available
    
    • No issues found!
    
    

    Operating system:

    • Platform: Windows.

    • OS version: Windows 10 21H1.

    • [x] I confirm this is not a bug in the VLC app & only dart_vlc.

    • [ ] I have donated / sponsored dart_vlc.

    Screenshots If applicable, add screenshots to help explain your problem. Otherwise, do nothing.

    Imported using

    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
    
    bug 
    opened by zezo357 23
  • Issue running in MacOS

    Issue running in MacOS

    Launching lib/main.dart on macOS in debug mode... lib/main.dart:1 Command CompileSwift failed with a nonzero exit code Command CompileSwift failed with a nonzero exit code CMake Error: The source directory "/Users/Mac15/Documents/Flutter Projects/sample flutter projects/sample_project/macos/Pods/projects/sample_project/macos/Flutter/ephemeral/.symlinks/plugins/dart_vlc/macos/deps" does not exist. Specify --help for usage, or press the help button on the CMake GUI. Command PhaseScriptExecution failed with a nonzero exit code Command CompileSwift failed with a nonzero exit code note: Using new build system note: Building targets in parallel note: Planning build note: Analyzing workspace note: Constructing build description note: Build preparation complete ** BUILD FAILED **

    question 
    opened by sanalkv 22
  • Missing file  “../include/vlcpp/vlc.hpp”: No such file or directory

    Missing file “../include/vlcpp/vlc.hpp”: No such file or directory

    C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(143,5): error MSB3073: 命令“setlocal [C:\Git\dasi-spd\build\windows\plugins\dart_vlc\LIBVLC_EXTRACT.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(143,5): error MSB3073: cd C:\Git\dasi-spd\windows\flutter\ephemeral.plugin_symlinks\dart_vlc\windows\bin [C:\Git\dasi-spd\build\windows\plugins\dart_vlc\LIBVLC_EXTRACT.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(143,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd [C:\Git\dasi-spd\build\windows\plugins\dart_vlc\LIBVLC_EXTRACT.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(143,5): error MSB3073: C: [C:\Git\dasi-spd\build\windows\plugins\dart_vlc\LIBVLC_EXTRACT.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(143,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd [C:\Git\dasi-spd\build\windows\plugins\dart_vlc\LIBVLC_EXTRACT.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(143,5): error MSB3073: "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -E tar xzf "C:/Git/dasi-spd/windows/flutter/ephemeral/.plugin_symlinks/dart_vlc/windows/bin/vlc-3.0.9.2.7z" [C:\Git\dasi-spd\build\windows\plugins\dart_vlc\LIBVLC_EXTRACT.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(143,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd [C:\Git\dasi-spd\build\windows\plugins\dart_vlc\LIBVLC_EXTRACT.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(143,5): error MSB3073: "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -E tar xzf "C:/Git/dasi-spd/windows/flutter/ephemeral/.plugin_symlinks/dart_vlc/windows/bin/libvlcpp.zip" [C:\Git\dasi-spd\build\windows\plugins\dart_vlc\LIBVLC_EXTRACT.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(143,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd [C:\Git\dasi-spd\build\windows\plugins\dart_vlc\LIBVLC_EXTRACT.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(143,5): error MSB3073: "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -E copy_directory C:/Git/dasi-spd/windows/flutter/ephemeral/.plugin_symlinks/dart_vlc/windows/bin/vlc-3.0.9.2/sdk/include/vlc C:/Git/dasi-spd/windows/flutter/ephemeral/.plugin_symlinks/dart_vlc/windows/include/vlc [C:\Git\dasi-spd\build\windows\plugins\dart_vlc\LIBVLC_EXTRACT.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(143,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd [C:\Git\dasi-spd\build\windows\plugins\dart_vlc\LIBVLC_EXTRACT.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(143,5): error MSB3073: "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -E copy_directory C:/Git/dasi-spd/windows/flutter/ephemeral/.plugin_symlinks/dart_vlc/windows/bin/libvlcpp-master/vlcpp C:/Git/dasi-spd/windows/flutter/ephemeral/.plugin_symlinks/dart_vlc/windows/include/vlcpp [C:\Git\dasi-spd\build\windows\plugins\dart_vlc\LIBVLC_EXTRACT.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(143,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd [C:\Git\dasi-spd\build\windows\plugins\dart_vlc\LIBVLC_EXTRACT.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(143,5): error MSB3073: :cmEnd [C:\Git\dasi-spd\build\windows\plugins\dart_vlc\LIBVLC_EXTRACT.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(143,5): error MSB3073: endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone [C:\Git\dasi-spd\build\windows\plugins\dart_vlc\LIBVLC_EXTRACT.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(143,5): error MSB3073: :cmErrorLevel [C:\Git\dasi-spd\build\windows\plugins\dart_vlc\LIBVLC_EXTRACT.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(143,5): error MSB3073: exit /b %1 [C:\Git\dasi-spd\build\windows\plugins\dart_vlc\LIBVLC_EXTRACT.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(143,5): error MSB3073: :cmDone [C:\Git\dasi-spd\build\windows\plugins\dart_vlc\LIBVLC_EXTRACT.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(143,5): error MSB3073: if %errorlevel% neq 0 goto :VCEnd [C:\Git\dasi-spd\build\windows\plugins\dart_vlc\LIBVLC_EXTRACT.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(143,5): error MSB3073: :VCEnd”已退出,代码为 1。 [C:\Git\dasi-spd\build\windows\plugins\dart_vlc\LIBVLC_EXTRACT.vcxproj] Exception: Build process failed.

    question 
    opened by yiky84119 22
  • Player: Add a new option to the open method

    Player: Add a new option to the open method

    It would be interesting to incorporate a variable called start at.

    player.open(
      Media.file(File('C:/music0.mp3')),
      autoStart: true, // default,
      startAt: Duration(minutes: 1, seconds: 30) // optional
    );
    
    enhancement 
    opened by DomingoMG 19
  • Video Widget: setState being called after being dismounted from Widget tree.

    Video Widget: setState being called after being dismounted from Widget tree.

    I'm using this package for streaming multiple cameras on a page of my Flutter App. With the new version (0.0.8) I'm facing a problem, I see all the images of the Players in a single Video, but in my code I create more than one Video. With the old version (0.0.7) I haven't this problem and the code was the same, with the asyncand the awaitcalls obviously.

    Below there is the code of my Streaming page:

    class CameraScreen extends StatefulWidget {
      CameraScreen(
          {required Key key,
          required this.onPageChange,
          required this.onLogout,
          required this.id})
          : super(key: key);
      final Function(String, String) onPageChange;
      final VoidCallback onLogout;
      final String id;
      @override
      CameraScreenState createState() => CameraScreenState();
    }
    
    class CameraScreenState extends State<CameraScreen>
        with TickerProviderStateMixin {
      PageConfig pageConfig = PageConfig();
      String project = '';
      List<ResponsiveGridCol> children = [];
      List<Player> players = [];
      List<dynamic> items = [];
      double initialSliderValue = 0;
    
    
      @override
      void initState() {
        DartVLC.initialize();
    
        project = Project.getCurrentProject();
        pageConfig = Project.getProjectPageDetails(widget.id);
        getData();
        super.initState();
      }
    
      @override
      void dispose() {
        stopAndDisposePlayers();
        super.dispose();
      }
    
      @override
      Widget build(BuildContext context) {
        return CustomScaffold(
          text: pageConfig.name!,
          onPageChange: widget.onPageChange,
          onLogout: widget.onLogout,
          body: Padding(
            padding: const EdgeInsets.all(8.0),
            child: SingleChildScrollView(
              child: ResponsiveGridRow(
                children: children,
              ),
            ),
          ),
        );
      }
    
      void getData() {
        File cameraFile = File(AppStrings.CONFIG_DIRECTORY_PATH +
            project +
            AppStrings.CAMERA_CONFIG_FILE_NAME);
        items = jsonDecode(cameraFile.readAsStringSync());
        List<Video> videos = [];
        List<ResponsiveGridCol> widgets = [];
        for (int i = 0; i < items.length; i++) {
          var cameraConfig = Camera.fromJson(items[i]);
          Player player = Player(id: 100 + i, videoWidth: 400, videoHeight: 300);
          var media = Media.network(cameraConfig.url,
              parse: true, timeout: Duration(seconds: 2));
          player.open(media);
          player.play();
          players.add(player);
          var video = Video(
            playerId: 100 + i,
            width: 500,
            height: 375,
            showControls: false,
          );
          videos.add(video);
          widgets.add(
            ResponsiveGridCol(
              lg: 6,
              child: Card(
                child: Column(
                  children: [
                    Text(cameraConfig.title, style: AppStyles.BOLD),
                    Text(AppStrings.CAMERAS_TEXT),
                    video,
                    Divider(),
                    IconButton(
                      icon: Icon(Icons.open_in_browser),
                      onPressed: () {
                      },
                    )
                  ],
                ),
              ),
            ),
          );
        }
        for (var item in videos) {
          print(item.playerId);
        }
        if (mounted) {
          setState(() {
            children = widgets;
          });
        }
      }
    
    
      void stopAndDisposePlayers() {
        for (var player in players) {
          player.stop();
          player.dispose();
        }
      }
    }
    
    bug enhancement improvement 
    opened by MattiaudaNicolasCN 18
  • [only-video] High CPU Usage (in Windows)

    [only-video] High CPU Usage (in Windows)

    Running even the simple example app seems to cause high CPU usage and very high power usage.

    When playing: image

    When paused: image

    Comparing to VLC:

    When playing: image

    Comparing to MPV:

    When playing: image

    Honestly the usages of vlc and the app is very similar when considering only the player but an average should not use this much of resources for just video playback. Comparatively MPV seems to use very less amount of resources. The gap between 8% / 22% and 42% is just too much. My average app seems to use nearly 62% CPU which is just too much when someone is multitasking.

    enhancement improvement 
    opened by zyrouge 15
  • Loop media

    Loop media

    Hi,

    first of thanks for the awesome package!

    So, my problem is that I'm trying to loop a playlist. I've tried playlistMode, but when i add playlistMode: PlaylistMode.loop it gives me Undefined name 'PlaylistMode'.

    Would be great if you could look into it or have a solution.

    bug 
    opened by jonafeucht 14
  • Example App Not Working on MX Linux (Ubuntu based)

    Example App Not Working on MX Linux (Ubuntu based)

    I installed libvlc-dev (version 3.0.12-1~mx19+1) and included the library on my pubspec.yaml file. When I try to run the application i get this error:

    Launching lib/main.dart on Linux in debug mode...  
    clang: error: linker command failed with exit code 1 (use -v to see invocation)  
    Exception: Build process failed  
    Exited (sigterm)
    
    documentation question 
    opened by tomassasovsky 14
  • Bad performance in Windows 10

    Bad performance in Windows 10

    I'm working on a Flutter Windows application. When I'm trying to play multiple short audio files in a short succession the whole UI becomes very laggy and causes lag spikes. Sometimes the UI remains unresponsive until the sound playback finishes. Am I doing something wrong?

    The code looks something like this:

    // initilitzing the player
    Player soundPlayer = Player(id: 0, commandlineArguments: ['--no-video']);
    
    // method that plays a sound
    void playSound(String sound) {
        soundPlayer?.open(Media.asset(sound), autoStart: true);
    }
    

    Steps to reproduce: call playSound() multiple times in short succession (i.e. on a button click).

    Tested with:

    flutter 2.10.4
    dart_vlc: ^0.1.9
    dart_vlc_ffi: ^0.1.5+1
    windows 10
    
    invalid 
    opened by gkovac42 13
  • Fix: Create new texture when video frame size is changed.

    Fix: Create new texture when video frame size is changed.

    [WIP]

    • Add VideoResizeCallback to Player::OnVideo listener, to get callback ahead of buffer reallocation (if the frame size is changed).
    • Now PlayerRegisterTexture & PlayerUnregisterTexture are renamed to PlayerCreateVideoOutlet & PlayerDeleteVideoOutlet.
    • Now method channel call no longer creates texture ahead of time, but when first frame of the video is received.
    • If a new media of different video dimensions is opened, the previous texture is deleted & new is created (VideoOutlet::CreateNewTexture), whose texture ID is notified through the method channel.
    • Currently UnregisterTexture is causing exception (from VideoOutlet::DeleteTexture).
      • Not sure about the reason.
      • Although I'm sure that I'm NOT deleting the texture ID which was never created.

    Screenshot 2021-08-25 171022

    opened by alexmercerind 13
  • Loop a video with unusual pause intervals.

    Loop a video with unusual pause intervals.

    Because the video is as seamless as a gif. Introduce a video through this package and then set it to loop. There will be a noticeable pause before and after the switch.

    Here is a demo of the video.

    Honeycam 2022-12-13 03-51-11

    https://user-images.githubusercontent.com/13862699/207139591-e22e9ce6-b277-4fcd-ad44-366118c218b3.mp4

    bug 
    opened by ismanong 0
  • Unable to load audio files from /storage/emulated/0 and its sub-directories

    Unable to load audio files from /storage/emulated/0 and its sub-directories

    This plugin no more is able to load audio files from /storage/emulated/0 and its sub-directories . The error status is: LateError (LateInitializationError: Field 'dynamicLibrary')

    **Plugin version: dart_vlc: ^0.1.9 **

    Operating system: Tested on: Android OS emulator and the project was running on Parrot Security OS .

    Kindly, check .

    bug 
    opened by Farial-mahmod 1
  • ignore compile for unsupported platform

    ignore compile for unsupported platform

    how i can ignore compile lib for web?

    i check platform in my dart code and for Linux all ok. but for web see this:

    Launching lib/main.dart on Chrome in debug mode...
    Waiting for connection from debug service on Chrome...
    ../../.pub-cache/hosted/pub.dartlang.org/dart_vlc_ffi-0.2.0+1/lib/src/internal/ffi.dart:1:8: Error: Not found: 'dart:ffi'
    import 'dart:ffi';
           ^
    ../../.pub-cache/hosted/pub.dartlang.org/dart_vlc_ffi-0.2.0+1/lib/src/internal/dynamiclibrary.dart:1:8: Error: Not found: 'dart:ffi'
    import 'dart:ffi';
           ^
    ../../.pub-cache/hosted/pub.dartlang.org/dart_vlc_ffi-0.2.0+1/lib/src/internal/typedefs/player.dart:1:8: Error: Not found: 'dart:ffi'
    import 'dart:ffi';
           ^
    ../../.pub-cache/hosted/pub.dartlang.org/dart_vlc_ffi-0.2.0+1/lib/src/internal/typedefs/media.dart:1:8: Error: Not found: 'dart:ffi'
    import 'dart:ffi';
           ^
    Failed to compile application.
    
    
    bug 
    opened by Nightwelf 0
  • Video: Hardware Acceleration

    Video: Hardware Acceleration

    How is current video rendering?

    Currently, whenever you show a video using Video widget from package:dart_vlc, it produces redundant load on your CPU. It is because every frame is copied from GPU back to RAM through CPU for rendering inside Flutter i.e. no hardware-acceleration. This load on CPU increases significantly with higher resolution or higher FPS videos.

    This still works fine -ish with 720p videos (bearable CPU load).

    What is hardware acceleration?

    From Google:

    Hardware acceleration is the use of computer hardware designed to perform specific functions more efficiently when compared to software running on a general-purpose central processing unit.

    Playing a video should make use of dedicated hardware i.e. GPU (and not CPU). CPU is for general-purpose computation, not copying frames/buffers or rendering things efficiently. As discussed above, since every video frame is copied from GPU back to RAM through CPU for rendering inside Flutter, redundant CPU load is seen. This also increases the power usage (battery consumption).

    Currently, 720p videos result in bearable CPU load & work fine -ish. Higher than that, high CPU usage.

    NOTE: If you are showing the Video in a small part of the UI, you can limit the dimensions of each frame manually. This will reduce CPU usage & give you finer control to tweak the performance.

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

    Why is hardware acceleration not supported (yet)?

    First of all, because this is way too complex to be part of someone's hobby. A funding is necessary here.

    Both, due to Flutter & libVLC's limitations at that time.

    When & how will be hardware accelerated video playback implemented?

    Fortunately, package:dart_vlc & my work in this regard is now sponsored by Stream.

    This is a concern for Windows & Linux currently. Scope of work may be increased as required, however package:video_player already seems to have hardware acceleration. Maybe I will add support to package:video_player itself at some point.


    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


    I made a POC implementation (posted on my Twitter) showing hardware-accelerated video rendering inside Flutter. It is using libmpv & ANGLE based Direct3D & open-gl interop. Notice minimal CPU 2 % - 5% usage. Slight usage can still be seen due to logging/flushing etc. for debugging. It will be improved. Same would have caused about 20-25% with package:dart_vlc (even more with higher resolution & FPS videos).

    I have decided to use libmpv because it has API for rendering video output using open-gl. Since, this package has everything specifically around VLC, it makes no sense to work on it here.

    Thus, expect a new package really-really soon with hardware accelerated video playback. Other than just hardware-accelerated video embedding, it has things like metadata / tags reader, shifting support, pitch shifting, volume boost, dynamic playlists & native OS controls etc. out-of-the-box along-side basic features. Audio-only support is ready & used in Harmonoid: A Material Design-led music player to play & manage music library. Most importantly: It is far smaller in size compared to package:dart_vlc, stable & even supports Windows 7.

    Switching to libmpv does not mean that I do not like VLC or the awesome work that developers have done on it. It is still the best of best (& my preferred) media player, which I have installed on every device I own. However, from the library / plugin standpoint, I'm not quite satisfied.

    https://user-images.githubusercontent.com/28951144/196414122-9e860a3b-df85-4352-96a3-1a5dbfaca4c4.mp4


    Thanks!


    You may subscribe to the issue for updates.

    improvement critical 
    opened by alexmercerind 1
  • Is it possibile to customize buffering?

    Is it possibile to customize buffering?

    Hi @alexmercerind, as the title suggests, I wanted to know if it is possible to perform a custom buffering.

    In particular I need to be able to perform a sequential fetching in different qualities from my CDN. I must therefore do a fetch to a different url (qualities) keeping the buffering already performed and passing as parameters the starting bytes and ending bytes to be buffered over.

    The desired behavior is like loading an m3u playlist made up of several "controllable" .ts files.

    I wanted to ask if this exists or it is possible to create a loading function like Media.stream

    Thanks again for your contribution!

    opened by 0Franky 6
Releases(v0.4.0)
  • v0.4.0(Nov 30, 2022)

    • Bumped ffi to 2.0.1.
    • Fixed locking of VLC::MediaList during modification.
    • Upgraded libVLC to 3.0.17.4.
    • BREAKING CHANGE: Discontinued NativeVideo implementation for Windows.
    Source code(tar.gz)
    Source code(zip)
  • v0.2.1(May 25, 2022)

    • Fixed switch case directShow control (@Paradoxu).
    • Addressed few issues related to NativeVideo on Windows (@alexmercerind).
    • Fixed Bump flutter_native_view and window_manager to latest versions (@ashutosh2014, @alexmercerind).

    BREAKING CHANGE

    If you're using NativeVideo in your application, you'll need changes in your windows/runner/main.cpp file, as required by the flutter_native_view. Learn more about this here.

    Source code(tar.gz)
    Source code(zip)
  • v0.2.0(May 5, 2022)

    This new release of dart_vlc includes:

    • Addressed multiple Dart-sided memory leaks during FFI interop (@alexmercerind).
    • Introduce NativeVideo for Windows to render video playback performantly (uses flutter_native_view) (@alexmercerind).
    • Refactor native source code, move implementations to separate translation units & remove inline class methods (@alexmercerind).
    • Fix Video rendering when explicit VideoDimensions are passed (@alexmercerind).
    • Expose Player::SetHWND (@alexmercerind).
    • Added showFullscreenButton to Video widget (disabled by default) (@alexmercerind).
    Source code(tar.gz)
    Source code(zip)
  • v0.1.8(Sep 29, 2021)

    This new release of dart_vlc includes:

    • Added startTime and stopTime parameters to Media for clipping (@alexmercerind). (#126)
    • Added Player.bufferingProgress & Player.bufferingProgressStream to listen to buffering percentage of the player (@alexmercerind). (#162)
    • Video widget no longer turns black after being scrolled out of the view (@alexmercerind). (#142)
    • Now Linux uses texture registrar API for performant video playback (@alexmercerind) (💥 REQUIRES Flutter master channel presently).
    • Now macOS uses texture registrar API for performant video playback (@jnschulze).
    • Initial work on iOS support has been started (@krjw-eyev).
    Source code(tar.gz)
    Source code(zip)
  • v0.1.7(Aug 25, 2021)

    This new release of dart_vlc includes:

    • Fixed Player.open (OnOpen event) randomly causing crash in release mode on Windows. (#124 & #136)
    • Using constant frame buffer size until #137 is resolved.
    Source code(tar.gz)
    Source code(zip)
  • v0.1.6(Aug 22, 2021)

    This new release of dart_vlc includes:

    • A hotfix update to fix a critical bug.
    • Fixed a critical bug that resulted in a crash upon opening more than one Media in Playlist (apologies).
    • Implemented media and playlist equality operators. (Thanks to @jnschulze).
    • Added Player.takeSnapshot to save snapshot of a playing video.
    Source code(tar.gz)
    Source code(zip)
  • v0.1.5(Aug 19, 2021)

    This new release of dart_vlc fixes & adds:

    • Added initial macOS support. (Thanks to @jnschulze).
    • Improved NativePort callbacks & removed unnecessary serialization.
    • Now using a common dartvlc wrapper CMake library for all platforms. (Thanks to @jnschulze).
    • Other bug-fixes related to Video playback on Windows. (Thanks to @jnschulze).
    • Setup garbage cleaning finalizers for memory allocated on heap (for C++/Dart FFI communication).
    • Removed deprecated libVLC API calls.
    Source code(tar.gz)
    Source code(zip)
  • v0.1.4(Aug 16, 2021)

    This new release of dart_vlc adds & fixes:

    • Now Player no longer requires videoWidth & videoHeight to be passed for video playback.
    • Video widget now uses the dimensions of the currently playing video.
    • For overriding the automatic video dimensions retrieval, videoDimensions argument must be passed while instantiating Player class.
    • Video widget no longer asks for playerId argument, but player instead.
    • Added videoDimensionStream and videoDimension attributes to Player class to listen to currently playing video dimensions.
    • Migrated C++ code to use smart pointers instead of raw pointers.
    • Player.dispose no longer causing crash on Windows (#103).
    • Added Add fit and alignment properties to Video widget (Thanks to @jnschulze).
    Source code(tar.gz)
    Source code(zip)
  • v0.1.3(Aug 11, 2021)

  • v0.1.2(Aug 10, 2021)

    This new release of dart_vlc fixes & adds:

    • Now using flutter::TextureRegistrar for performant Video playback on Windows. (#54) (Thanks to @jnschulze).
    • Fixed autoStart in Player.open.
    • Fixed other crashes for Windows.
    • Improved stability.
    Source code(tar.gz)
    Source code(zip)
  • v0.1.1(Aug 5, 2021)

    This new release of dart_vlc fixes & adds:

    • Fixed setState being called after dispose (#75) (Finally)
    • Improved memory management.
    • Fixed ton of memory leaks.
    • Fixed Devices::all & Media::parse causing crash on Windows.

    Source code(tar.gz)
    Source code(zip)
  • v0.1.0(Jul 27, 2021)

    This new release of dart_vlc fixes:

    • Fixed build on Linux. (#83)
    • Changed cmake minimum required version to 3.10 for fixing use with snap installation. (#71 #81)
    • Fixed few memory leaks. (#80)
    • Fixed calling setState after dispose & other Video widget issues. (#69 #75)
    Source code(tar.gz)
    Source code(zip)
  • v0.0.9(Jul 7, 2021)

    This new release of dart_vlc fixes following issues:

    • Fixed multiple Video widgets not working after FFI migration. (No playerId was being sent along frame buffer through NativePort)
    • Now package contains complete libVLC & libVLC++ source inside.
      • No longer fetching from videoLAN & GitHub servers required.
      • No more build errors for developers in China.
    • Fixed Player::setPlaylistMode.
    • Fixed built-in play/pause button in Video widget.
    • Added back Media.asset for Flutter.
    Source code(tar.gz)
    Source code(zip)
  • v0.0.8(Jul 5, 2021)

    This release of dart_vlc adds:

    • Now using FFI (instead of Platform channels).
    • Better performance, being direct C++ <-> Dart interop with no Flutter involvement.
    • Added Equalizer class.
    • Support for Dart CLI. See package dart_vlc_ffi.
    • Added commandlineArguments to Player constructor to pass VLC commandline arguments.
    • BREAKING CHANGES
      • Now plugin requires initialization in the main method, call DartVLC.initialize() to instantiate the plugin.
      • Now all the methods are synchronous & no longer require await. Please update your code.

    A lot of code has been refactored & complete functionality is nearly written from scratch, there can be many issues. Feel free to report.

    Thankyou.

    Source code(tar.gz)
    Source code(zip)
  • v0.0.7(May 9, 2021)

    This new release of dart_vlc adds:

    • Added Player.setUserAgent.
    • Improved & fixed issues related to play/pause button in Video widget.
    • Fixed compilation issues on arch linux.
    • Fixes to device changing.
    Source code(tar.gz)
    Source code(zip)
  • v0.0.6(Apr 29, 2021)

    This new release of dart_vlc adds:

    • Now Player class has sync constructor & no longer needs Player.create.
    • Fixed memory leaks on Windows & Linux.
    • Added controls to Video widget. Thanks to @tomassasovsky.
    • Added Record class for recording media. Thanks to @DomingoMG.
    • Added Chromecast class. Thanks to @DomingoMG.
    • Fixed Player.setPlaylistMode on Linux.
    • Event streams inside Player no longer can be null.
    Source code(tar.gz)
    Source code(zip)
  • v0.0.5(Apr 24, 2021)

  • v0.0.4(Apr 2, 2021)

    This new release of dart_vlc adds:

    • Video Widget for showing video output from a Player inside Widget tree.
      • Player must be used as a controller for a Video.
      • Initialize Player with videoHeight and videoWidth optional parameters, if you wish to use it for video playback.
    • Null-safety migration.
    Source code(tar.gz)
    Source code(zip)
  • v0.0.3(Mar 24, 2021)

    This new release of dart_vlc adds:

    • More advanced playlist modification methods like:
      • add for appending a new Media to the Playlist of the Player.
      • remove for removing a Media from the Playlist of the Player from certain index.
      • insert method for inserting Media to certain index.
      • move a Media from one index to another.
    • Ability to get all playback Devices on machine & change.
      • Devices.all gives List of all Devices.
      • Player.setDevice can be used to set a playback device for the Player instance.
    • Ability to retrieve metadata of a Media (either from Media.network or Media.file).
      • Now you can access metadata of a Media by passing parse: true for parsing the metadata.
      • Retrieved metadata is stored inside Media.metas as Map<String, String>.
    • Now event streams are splitted into four:
      • Player.currentStream
        • Contains:
          • index
          • media
          • medias
          • isPlaylist
      • Player.positionStream
        • Contains:
          • position
          • duration
      • Player.playbackStream
        • Contains:
          • isPlaying
          • isSeekable
          • isCompleted
      • Player.generalStream
        • Contains:
          • volume
          • rate
    • Thanks to @DomingoMG for thorough testing.
    Source code(tar.gz)
    Source code(zip)
  • v0.0.2(Mar 17, 2021)

    This new release of dart_vlc adds:

    • Support for Flutter on Linux.
    • Fixed bug that caused index to not update properly in Playlist, when next or back or on completion of Media.
    • Changed default Player volume to 0.5.
    Source code(tar.gz)
    Source code(zip)
  • v0.0.1(Mar 16, 2021)

    This first release of dart_vlc adds:

    • 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.
    Source code(tar.gz)
    Source code(zip)
Owner
Hitesh Kumar Saini
An 18 year old. Loves Flutter & React.js! Writes C++, JS, Python & Dart. Likes writing general purpose libraries. UI design enthusiast.
Hitesh Kumar Saini
Deno gl - WIP Low-level OpenGL (GLFW) bindings and WebGL API implementation for Deno.

deno_gl WIP Low-level OpenGL (GLFW) bindings and WebGL API implementation for Deno. Building Make dist directory if it doesn't exist. Build gl helper

DjDeveloper 14 Jun 11, 2022
Metal-cpp is a low-overhead C++ interface for Metal that helps developers add Metal functionality to graphics apps, games, and game engines that are written in C++.

About metal-cpp is a low overhead and header only C++ interface for Metal that helps developers add Metal functionality to graphics applications that

Бранимир Караџић 164 Dec 31, 2022
WebGL Texture plugin for Flutter

So far there is no way to render 3D objects efficiently in Flutter. Also directly accessing and programming the GPU from Dart isn't supported yet. This plugin shall close this gap.

null 99 Dec 14, 2022
A simple animation challenge made with Flutter

Slide Show - Flutter Getting Started This project is a starting point for a Flutter application. A few resources to get you started if this is your fi

Pedro Massango 24 Dec 2, 2021
Flutter package that lets you simply animate a widget into a visible state.

Entry This Flutter package introduces a new widget : Entry. It lets you simply animate a widget into a visible state. Don't just display widgets : mak

Mickaël Hernandez 25 Aug 14, 2022
Utility on top of the Flutter Driver API that facilitates measuring the performance of your app in an automated way created by Very Good Ventures 🦄

Very Good Performance Developed with ?? by Very Good Ventures ?? Utility on top of the Flutter Driver API that facilitates measuring the performance o

Very Good Open Source 80 Dec 22, 2022
Pencil2D is an animation/drawing software for Windows, macOS, Linux, and FreeBSD.

Pencil2D is an animation/drawing software for Windows, macOS, Linux, and FreeBSD. It lets you create traditional hand-drawn animation (cartoon) using both bitmap and vector graphics. Pencil2D is free and open source.

Pencil2D 1.2k Jan 7, 2023
Alpha Plot is a free application for Scientific Data Analysis and Visualization for Windows, Linux and Mac OS X

Alpha Plot is a free application for Scientific Data Analysis and Visualization for Windows, Linux and Mac OS X (probably BSD also). Web Link Website

Arun Narayanankutty 171 Dec 26, 2022
physically based renderer written in DX12 with image-based lighting, classic deffered and tiled lighting approaches

Features Classical Deferred Renderer Physically Based shading Image Based Lighting BRDF Disney model (Burley + GGX) Tangent space normal mapping Reinh

Alena 35 Dec 13, 2022
Linux/X11 tool for intercepting mouse events and executing commands. Written in Kotlin Native.

XMG XMG (X11 Mouse Grabber) is a Linux/X11 tool for intercepting mouse button press events and triggering actions. It's a way of making use of the ext

Eduardo Fonseca 12 Sep 11, 2021
OBS Linux Vulkan/OpenGL game capture

OBS Linux Vulkan/OpenGL game capture OBS plugin for Vulkan/OpenGL game capture on Linux. Requires OBS with EGL support (currently unreleased, you need

David Rosca 290 Jan 1, 2023
runcat system tray on Linux (using libappindicator)

runcat-tray Is a runcat port for Linux using libappindicator

Yongsheng Xu 19 Dec 20, 2022
Simple and efficient screen recording utility for Windows.

simple and efficient screen recording utility for Windows

Mārtiņš Možeiko 484 Dec 31, 2022
Paint program for Unix. Inspired by MS Paint (Windows 95-98).

Classic Colors Classic Colors is a simple and efficient paint program for Unix systems, inspired by MS Paint (Windows 95-98 version). It is built on t

Justin Meiners 25 Dec 9, 2022
Decompilation of 3D Pinball for Windows – Space Cadet

Decompilation of 3D Pinball for Windows – Space Cadet

Muzychenko Andrey 2.4k Jan 9, 2023
Android port of 3D Pinball for Windows – Space Cadet

SpaceCadetPinball Android port of 3D Pinball for Windows – Space Cadet Based on: https://github.com/k4zmu2a/SpaceCadetPinball TODO Add proper controls

Iscle 108 Dec 31, 2022
This repo will sort of document my story of learning vulkan with VulkanSDK and cl (msvc) on windows.

Learning Vulkan This repo is a means of documenting my journey with learning Vulkan's basics on windows. Because of the binaries in the LunarG VulkanS

null 2 Dec 8, 2021
This repo contains the DirectX Graphics samples that demonstrate how to build graphics intensive applications on Windows.

DirectX-Graphics-Samples This repo contains the DirectX 12 Graphics samples that demonstrate how to build graphics intensive applications for Windows

Microsoft 4.9k Dec 26, 2022
An OCR Library based on PaddleOCR & OnnxRuntime

An OCR Library based on PaddleOCR & OnnxRuntime

Daniel 0 Mar 27, 2021