Giter Site home page Giter Site logo

harmonoid / libwinmedia Goto Github PK

View Code? Open in Web Editor NEW
39.0 7.0 12.0 4.7 MB

[Archived] A cross-platform simple media playback library for C/C++.

License: MIT License

CMake 8.39% C++ 59.52% Dart 30.99% C 1.09%
cpp linux windows audio video mp3 m4a flac aac winrt

libwinmedia's Introduction

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

⚠️ Deprecated

The project is now archived. Reasons are documented below:

  • Inefficient Linux support: I had few (personal) reasons because of which my media URIs were not playing in GStreamer, so I decided to summon a WebKit instance using webview.h to make a basic JS interop setup for using WebAudio API (which itself is based on GStreamer in WebKitGTK). A good advantage that Flutter provides over other electron.js like alternatives is that it doesn't start a webview instance / JavaScript runtime, but using this plugin puts Flutter's those advantages to no use. This also makes us unable to add various crucial features like audio device selection/enumeration or equalizer etc. in future because of limited set of WebAudio APIs.
  • Unnecessary abstraction: As I said Linux support is not worth using, it puts Windows implementation to no use aswell. The WinRT APIs that this library exposes in a C like interface can be used directly in the project because they're already very user friendly & easy to integrate. Using this library on Windows just adds another layer of abstraction.
  • Unsafe: Using library on certain language/locales will cause crashes, since it heavily uses std::stof and std::stoi when doing JS interop. It is both inefficient and unsafe.
  • No backward compatibility: The library is only usable on later Windows 10 versions or higher. A project targetting a very small market share isn't worth maintaining.
  • No embedded Linux support: The library cannot be used on non-GTK Flutter embedders like flutter-pi etc. A lot of questions/issues have been made about this & it is not possible unless one decides to rewrite Linux implementation.

The project was started as an internal Harmonoid dependency to provide Windows/Linux support for the time-being, while I was looking for other libraries to settle on. Now that it is no longer used & current implementation isn't good enough, I don't see any point in adding features, fixing bugs etc. Thus, I have decided to discontinue this project. You are free to fork the project or use the code as allowed by the MIT license (which can be found in the LICENSE file).

Thankyou.

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.

libwinmedia's People

Contributors

alexmercerind avatar bdlukaa avatar esiqveland avatar sotneo avatar yesterday17 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

libwinmedia's Issues

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?

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

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

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!

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?

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)

Report errors

Can be done through this event handler on windows and

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

on linux.

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.

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

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.