bdlukaa / just_audio_libwinmedia

Libwinmedia implementation of just_audio.
MIT License
11 stars 8 forks source link

tests print errors #13

Open nathanfranke opened 2 years ago

nathanfranke commented 2 years ago
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/

jbrownsw commented 2 years ago

Perhaps it could simply check Platform.environment.containsKey('FLUTTER_TEST') and not even try to load the library. I'm not sure if that works for everyone, but I believe the tests are run in dart vm by default so I question if the library would even be working right during test anyway.