1

I'm experimenting with Ryan Heise's great audio packages in Flutter.
I import the Just Audio Background ("JAB") code from GitHub into Android Studio, and I run flutter pub get where necessary to get rid of any errors in the packages.

I want to replicate the simple radio player in the file example_radio.dart in the Just Audio package. But I need it to run in the background.

Following the setup instructions on the JAB pub.dev page, I make sure the dependencies are correct in pubspec.yaml and I edit the Android Manifest file.

I see some unresolved classes and packages in the Manifest (see screenshot); however, the app runs. But I am not sure about this. I'm new to Flutter and am not sure how important it is to have zero errors in the Android files, because I have seen other SO comments saying to just ignore them. This I must investigate.

Android Manifest file

When I run the app, everything works fine except the audio stops when it goes into the background.

I also ran the JAB example file, and this works fine, continues to play in the background. I have tried to edit this file so that it plays just the radio stream and shows the simple metadata. I've got it running, but the UI's a mess with my naive editing.

Any pointers, advice, much appreciated.

Thanks.

Nick Paxford
  • 13
  • 2
  • 2
  • Can you describe all the things you did? Adding that code is not the only thing you need to do, so before I ask whether you followed all of the setup instructions in just_audio_background, can you edit your post to mention it upfront? And if there is an error, can you include in your question what the exact error was in full? Alternatively if you're confident you're doing everything correctly and it doesn't work, you may instead report it as a bug. – Ryan Heise Jun 03 '22 at 09:20
  • @RyanHeise Ryan, many thanks for commenting on this! You made me slow down a bit and go though the steps properly. So now I'm not getting any errors, but I'm doing something wrong because I still can't get the `example_radio` file to play in the background. Cheers. – Nick Paxford Jun 04 '22 at 14:04
  • I see now that you've got it working but the UI's a mess. If the only thing you need to do to get it to work is clean up the UI, I personally wouldn't be the one to help you with that, but for someone else to help you, I think it would also be difficult since you haven't given any details about what UI problems you're having. The first part of your question is probably not needed for them, just the part about your remaining UI problem. – Ryan Heise Jun 05 '22 at 03:03
  • I will work on it, Ryan. Thanks for responding, it really helped, gave me confidence to keep with it. – Nick Paxford Jun 05 '22 at 17:52

0 Answers0