bdlukaa / just_audio_libwinmedia Goto Github PK
View Code? Open in Web Editor NEWLibwinmedia implementation of just_audio.
License: MIT License
Libwinmedia implementation of just_audio.
License: MIT License
Shell: `just_audio_libwinmedia` threw an error: Invalid argument(s): Failed to load dynamic library
'/opt/flutter/bin/cache/artifacts/engine/linux-x64/lib/libwinmedia.so': /opt/flutter/bin/cache/artifacts/engine/linux-x64/lib/libwinmedia.so: cannot open shared object
file: No such file or directory. The app may not function as expected until you remove this plugin from pubspec.yaml
Shell: [ERROR:flutter/shell/common/shell.cc(93)] Dart Unhandled Exception: Invalid argument(s): Failed to load dynamic library
'/opt/flutter/bin/cache/artifacts/engine/linux-x64/lib/libwinmedia.so': /opt/flutter/bin/cache/artifacts/engine/linux-x64/lib/libwinmedia.so: cannot open shared object
file: No such file or directory, stack trace: #0 _open (dart:ffi-patch/ffi_dynamic_library_patch.dart:12:43)
Shell: #1 new DynamicLibrary.open (dart:ffi-patch/ffi_dynamic_library_patch.dart:23:12)
Shell: #2 LWM.initialize (package:libwinmedia/src/internal.dart:128:43)
Shell: #3 LibWinMediaJustAudioPlugin.registerWith (package:just_audio_libwinmedia/src/just_audio_libwinmedia_real.dart:13:9)
Shell: #4 _PluginRegistrant.register (file:///home/nathan/workspace/project/.dart_tool/flutter_build/generated_main.dart:63:36)
Shell:
Note: /opt/flutter/bin/cache
is writable
Workaround is copying PROJECT/build/linux/x64/debug/plugins/libwinmedia/libwinmedia/libwinmedia.so
to /opt/flutter/bin/cache/artifacts/engine/linux-x64/lib/
Minimal reproduction project
example repository
To Reproduce
just-audio/example
directory
variable with the absolute path of the example folderExpected behavior
Playback should occur almost immediately as is with the commented code below.
Desktop
Flutter SDK version
stable
2.10.3
Minimal reproduction project
https://github.com/ryanheise/just_audio/tree/master/just_audio/example
To Reproduce (i.e. user steps, not code)
Steps to reproduce the behavior:
Error messages
Note sure if this is causing the issue.
CONSOLE JS ERROR Unhandled Promise Rejection: AbortError: The operation was aborted.
Expected behavior
Playback starts shortly after pressing play.
Desktop (please complete the following information):
Smartphone (please complete the following information):
Flutter SDK version
[✓] Flutter (Channel stable, 2.8.1, on Arch Linux 5.15.18-1-lts, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 31)
[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✓] Linux toolchain - develop for Linux desktop
[!] Android Studio (not installed)
[✓] Connected device (1 available)
Additional context
It seems to work sometimes, but most of the time it does not.
This method blocks on(callstack):
https://github.com/ryanheise/just_audio/blob/1c6598c0f3589baac4194e71b4d2885205f58ef4/just_audio/lib/just_audio.dart#L683
https://github.com/ryanheise/just_audio/blob/1c6598c0f3589baac4194e71b4d2885205f58ef4/just_audio/lib/just_audio.dart#L708
https://github.com/ryanheise/just_audio/blob/1c6598c0f3589baac4194e71b4d2885205f58ef4/just_audio/lib/just_audio.dart#L772-L773
That's because processingStateStream
did not receive any state change. When player opens:
Player::Open
internally, which sets video.src
and does not fire any events:The duration of Audio files is always null
The player state isn't updated when the audio is paused from the keyboard key (the pause key) and also doesn't pause the audio about 40 % of times when we press the key.
I am not able to find why, but duration is always null on windows.
I guess, the player state is not updating because of some errors that the plugin is not currently handling, I might be wrong and hence corrections are welcomed :)
Edit 1: I discovered that when the app window is in the foreground, the play/pause key doesn't work, but does work when the app window is in the background.
Hello,
Quote from https://dart.dev/guides/libraries/private-files
pubspec.lock
The pubspec.lock file is a special case, similar to Ruby’s Gemfile.lock.
For library packages, don’t commit the pubspec.lock file. Regenerating the pubspec.lock file lets you test your package against the latest compatible versions of its dependencies.
After playing audio on windows i get following Error.
flutter: UnimplementedError: disposeAllPlayers() has not been implemented.
Thanks very much for providing this package for desktop platforms.
I'm trying to use just audio on linux, but it does not work well.
my pubspec.yaml
flutter:
just_audio: ^0.9.20
just_audio_libwinmedia: ^0.0.4
...
assets:
- audios/passing.wav
my versions
$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.8.1, on Ubuntu 16.04.7 LTS 4.15.0-142-generic, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[✓] Android Studio (version 4.0)
[✓] IntelliJ IDEA Community Edition (version 2019.1)
[✓] VS Code (version 1.64.2)
[✓] Connected device (2 available)
$ uname -a
Linux me-MS-7B24 4.15.0-142-generic #146~16.04.1-Ubuntu SMP Tue Apr 13 09:27:15 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
And my test code
onPressed: () async {
...
else{
final player = AudioPlayer();
await player.setAsset('audios/passing.wav');
await player.play();
await player.stop();
await player.dispose();
}
}
And Result on Pressed
flutter: UnimplementedError: disposeAllPlayers() has not been implemented.
1 0x7ffab2534237 /usr/lib/x86_64-linux-gnu/libjavascriptcoregtk-4.0.so.18(WTFCrash+0x17) [0x7ffab2534237]
2 0x7ffab319a06f /usr/lib/x86_64-linux-gnu/libwebkit2gtk-4.0.so.37(+0x6d606f) [0x7ffab319a06f]
3 0x7ffab31899f0 /usr/lib/x86_64-linux-gnu/libwebkit2gtk-4.0.so.37(+0x6c59f0) [0x7ffab31899f0]
4 0x7ffab34111da /usr/lib/x86_64-linux-gnu/libwebkit2gtk-4.0.so.37(webkit_web_view_run_javascript+0xfa) [0x7ffab34111da]
5 0x7ffab53c8c8a /home/jaehyung/programming/flutter_projects/diener_application/build/linux/x64/debug/bundle/lib/libwinmedia.so(_ZN7webview17gtk_webkit_engine4evalENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x5a) [0x7ffab53c8c8a]
6 0x7ffab53bf678 /home/jaehyung/programming/flutter_projects/diener_application/build/linux/x64/debug/bundle/lib/libwinmedia.so(_ZN6Player9SetVolumeEf+0x98) [0x7ffab53bf678]
7 0x7ffab53c178d /home/jaehyung/programming/flutter_projects/diener_application/build/linux/x64/debug/bundle/lib/libwinmedia.so(PlayerSetVolume+0x3d) [0x7ffab53c178d]
8 0x7ffad7b8597b [0x7ffad7b8597b]
Lost connection to device.
Thank you!
To which pages does your suggestion apply?
Quote the sentences(s) from the documentation to be improved (if any)
"Windows HLS supported"
Describe your suggestion
According to ryanheise/just_audio#103 (comment) and my tests, HLS does not work on Windows, it just keeps buffering and will not play.
Tested with https://devstreaming-cdn.apple.com/videos/streaming/examples/img_bipbop_adv_example_fmp4/master.m3u8, works with Android.
audioPlayer?.setAudioSource(
HlsAudioSource(
Uri.parse(
"https://devstreaming-cdn.apple.com/videos/streaming/examples/img_bipbop_adv_example_fmp4/master.m3u8"),
),
Hello,
I'm trying to run the simple example from the just_audio package on Linux (POP OS 20.04).
My pubspec.yaml contains:
just_audio: ^0.9.15
just_audio_libwinmedia: ^0.0.4
But when I run, I get the following error:
Building Linux application...
libwinmedia - 0.0.3
-------------------
Building on Linux against GTK 3.0 & WebKit2 4.0
C++ Standard: 17
CMake Error at /usr/share/cmake-3.16/Modules/FindPkgConfig.cmake:463 (message):
A required package was not found
Call Stack (most recent call first):
/usr/share/cmake-3.16/Modules/FindPkgConfig.cmake:643 (_pkg_check_modules_internal)
flutter/ephemeral/.plugin_symlinks/libwinmedia/master/CMakeLists.txt:71 (pkg_check_modules)
Exception: Unable to generate build files
First, I don't know why it talks about libwinmedia 0.0.3 despite my pubspec file asking for 0.0.4. Then how am I supposed to know which package is missing? Thank you in advance for your help, and for making this plugin!
Hey. @bdlukaa
Thanks for your work! It's not an issue, but could you please provide an example project (counter with .wav sound on FAB tap, will be enough)? It may help all of us in future debugging and issue reporting. Also, it will probably add some pub points to your package. Thanks in advance!
Hello, thank you for your fantastic work on this. It even works great on linux!
When I play a url using player.setAudioSource()
the playbackEventStream
gets stuck showing:
playing=true state=buffering
When I call .pause() --> .play() it correctly goes to state:
playing=true state=ready
I think it might be because the buffering subject is published after playing == true:
Or because the subject doesn't update to state ready
when buffering == false.
When playing an audio clip, calling seek(Duration.zero) should start playing the audio again from the beginning. This works as expected if seek is called while the clip is still playing, but if the audio clip has finished playing nothing happens.
For the latest version of webkit2gtk (2.36.1) ProcessingStream.listener
never gets called for ProcessingState.completed
event when the audio file has finished playing
Also the state never gets set to ProcessingState.completed
when the track has finished playing
The entire scenario works perfectly fine if using older versions of webkit2gtk/libwebkit2gtk (all versions before latest gnome-41 & after gnome-36)
Error occurring piece of code:
https://github.com/KRTirtho/spotube/blob/3b7f7785b66e63dfe56b07c49d009441ad56219b/lib/provider/Playback.dart#L113-L130
Tested on Operating Systems/Platforms:
When setting volume to anything other than 1.0 causes complete silence.
Updating to any value results in silence. Setting the volume to 1.0 resumes audio.
Currently just_audio_libwinmedia returns a duration of zero when loading any media. It seems libwinmedia has the ability to listen to duration changes, so maybe this could be used to listen for, and return, the duration in just_audio_libwinmedia (not sure if there might be a better way...)
When calling constructor of Player
:
startLoop: !Platform.isLinux
must be add as the comment of libwinmedia
suggests:
https://github.com/harmonoid/libwinmedia/blob/71a7f157a0d3ed9a6394e73de7585a7c9a3525fa/flutter/lib/src/player.dart#L147
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.