🎡 A cross-platform media playback library for C/C++ with good number of features (only Windows & Linux).

Last update: Jul 24, 2022

libwinmedia

A cross-platform media playback library for C/C++ & Flutter with good number of features.

Example

A very simple example can be as follows.

C++

#include "libwinmedia/libwinmedia.hpp"

int32_t main(int32_t ac, const char** av) {
  using namespace std;
  using namespace lwm;
  if (ac < 2) {
    cout << "No URI provided.\n"
         << "Example Usage:\n" << av[0]
         << " file://C:/alexmercerind/music.mp3\n" << av[0]
         << " https://alexmercerind.github.io/video.mp4\n";
    return EXIT_FAILURE;
  }
  auto player = Player(0);
  auto media = Media(av[1]);
  player.Open(vector<Media>{media});
  player.Play();
  player.events()->Position([](int32_t position) -> void {
    cout << "Current playback position is " << position << " ms.\n";
  });
  cin.get();
  return EXIT_SUCCESS;
}

Flutter

More about Flutter here or on the pub.dev.

dependencies:
  ...
  libwinmedia: ^0.0.1
import 'package:libwinmedia/libwinmedia.dart';

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

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

Bindings

  • just_audio: Cross platform audio playback library for Flutter, working on Android, iOS, macOS, Windows, Linux & Web.
  • libwinmedia-py: libwinmedia bindings for Python.
  • libwinmedia.dart: libwinmedia bindings for Flutter.

Support

Consider supporting the project by starring the repository or buying me a coffee.

Thanks a lot for your support.

Documentation

Setup

For using the library on Windows, you can download the pre-compiled shared library from the releases page & headers can be found here.

Usage

Create a new player.

Player player = Player(0);

Create a media to open inside player.

Media media = Media("file://C:/alexmercerind/music.mp3");
int32_t duration = media.duration();

Play the medias.

player.Open(std::vector<lwm::Media>{media});

Control playback.

player.Play();

player.Pause();

player.SetVolume(0.69);

player.SetRate(1.2);

player.Seek(10000);

player.SetIsLooping(false);

player.SetAudioBalance(1.0);

Listen to playback events.

player.events()->Position(
  [=](int position) -> void {}
);

player.events()->Duration(
  [=](int duration) -> void {}
);

player.events()->Rate(
  [=](float rate) -> void {}
);

player.events()->Volume(
  [=](float volume) -> void {}
);

player.events()->IsPlaying(
  [=](bool isPlaying) -> void {}
);

// Other events.

Create native system media controls.

Pass function as argument to receive event callbacks.

auto controls = lwm::NativeControls(
  [](auto button) -> void {
    if (button == NativeControlsButton::Play) std::cout << "Play clicked.\n";
    if (button == NativeControlsButton::Pause) std::cout << "Pause clicked.\n";
  }
);

Update the native system media controls.

controls.Update(
  std::make_shared<lwm::MusicNativeControlState>(
    "album_artist",
    "album",
    "track_count",
    "artist",
    "title",
    "track_number"
  ),
  "file://C:/Users/Hitesh/Pictures/AlbumArt.PNG"
);

Clear the native system media controls.

controls.Dispose();

Extract metadata tags.

auto tags = lwm::Tags::FromMusic(std::wstring(music_file));
std::wcout << "album        : " << tags.album() << ".\n"
           << "album_artist : " << tags.album_artist() << ".\n"
           << "bitrate      : " << tags.bitrate() << ".\n";
           
// Other metadata tags.

Extract album art.

lwm::Tags::ExtractThumbnail(
  music_file,
  TO_WIDESTRING(std::filesystem::current_path().string()),
  "ExtractedAlbumArt.PNG",
  lwm::ThumbnailMode::Music,
  400
);

Show video in a window.

For showing video, you must instantiate player as follows.

Player player = Player(0, true);

Control video output.

player.ShowWindow();

player.CloseWindow();

Notes

Windows

For showing video

You need to embed a manifest with maxversiontested property to the generated executable. The library creates a separate win32 window on another thread & uses XAML islands to render the MediaPlayerElement in it (for showing video). Learn more here & here.

<?xml version="1.0" encoding="UTF-8"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
    <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
        <application>
            <maxversiontested Id="10.0.18362.0"/>
            <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
        </application>
    </compatibility>
</assembly>

Aim

