[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
  • 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
  • How to get videoDimissions when using NativeVideo widget

    How to get videoDimissions when using NativeVideo widget

    These codes work when using the Video widget, but they don't work when using the NativeVideo widget. player.videoDimensionsStream.listen((videoDimensions) { setState(() => this.videoDimensions = videoDimensions); }); what should i do?

    opened by yi0128 0
  • Window is black when using NativeVideo

    Window is black when using NativeVideo

    I am trying to play a H264 video from the assets folder using Native Video. The playbar is progressing but the screen is black. However, if I click on play button again after it finishes playing once, it opens up a new window called "VLC (Direct3D output)" and I can see the video playing well there.

    This is true if I use Media.file(...) or Media.asset(...) constructor.

    I need the video to play in the original window from the start.

    import 'package:dart_vlc/dart_vlc.dart';
    import 'package:flutter/material.dart';
    
    Future<void> main() async {
      await DartVLC.initialize(useFlutterNativeView: true);
      runApp(const MyApp());
    }
    
    class MyApp extends StatefulWidget {
      const MyApp({super.key});
    
      @override
      State<MyApp> createState() => _MyAppState();
    }
    
    class _MyAppState extends State<MyApp> {
      final videoPlayer = Player(id: 6940);
    
      @override
      void initState() {
        super.initState();
        videoPlayer.open(Media.asset("assets/videos/Circus.mp4"));
      }
    
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
            title: 'Native Video Test',
            home: Scaffold(
                body: NativeVideo(
                    showControls: true,
                    player: videoPlayer,
                    width: 1920,
                    height: 1080)));
      }
    }
    

    flutter doctor --verbose

    [√] Flutter (Channel stable, 3.3.2, on Microsoft Windows [Version 10.0.19044.2130], locale en-GB)
        • Flutter version 3.3.2 on channel stable at C:\src\flutter
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision e3c29ec00c (5 weeks ago), 2022-09-14 08:46:55 -0500
        • Engine revision a4ff2c53d8
        • Dart version 2.18.1
        • DevTools version 2.15.0
    
    [X] Android toolchain - develop for Android devices
        X Unable to locate Android SDK.
          Install Android Studio from: https://developer.android.com/studio/index.html
          On first launch it will assist you in installing the Android SDK components.
          (or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).
          If the Android SDK has been installed to a custom location, please use
          `flutter config --android-sdk` to update to that location.
    
    
    [√] Chrome - develop for the web
        • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
    
    [√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.3.4)
        • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
        • Visual Studio Community 2022 version 17.3.32901.215
        • Windows 10 SDK version 10.0.19041.0
    
    [!] Android Studio (not installed)
        • Android Studio not found; download from https://developer.android.com/studio/index.html
          (or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).
    
    [√] VS Code (version 1.72.2)
        • VS Code at C:\Users\<username>\AppData\Local\Programs\Microsoft VS Code
        • Flutter extension version 3.50.0
    
    [√] Connected device (3 available)
        • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.19044.2130]
        • Chrome (web)      • chrome  • web-javascript • Google Chrome 103.0.5060.134
        • Edge (web)        • edge    • web-javascript • Microsoft Edge 106.0.1370.47
    
    [√] HTTP Host Availability
        • All required HTTP hosts are available
    

    Operating system:

    • Platform: Windows
    • OS version: 10.0.19044 Build 19044

    Other details:

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

    Screenshots

    double-Window

    Possibly related to #275

    bug 
    opened by albrrt 1
  • Live Streaming URL is crashing the app after a few seconds of play

    Live Streaming URL is crashing the app after a few seconds of play

    Thanks Hitesh to you & all your team for sharing code of much sought windows flutter library. I would like your kind review/suggestion on an issue faced using the dart_vlc library. I have used the library in Flutter Windows Movies app to show both the network (URL based) movies and the live streaming contents. The dart_vlc player is working fine for the network hosted content however its not working for the live streaming contents. The player crashes while playing the live stream after a few seconds of play.

    Note: The internet connection is working fine for the same contents when played on the web browser & mobile app (using the better_player).

    The error screens of the player crash are also attached for your review and suggestion. Below is the code snippet used for playing the contents using the dart_vlc:

    import 'package:dart_vlc/dart_vlc.dart';
    import 'package:flutter/material.dart';
    import 'package:flutter_native_view/flutter_native_view.dart';
    import 'dart:ffi';
    import 'package:ffi/ffi.dart';
    import 'package:win32/win32.dart';
    
    class DartVLCPlayerWindows extends StatefulWidget {
      final playImage;
      final playURL;
      final title;
      final bool liveStream;
      DartVLCPlayerWindows({
        Key key,
        this.title,
        this.playImage,
        this.playURL,
        this.liveStream,
      }) : super(key: key);
    
      @override
      DartVLCPlayerWindowsState createState() => DartVLCPlayerWindowsState();
    }
    
    class DartVLCPlayerWindowsState extends State<DartVLCPlayerWindows> {
      final controller = NativeViewController(
        /// Using [FindWindow] from `package:win32` to retrieve `HWND` as [int].
        handle: FindWindow(nullptr, 'VLC Media Player'.toNativeUtf16()),
        /// Make the [NativeView] interactable.
        hitTestBehavior: HitTestBehavior.translucent,
      );
    
      Player videoPlayer = Player(
        id: 7,
        videoDimensions: VideoDimensions(640, 360),
        registerTexture: false
      );
    
    
      @override
      void initState() {
        loadVideoPlayer();
        setAudioTrack();
        super.initState();
      }
    
      loadVideoPlayer() {
        print(widget.playURL);
        videoPlayer.open(
            Media.network(widget.playURL),
            autoStart: true
        );
      }
    
      void setAudioTrack() async {
        await Future.delayed(const Duration(seconds: 10));
        videoPlayer.setAudioTrack(1);
      }
    
      @override
      void dispose() {
        videoPlayer.dispose();
        controller.dispose();
        super.dispose();
      }
    
      @override
      Widget build(BuildContext context) {
        return NativeVideo(
          player: videoPlayer,
          height: double.infinity,
          width: double.infinity,
          fit: BoxFit.contain,
          showControls: true,
          liveStream: widget.liveStream,
        );
      }
    }
    

    Screenshots Screenshot 2022-10-13 115328

    (below is the Debug screenshot.)

    Screenshot 2022-10-13 115737

    bug 
    opened by Qayoommaymon 0
Releases(v0.2.1)
  • 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

Бранимир Караџић 163 Nov 29, 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 97 Aug 9, 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 Nov 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 Nov 21, 2022
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 169 Nov 20, 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 Jun 2, 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 266 Nov 19, 2022
runcat system tray on Linux (using libappindicator)

runcat-tray Is a runcat port for Linux using libappindicator

Yongsheng Xu 20 Oct 31, 2022
Simple and efficient screen recording utility for Windows.

simple and efficient screen recording utility for Windows

Mārtiņš Možeiko 472 Nov 18, 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 24 Oct 18, 2022
Decompilation of 3D Pinball for Windows – Space Cadet

Decompilation of 3D Pinball for Windows – Space Cadet

Muzychenko Andrey 2.3k Nov 27, 2022
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 104 Nov 26, 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 Nov 24, 2022
An OCR Library based on PaddleOCR & OnnxRuntime

An OCR Library based on PaddleOCR & OnnxRuntime

Daniel 0 Mar 27, 2021