alexmercerind / flutter_audio_desktop

[WIP] An 🎵 audio playback library for Flutter Desktop. Supports Windows & Linux. Based on miniaudio.
MIT License
53 stars 18 forks source link

Audio doesn't work for release build #24

Closed GrimDevStudio closed 3 years ago

GrimDevStudio commented 3 years ago

Hello, I'd like to say that the plugin is great and works just as expected when running an app from the IDE (Android Studio) but for some reason whenever I run a release build (produced with flutter build windows) there is no sound at all and no errors to go by. Am I missing something?

a103456a commented 3 years ago

I encountered the same problem, it seems that the plugin fails to load audio files from assets in release build.

MichealReed commented 3 years ago

Tested release with example, all seems to be in order. Please experiment with the example, or edit the original post here with more specifics on how to reproduce your case.

alexmercerind commented 3 years ago

I encountered the same problem, it seems that the plugin fails to load audio files from assets in release build.

@a103456a, How did you play audio file from assets? I don't think you provided a "dynamic path" to read it, possibly you just entered path of audio file stored in your app's development folder, which obviously won't play if you move or change location of that development folder (and neither your app's users will be able to play, as that file won't be on the specified location in their PC).

MichealReed commented 3 years ago

https://pub.dev/packages/dart_app_data is a good package for finding/setting folders for this purpose across platforms.

a103456a commented 3 years ago

@MichealReed @alexmercerind I provided a dynamic path to read my audio files (just like the way accessing picture or font assets), but still doesn't work. After moving them to the same folder with the .exe file, everything goes well.

Thanks for answering!

GrimDevStudio commented 3 years ago

Yes, I can confirm that this works also. Not sure if it's a bug with flutter itself or this plugin, but it sure is confusing, since all other assets (images, fonts, etc.) work out of the box.

alexmercerind commented 3 years ago

Hi there @GrimDevStudio! Its not a problem with this plugin, neither with the Flutter engine. As you know, that we mention assets of a Flutter project in pubspec.yaml, but its not the case with this plugin, because this plugin isn't playing "an asset" but "a file stored on your PC". We'll plan to add assets support in newer versions. For now, just keep the assets near the final build of your app (in the exact same structure, as you do in your development folder).

And that's not a "big problem" either, because for the most cases you'll play any file stored on user's device, which you can still do with this plugin.

GrimDevStudio commented 3 years ago

Ah, ok, I was not implying that there is a problem, just that it can be confusing for some users. It might not be a bad idea to add this bit of information to the documentation somewhere (apologies if it's already there, but I couldn't find it). Anyways, good work!