The main goals of creating libwinmedia are:

  • Having high-level, user friendly library for media playback in C++.
  • Having small footprint, by using already existing OS APIs.
  • Having necessary things like network playback, event callbacks etc.
  • Being able to build similar high-level bindings to other programming languages, by just looking up for methods inside a single shared library.
  • Supporting multiple playback instances.
  • Supporting media tag-parsing & other things like lockscreen/system notifications.
  • Being permissively licensed.
  • Being cross-platform **.

** Currently only working on Windows & Linux.

License

Copyright (c) 2021 Hitesh Kumar Saini [email protected]

This library & work under this repository is MIT licensed.

Contributions welcomed.

GitHub

https://github.com/harmonoid/libwinmedia
Comments
  • 1. Unable to run the flutter example on windows

    Steps to reproduce:

    1. Simply run the flutter example on windows

    Issue: I am not able to run the example on Windows.

    Flutter Run Logs: [ +144 ms] executing: [C:\Users\Vipin Malik\fvm\versions\stable/] git -c log.showSignature=false log -n 1 --pretty=format:%H [+1045 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H [ +3 ms] f4abaa0735eba4dfd8f33f73363911d63931fe03 [ +7 ms] executing: [C:\Users\Vipin Malik\fvm\versions\stable/] git tag --points-at f4abaa0735eba4dfd8f33f73363911d63931fe03 [ +148 ms] Exit code 0 from: git tag --points-at f4abaa0735eba4dfd8f33f73363911d63931fe03 [ +9 ms] 2.2.3 [ +10 ms] executing: [C:\Users\Vipin Malik\fvm\versions\stable/] git rev-parse --abbrev-ref --symbolic @{u} [ +57 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u} [ +2 ms] origin/stable [ +6 ms] executing: [C:\Users\Vipin Malik\fvm\versions\stable/] git ls-remote --get-url origin [ +48 ms] Exit code 0 from: git ls-remote --get-url origin [ +2 ms] https://github.com/flutter/flutter.git [ +205 ms] executing: [C:\Users\Vipin Malik\fvm\versions\stable/] git rev-parse --abbrev-ref HEAD [ +62 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD [ +2 ms] stable [ +120 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update. [ +2 ms] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update. [ +6 ms] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update. [ +1 ms] Artifact Instance of 'FlutterWebSdk' is not required, skipping update. [ +4 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update. [ +88 ms] executing: C:\Users\Vipin Malik\AppData\Local\Android\sdk\platform-tools\adb.exe devices -l [ +38 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update. [ +2 ms] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update. [ +7 ms] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update. [ +1 ms] Artifact Instance of 'FlutterWebSdk' is not required, skipping update. [ +9 ms] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update. [ +2 ms] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update. [ +1 ms] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update. [ +1 ms] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update. [ +116 ms] executing: C:\Users\Vipin Malik\AppData\Local\Android\sdk\platform-tools\adb.exe devices -l [ +33 ms] Skipping pub get: version match. [ +80 ms] Found plugin libwinmedia at F:\Open-Source\libwinmedia\flutter
    [ +643 ms] Found plugin libwinmedia at F:\Open-Source\libwinmedia\flutter
    [ +170 ms] Initializing file store [ +15 ms] Skipping target: gen_localizations [ +7 ms] complete [ +8 ms] Launching lib\main.dart on Windows in debug mode... [ +10 ms] C:\Users\Vipin Malik\fvm\versions\stable\bin\cache\dart-sdk\bin\dart.exe --disable-dart-dev C:\Users\Vipin Malik\fvm\versions\stable\bin\cache\artifacts\engine\windows-x64\frontend_server.dart.snapshot --sdk-root C:\Users\Vipin Malik\fvm\versions\stable\bin\cache\artifacts\engine\common\flutter_patched_sdk/ --incremental --target=flutter --debugger-module-names --experimental-emit-debug-metadata -DFLUTTER_WEB_AUTO_DETECT=true --output-dill C:\Users\VIPINM~1\AppData\Local\Temp\flutter_tools.5c57fce5\flutter_tool.ca55c4ca\app.dill --packages F:\Open-Source\libwinmedia\flutter\example.dart_tool\package_config.json -Ddart.vm.profile=false -Ddart.vm.product=false --enable-asserts --track-widget-creation --filesystem-scheme org-dartlang-root --initialize-from-dill build\3c113a45063dc6628e68a4111abcacad.cache.dill.track.dill --enable-experiment=alternative-invalidation-strategy [ +60 ms] executing: C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe -format json -products * -utf8 -latest -version 16 -requires Microsoft.VisualStudio.Workload.NativeDesktop Microsoft.VisualStudio.Component.VC.Tools.x86.x64 Microsoft.VisualStudio.Component.VC.CMake.Project [ +44 ms] Exit code 0 from: C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe -format json -products * -utf8 -latest -version 16 -requires Microsoft.VisualStudio.Workload.NativeDesktop Microsoft.VisualStudio.Component.VC.Tools.x86.x64 Microsoft.VisualStudio.Component.VC.CMake.Project [ +3 ms] [ { "instanceId": "a458a554", "installDate": "2020-09-23T17:57:52Z", "installationName": "VisualStudio/16.7.4+30517.126", "installationPath": "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community", "installationVersion": "16.7.30517.126", "productId": "Microsoft.VisualStudio.Product.Community", "productPath": "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\devenv.exe", "state": 4294967295, "isComplete": true, "isLaunchable": true, "isPrerelease": false, "isRebootRequired": false, "displayName": "Visual Studio Community 2019", "description": "Powerful IDE, free for students, open-source contributors, and individuals", "channelId": "VisualStudio.16.Release", "channelUri": "https://aka.ms/vs/16/release/channel", "enginePath": "C:\Program Files (x86)\Microsoft Visual Studio\Installer\resources\app\ServiceHub\Services\Microsoft.VisualStudio.Setup.Service", "releaseNotes": "https://go.microsoft.com/fwlink/?LinkId=660893#16.7.4", "thirdPartyNotices": "https://go.microsoft.com/fwlink/?LinkId=660909", "updateDate": "2020-09-23T17:57:51.9916061Z", "catalog": { "buildBranch": "d16.7", "buildVersion": "16.7.30517.126", "id": "VisualStudio/16.7.4+30517.126", "localBuild": "build-lab", "manifestName": "VisualStudio", "manifestType": "installer", "productDisplayVersion": "16.7.4", "productLine": "Dev16", "productLineVersion": "2019", "productMilestone": "RTW", "productMilestoneIsPreRelease": "False", "productName": "Visual Studio", "productPatchVersion": "4", "productPreReleaseMilestoneSuffix": "1.0", "productSemanticVersion": "16.7.4+30517.126", "requiredEngineVersion": "2.7.3132.26759" }, "properties": { "campaignId": "", "canceled": "0", "channelManifestId": "VisualStudio.16.Release/16.7.4+30517.126", "nickname": "", "setupEngineFilePath": "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installershell.exe" } } ] [ +9 ms] Building Windows application... [ +37 ms] <- compile package:libwinmedia_example/main.dart [ +26 ms] executing: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe -S F:\Open-Source\libwinmedia\flutter\example\windows -B build\windows -G Visual Studio 16 2019 [ +31 ms] List of devices attached [ +9 ms] List of devices attached [+1156 ms] -- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19042. [ +63 ms] CMake Error at flutter/ephemeral/.plugin_symlinks/libwinmedia/windows/CMakeLists.txt:7 (add_subdirectory): [ +7 ms] add_subdirectory given source [ +6 ms] "F:/Open-Source/libwinmedia/flutter/example/windows/flutter/ephemeral/.plugin_symlinks/libwinmedia/windows/../.master" [ +1 ms] which is not an existing directory. [ +1 ms] -- Configuring incomplete, errors occurred! [ +1 ms] See also "F:/Open-Source/libwinmedia/flutter/example/build/windows/CMakeFiles/CMakeOutput.log". [ +32 ms] Building Windows application... (completed in 1,352ms) [+13400 ms] Exception: Unable to generate build files [ +3 ms] "flutter run" took 16,201ms. [ +16 ms] #0 throwToolExit (package:flutter_tools/src/base/common.dart:10:3) #1 RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:663:9) #2 FlutterCommand.run. (package:flutter_tools/src/runner/flutter_command.dart:1043:27) #3 AppContext.run. (package:flutter_tools/src/base/context.dart:150:19) #4 CommandRunner.runCommand (package:args/command_runner.dart:196:13) #5 FlutterCommandRunner.runCommand. (package:flutter_tools/src/runner/flutter_command_runner.dart:284:9) #6 AppContext.run. (package:flutter_tools/src/base/context.dart:150:19) #7 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:232:5) #8 run.. (package:flutter_tools/runner.dart:62:9) #9 AppContext.run. (package:flutter_tools/src/base/context.dart:150:19) #10 main (package:flutter_tools/executable.dart:91:3)

    [ +269 ms] ensureAnalyticsSent: 264ms [ +5 ms] Running shutdown hooks [ +5 ms] Shutdown hooks complete [ +1 ms] exiting with code 1

    Flutter Doctor Logs: Doctor summary (to see all details, run flutter doctor -v): [√] Flutter (Channel stable, 2.2.3, on Microsoft Windows [Version 10.0.19042.1237], locale en-US) [√] Android toolchain - develop for Android devices (Android SDK version 29.0.3) [√] Chrome - develop for the web [√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.7.4) [√] Android Studio (version 4.1.0) [√] IntelliJ IDEA Community Edition (version 2020.3) [√] VS Code (version 1.59.1) [√] Connected device (3 available)

    β€’ No issues found!

    Reviewed by 0Vipin0 at 2021-10-05 18:29
  • 2. Freeze on Linux

    The Flutter example produces this error on Linux:

    $ cd flutter/example
    $ flutter run -d linux
    Launching lib/main.dart on Linux in debug mode...
    libwinmedia - 0.0.2
    -------------------
    Building on Linux against GTK 3.0 & WebKit2 4.0
    C++ Standard: 17
    Enabled Dart VM NativePorts callbacks.
    /home/ryan/projects/libwinmedia/flutter/example/linux/flutter/ephemeral/.plugin_symlinks/libwinmedia/.master/linux/player.hpp:12:10: fatal error: '../external/webview/webview.h' file not found
    Building Linux application...
    Exception: Build process failed
    

    Do I need to copy or symlink some files into external?

    Reviewed by ryanheise at 2021-09-23 09:07
  • 3. Linux build error (Flutter snap)

    Hello. I have a error while building my app. After adding to pubspec.yaml:

    libwinmedia: ^0.0.6
    just_audio_libwinmedia: any
    
    Launching lib/main.dart on Linux in debug mode...
    lib/main.dart:1
    CMake Error at flutter/ephemeral/.plugin_symlinks/libwinmedia/.master/CMakeLists.txt:1 (cmake_minimum_required):
      CMake 3.15 or higher is required.  You are running version 3.10.2
    
    
    Exception: Unable to generate build files
    Exited (sigterm)
    

    flutter doctor

    Doctor summary (to see all details, run flutter doctor -v):
    [βœ“] Flutter (Channel stable, 2.5.1, on Ubuntu 20.10 5.8.0-63-generic, locale ru_RU.UTF-8)
    [βœ“] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    [βœ“] Chrome - develop for the web
    [βœ“] Linux toolchain - develop for Linux desktop
    [βœ“] Android Studio (version 2020.3)
    [βœ“] Android Studio (version 4.2)
    [βœ“] Android Studio
    [βœ“] VS Code (version 1.60.2)
    [βœ“] Connected device (2 available)
    
    β€’ No issues found!
    

    I use Flutter snap.

    Reviewed by Sotneo at 2021-09-26 13:44
  • 4. Flutter version doesn't work on Ubuntu 20.04

    Hi,

    when I add the following code to the flutter example app

    void main() {
      LWM.initialize();
      var player = Player(id: 0);
      player.open([
        Media(uri: 'file://home/osboxes/click.mp3'),
      ]);
      player.play();
      
      runApp(const MyApp());
    }
    

    I get the following output

    Launching lib/main.dart on Linux in debug mode...
    Building Linux application...
    libwinmedia - 0.0.3
    -------------------
    Building on Linux against GTK 3.0 & WebKit2 4.0
    C++ Standard: 17
    Enabled Dart VM NativePorts callbacks.
    Debug service listening on ws://127.0.0.1:39813/B6JZIhK31HU=/ws
    Syncing files to device Linux...
    WebKit wasn't able to find a WebVTT encoder. Not continuing without platform support for subtitles.
    [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: type 'int' is not a subtype of type 'PlayerErrorCode'
    #0      LWM.receivePort.<anonymous closure> (package:libwinmedia/src/internal.dart:113:44)
    #1      _rootRunUnary (dart:async/zone.dart:1444:13)
    #2      _CustomZone.runUnary (dart:async/zone.dart:1335:19)
    #3      _CustomZone.runUnaryGuarded (dart:async/zone.dart:1244:7)
    #4      _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
    #5      _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
    #6      _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:733:19)
    #7      _StreamController._add (dart:async/stream_controller.dart:607:7)
    #8      _StreamController.add (dart:async/stream_controller.dart:554:5)
    #9      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:187:12)
    
    

    It seems that using libwebkit2gtk-4.0-dev requires WebVTT encoder even for playing sound... ?

    Thank you,

    W

    Reviewed by WWWWWWhite at 2021-10-08 09:40
  • 5. flutter build web - error occurs even not using this plugin(just import)

    Error:

    /.../libwinmedia-0.0.7/lib/src/player.dart:2:8: Error: Not found: 'dart:ffi'
    import 'dart:ffi';
           ^
    
    /.../libwinmedia-0.0.7/lib/src/internal.dart:2:8: Error: Not found: 'dart:ffi'
    import 'dart:ffi';
    
    

    Environment:

    Flutter 2.8.1 β€’ channel stable β€’ https://github.com/flutter/flutter.git
    Framework β€’ revision 77d935af4d (6 weeks ago) β€’ 2021-12-16 08:37:33 -0800
    Engine β€’ revision 890a5fca2e
    Tools β€’ Dart 2.15.1
    
    Reviewed by sleepreading at 2022-01-26 06:18
  • 6. flutter 2.10 with vs2022 build error

    Flutter 2.10.0 β€’ channel stable β€’ https://github.com/flutter/flutter.git
    Framework β€’ revision 5f105a6ca7 (3 days ago) β€’ 2022-02-01 14:15:42 -0800
    Engine β€’ revision 776efd2034
    Tools β€’ Dart 2.16.0 β€’ DevTools 2.9.2
    
    -----------------------------
    
    Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source!
    Launching lib\main.dart on Windows in debug mode...
    libwinmedia - 0.0.3
    -------------------
    Building on Windows against C++/WinRT 2.0.210806.1
    C++ Standard: 17
    Enabled Dart VM NativePorts callbacks.
    d:\xxx\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(146,5): error MSB3075: ε‘½δ»€β€œsetlocal [D:\demo\build\windows\plugins\libwinmedia\libwinmedia\CPP_WINRT_DOWNLOAD.vcxproj]
    d:\xxx\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(146,5): error MSB3075: D:\demo\windows\flutter\ephemeral\.plugin_symlinks\libwinmedia\master\nuget.exe install Microsoft.Windows.CppWinRT -Version 2.0.210806.1 -ExcludeVersion -OutputDirectory D:/dev/src/dart/zeus/windows/flutter/ephemeral/.plugin_symlinks/libwinmedia/master/external [D:\demo\build\windows\plugins\libwinmedia\libwinmedia\CPP_WINRT_DOWNLOAD.vcxproj]
    d:\xxx\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(146,5): error MSB3075: if %errorlevel% neq 0 goto :cmEnd [D:\demo\build\windows\plugins\libwinmedia\libwinmedia\CPP_WINRT_DOWNLOAD.vcxproj]
    d:\xxx\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(146,5): error MSB3075: :cmEnd [D:\demo\build\windows\plugins\libwinmedia\libwinmedia\CPP_WINRT_DOWNLOAD.vcxproj]
    d:\xxx\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(146,5): error MSB3075: endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone [D:\demo\build\windows\plugins\libwinmedia\libwinmedia\CPP_WINRT_DOWNLOAD.vcxproj]
    d:\xxx\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(146,5): error MSB3075: :cmErrorLevel [D:\demo\build\windows\plugins\libwinmedia\libwinmedia\CPP_WINRT_DOWNLOAD.vcxproj]
    d:\xxx\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(146,5): error MSB3075: exit /b %1 [D:\demo\build\windows\plugins\libwinmedia\libwinmedia\CPP_WINRT_DOWNLOAD.vcxproj]
    d:\xxx\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(146,5): error MSB3075: :cmDone [D:\demo\build\windows\plugins\libwinmedia\libwinmedia\CPP_WINRT_DOWNLOAD.vcxproj]
    d:\xxx\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(146,5): error MSB3075: if %errorlevel% neq 0 goto :VCEnd [D:\demo\build\windows\plugins\libwinmedia\libwinmedia\CPP_WINRT_DOWNLOAD.vcxproj]
    d:\xxx\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(146,5): error MSB3075: :VCEndβ€ε·²ι€€ε‡ΊοΌŒδ»£η δΈΊ 5。请ιͺŒθ―ζ‚¨ζ˜―否ζ‹₯ζœ‰θΏθ‘Œζ­€ε‘½δ»€ηš„θΆ³ε€Ÿζƒι™γ€‚ [D:\demo\build\windows\plugins\libwinmedia\libwinmedia\CPP_WINRT_DOWNLOAD.vcxproj]
    Exception: Build process failed.
    Exited (sigterm)
    
    
    Reviewed by sleepreading at 2022-02-04 12:29
  • 7. Cannot build on Windows

    Hello,

    we are getting Build error for this package while running on windows.

    Steps Performed:

    1. Create Empty Flutter Project Using flutter create demo command.
    2. Add libwinmedia: ^0.0.7 as Pubspec Depencency and pub get
    3. Tried to run flutter project on windows ,got following error

    Build Error

    Launching lib\main.dart on Windows in debug mode...
    lib\main.dart:1
    libwinmedia - 0.0.3
    -------------------
    Building on Windows against C++/WinRT 2.0.210806.1
    C++ Standard: 17
    Enabled Dart VM NativePorts callbacks.
    C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(145,5): error MSB3073: The command "setlocal [E:\flutter_projects\test\build\windows\plugins\libwinmedia\libwinmedia\CPP_WINRT_DOWNLOAD.vcxproj]
    C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(145,5): error MSB3073: E:\flutter_projects\test\windows\flutter\ephemeral\.plugin_symlinks\libwinmedia\master\nuget.exe install Microsoft.Windows.CppWinRT -Version 2.0.210806.1 -ExcludeVersion -OutputDirectory E:/flutter_projects/test/windows/flutter/ephemeral/.plugin_symlinks/libwinmedia/master/external [E:\flutter_projects\test\build\windows\plugins\libwinmedia\libwinmedia\CPP_WINRT_DOWNLOAD.vcxproj]
    C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(145,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd [E:\flutter_projects\test\build\windows\plugins\libwinmedia\libwinmedia\CPP_WINRT_DOWNLOAD.vcxproj]
    C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(145,5): error MSB3073: :cmEnd [E:\flutter_projects\test\build\windows\plugins\libwinmedia\libwinmedia\CPP_WINRT_DOWNLOAD.vcxproj]
    C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(145,5): error MSB3073: endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone [E:\flutter_projects\test\build\windows\plugins\libwinmedia\libwinmedia\CPP_WINRT_DOWNLOAD.vcxproj]
    C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(145,5): error MSB3073: :cmErrorLevel [E:\flutter_projects\test\build\windows\plugins\libwinmedia\libwinmedia\CPP_WINRT_DOWNLOAD.vcxproj]
    C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(145,5): error MSB3073: exit /b %1 [E:\flutter_projects\test\build\windows\plugins\libwinmedia\libwinmedia\CPP_WINRT_DOWNLOAD.vcxproj]
    C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(145,5): error MSB3073: :cmDone [E:\flutter_projects\test\build\windows\plugins\libwinmedia\libwinmedia\CPP_WINRT_DOWNLOAD.vcxproj]
    C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(145,5): error MSB3073: if %errorlevel% neq 0 goto :VCEnd [E:\flutter_projects\test\build\windows\plugins\libwinmedia\libwinmedia\CPP_WINRT_DOWNLOAD.vcxproj]
    C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(145,5): error MSB3073: :VCEnd" exited with code 1. [E:\flutter_projects\test\build\windows\plugins\libwinmedia\libwinmedia\CPP_WINRT_DOWNLOAD.vcxproj]
    Exception: Build process failed.
    Exited (sigterm)
    
    

    Flutter doctor output

    [√] Flutter (Channel stable, 2.8.1, on Microsoft Windows [Version 10.0.19044.1415], locale en-IN)
        β€’ Flutter version 2.8.1 at C:\src\flutter
        β€’ Upstream repository https://github.com/flutter/flutter.git
        β€’ Framework revision 77d935af4d (13 days ago), 2021-12-16 08:37:33 -0800
        β€’ Engine revision 890a5fca2e
        β€’ Dart version 2.15.1
    
    [√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)    
        β€’ Android SDK at C:\Users\Dell\AppData\Local\Android\sdk
        β€’ Platform android-31, build-tools 30.0.3
        β€’ Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
        β€’ Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)   
        β€’ 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 4.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 1.8.0_242-release-1644-b01)   
    
    [√] VS Code (version 1.63.2)
        β€’ VS Code at C:\Users\Dell\AppData\Local\Programs\Microsoft VS Code
        β€’ Flutter extension version 3.29.0
    
    [√] Connected device (3 available)
        β€’ Windows (desktop) β€’ windows β€’ windows-x64    β€’ Microsoft Windows [Version 10.0.19044.1415]
        β€’ Chrome (web)      β€’ chrome  β€’ web-javascript β€’ Google Chrome 96.0.4664.110
        β€’ Edge (web)        β€’ edge    β€’ web-javascript β€’ Microsoft Edge 96.0.1054.57
    
    β€’ No issues found!
    
    

    Can you please help on solving this issue? What are we missing?

    Reviewed by gladson97 at 2021-12-29 08:39
  • 8. Report errors

    Can be done through this event handler on windows and

        _audioElement.addEventListener('error', (event) {
          _durationCompleter?.completeError(_audioElement.error!);
        });
    

    on linux.

    Reviewed by bdlukaa at 2021-09-22 14:35
  • 9. 18: fix locale issues with printing using std::to_string for floats

    Fixes #18

    std::to_string output depends on the locale on the machine it happens to be running on. For floats, this produces invalid output with comma instead of period as a decimal separator, such as 0,3 instead of 0.3.

    Reviewed by esiqveland at 2022-01-06 17:15
  • 10. Make linux window harder to find when not required

    Current version shows a temporary window even if show_window is false. Constructor of webview::webview always calls gtk_widget_show_all, which displays the window.

    https://github.com/webview/webview/blob/f540d88dde4ebb2108833cf0a413742941ce4eca/webview.h#L502

    This PR makes the window harder to find by doing:

    1. Set window type to GTK_WINDOW_POPUP. This type of window has no border and does not display in taskbar.
    2. Resize window to width=1, height=1.
    3. Then hide the window(widget)
    Reviewed by Yesterday17 at 2021-12-04 07:17
  • 11. Buffering Position

    Know the current buffering position.

    Can be done simply with WinRT:

    g_media_players.at(player_id).BufferingProgress();
    

    and Linux:

          "   player.addEventListener('progress' (event) => {"
          "       var duration = myAudio.duration; " 
          "       if (myAudio.buffered.length > 0) { " 
          "           buffering(myAudio.buffered.end(myAudio.buffered.length - 1) * 1000);"
          "       } " 
          "   });"
    
    Reviewed by bdlukaa at 2021-09-19 13:01
  • 12. linux: set playback rate and set volume not working

    When running the example I noticed only volume set to max (1.0) works. everything < 1.0 gets used as zero volume. Noticed the same for playback rate.

    I tracked it down to std::to_string being locale aware, and in my locale it prints a float with comma , as the decimal point, breaking the volume setting.

    https://github.com/harmonoid/libwinmedia/blob/master/linux/player.hpp#L410

    Reviewed by esiqveland at 2022-01-06 17:10
  • 13. Add elinux compatibility

    I'm trying to get this library to work on elinux, the authors put in a lot of work and ported a couple of different plugins to make them compatible for elinux. I forked the repo to start developing a port but the library includes gtk and and flutter_linux which stumped me on how to continue. So I'm going to need some help on it πŸ˜…

    The flutter elinux author has already developed an api compatible version of the flutter video player plugin and maybe theres something we can extrapolate from that?

    Reviewed by Taha-Firoz at 2021-10-24 16:29
  • 14. Improve & fix error reporting

    I'm trying to load http://jewishmusic.fm/wp-content/uploads/secretmusicfolder1/singles/nissim-black-shiah-maisel---hope.mp3 and

    1. It's failing
    2. The failure is silent, so I'm not even sure why

    This is using the flutter example on windows

    Any help with this would be great, thanks!

    Reviewed by efraimbart at 2021-10-07 03:31

Related

An 🎡 audio playback library for Flutter Desktop. Supports Windows & Linux. Based on miniaudio.
An 🎡 audio playback library for Flutter Desktop. Supports Windows & Linux. Based on miniaudio.

βœ’ libwinmedia is sequel to this project. It provides network playback, better format support, control & features. An audio playback library for Flutte

Jul 10, 2022
A cross-platform (Android/Windows/macOS/Linux) USB plugin for Flutter

quick_usb A cross-platform (Android/Windows/macOS/Linux) USB plugin for Flutter Usage List devices List devices with additional description Get device

Jul 5, 2022
A cross-platform app ecosystem, bringing iMessage to Android, PC (Windows, Linux, & even macOS), and Web!

BlueBubbles Android App BlueBubbles is an open-source and cross-platform ecosystem of apps aimed to bring iMessage to Android, Windows, Linux, and mor

Aug 9, 2022
A clean front-end plugin to Volumio, the Linux distribution for music playback. Volumio Touch Display Lite is written in Flutter and runs on flutter-pi.
A clean front-end plugin to Volumio, the Linux distribution for music playback. Volumio Touch Display Lite is written in Flutter and runs on flutter-pi.

EN | δΈ­ζ–‡ Touch Display Lite plugin for Volumio 3 Feng Zhou, 2021-12 Touch Display Lite is a clean and fast user interface for Volumio 3, the Linux dist

Jul 26, 2022
A Flutter plugin to read πŸ”– metadata of 🎡 media files. Supports Windows, Linux & Android.
A Flutter plugin to read πŸ”– metadata of 🎡 media files. Supports Windows, Linux & Android.

flutter_media_metadata A Flutter plugin to read metadata of media files. A part of Harmonoid open source project ?? Install Add in your pubspec.yaml.

Aug 12, 2022
Flutter library for window blur & transparency effects for on Windows & Linux. πŸ’™
Flutter library for window blur & transparency effects for on Windows & Linux. πŸ’™

flutter_acrylic Window blur & transparency effects for Flutter on Windows & Linux Installation Mention in your pubspec.yaml. dependencies: ... flu

Aug 6, 2022
A cross-platform (Windows/macOS) scanner plugin for Flutter

quick_scanner A cross-platform (Windows/macOS) scanner plugin for Flutter Usage QuickScanner.startWatch(); var _scanners = await QuickScanner.getScan

Jun 10, 2022
Flutter plugin for Flutter desktop(macOS/Linux/Windows) to change window size.

desktop_window Flutter plugin for Flutter desktop(macOS/Linux/Windows) to change window size. Usage import 'package:desktop_window/desktop_window.dart

Jul 11, 2022
Flutter on Windows, MacOS and Linux - based on Flutter Embedding, Go and GLFW.
Flutter on Windows, MacOS and Linux - based on Flutter Embedding, Go and GLFW.

go-flutter - A package that brings Flutter to the desktop Purpose Flutter allows you to build beautiful native apps on iOS and Android from a single c

Aug 6, 2022
A pure Dart implementation of Firebase with initial support aimed at FlutterFire for Linux & Windows.

FlutterFire Desktop A work in progress pure Dart implementation of Firebase with initial support aimed at FlutterFire for Linux & Windows. A FlutterFi

Aug 8, 2022
File picker plugin for Flutter, compatible with mobile (iOS & Android), Web, Desktop (Mac, Linux, Windows) platforms with Flutter Go support.
File picker plugin for Flutter, compatible with mobile (iOS & Android), Web, Desktop (Mac, Linux, Windows) platforms with Flutter Go support.

A package that allows you to use the native file explorer to pick single or multiple files, with extensions filtering support.

Aug 4, 2022
A simple-to-use flutter update package for Windows, MacOS, and Linux.
A simple-to-use flutter update package for Windows, MacOS, and Linux.

Updat - The simple-to-use, flutter-based desktop update package Updat is a simple-to-use reliable flutter-native updater that handles your application

Aug 6, 2022
A cross-platform flutter plugin for C/C++/ObjC crash report via Google Breakpad
A cross-platform flutter plugin for C/C++/ObjC crash report via Google Breakpad

quick_breakpad A cross-platform flutter plugin for C/C++/ObjC crash report via Google Breakpad Use breakpad for quick_breakpad_example $CLI_BREAKPAD i

Jul 30, 2022
Sharik is an open-source, cross-platform solution for sharing files via Wi-Fi or Mobile Hotspot
Sharik is an open-source, cross-platform solution for sharing files via Wi-Fi or Mobile Hotspot

Share files across devices with Sharik! It works with Wi-Fi connection or Tethering (Wi-Fi Hotspot). No internet connection needed. Contributing Feel

Aug 9, 2022
A Cross Platform Piano made with Flutter
A Cross Platform Piano made with Flutter

flutter_piano A Crossplatform Midi Piano built with Flutter.dev This application runs on both iOS and Android. This runs a custom crossplatform midi s

Jul 23, 2022
A package which provides most of the window decorations from linux themes.

Window Decorations A package which provides most of the window decorations from linux themes. Features Easier to use and implement Native looking wind

May 14, 2022
A tutorial for creating an Ubuntu Linux Flutter app, using the yaru theme
A tutorial for creating an Ubuntu Linux Flutter app, using the yaru theme

Building a Yaru app with Flutter Summary URL https://github.com/ubuntu/user_manager Category Environment Linux Status Feedback Link Author Frederik Fe

Aug 8, 2022
Embedded Linux embedding for Flutter
Embedded Linux embedding for Flutter

Embedded Linux (eLinux) embedding for Flutter This project was created to develop non-official embedded Linux embeddings of Flutter. This embedder is

Aug 5, 2022
A flutter application to monitor your Linux PC statistic.
A flutter application to monitor your Linux PC statistic.

Linux Stats App A flutter application to monitor your Linux PC statistic. Screenshots Installation Download or clone the repository: $ git clone https

Feb 14, 2022