Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HELP] BackgroundAudioService causing problems with another package #52

Closed
kbanta11 opened this issue Oct 28, 2020 · 13 comments
Closed
Labels
help wanted Extra attention is needed

Comments

@kbanta11
Copy link

I am using the Sounds package primarily for the recorder. I am not using the SoundPlayer (since it requires the file to be completely downloaded before playing, which isn't viable for a podcast app when the download delay could take 10+minutes), but am instead using a different audio player (audioplayers) and audio_service for the notification state. This appears to all be working fine, except for the media buttons in the notification state don't work because both audio_service (correctly) and sounds (incorrectly since I'm not using the player or shade player) are registering to the same media buttons which is causing errors.

Does anyone know how to prevent sounds from registering the background audio service/notification area so I can handle this with the audio_service package?

@kbanta11 kbanta11 added the help wanted Extra attention is needed label Oct 28, 2020
@kbanta11
Copy link
Author

kbanta11 commented Nov 10, 2020

I've been able to get his working on Android by removing most of the shade player code (trying to strip down to just the recorder but it seems the soundplayer is still required for the recorder to work). This, however, causes the plugin to not be able to build when I try the iOS version (even though I've only removed/edited android and lib code). It leads to this error:
ios/Runner/GeneratedPluginRegistrant.m:174:4: Use of undeclared identifier 'Sounds'.

I'm really not sure how to proceed, but this is breaking my project in all ways I've attempted. I either can't build with my edited sounds package for iOS (but works for Android), or I can leave the sounds package untouched, but it then will cause major breaking errors due to sounds assuming that I want to use the shade player and registers the media buttons, which breaks the audio_service package, which is the one I need to use at it works properly (whereas sounds player does not, due to the long delay in waiting for the audio file to completely download before starting, sometimes up to 10 minutes which isn't workable for my use case as I need more on-demand audio streaming (podcast player, no one will wait for 10 minutes before they can start listening to any podcast). Any ideas why I'm getting the undeclared identifier error in iOS? Or is there a better way to keep sounds from trying to register the shade player so it doesn't break audio_service?

@Larpoux
Copy link
Contributor

Larpoux commented Nov 10, 2020

I am curious to know if the sound that you are trying to play is a remote file or a remote stream

@kbanta11
Copy link
Author

I am trying to play a remote file (either the podcast files from the RSS feed or audio files stored on firebase). When I use the audioplayers plugin, I can start playing files almost immediately, but it doesn't have a notification area feature, so I've paired it with audio_service and am only using sounds for the recorder (since there doesn't appear to be any other good Flutter audio recorder). When I try to play the same podcast episode between audioplayers and sounds, sounds will often take more than a couple of minutes to begin playing whereas audioplayers begins after only a few seconds.

@Larpoux
Copy link
Contributor

Larpoux commented Nov 10, 2020

I see :-/

One feature which is badly missing on Flutter Sound is the possibility to play from a remote Stream (webRTC).
But the current TODO stack is full and not enough contributors

@kbanta11
Copy link
Author

Yeah, that's another feature I'm waiting on, but first am trying to just finish the podcast player portion which is proving a challenge. I'm not sure what audioplayers does differently that allows it to start playing so much quicker, might be worth looking into. I've noticed things beginning to pile up and have been trying to figure out some of these issues on my own, but admittedly, I have basically zero iOS native development experience and only a few years of native Android development. I will look into seeing how I can help though! (though might not be going anywhere fast if I can't figure out how to get it to even build on iOS haha)

@Larpoux
Copy link
Contributor

Larpoux commented Nov 10, 2020

You can post a "Problem Report" on Flutter Sound, so that someone, one day, maybe, perhaps, will take care of your needs.

This is the best you can do if you want work on that issue. Probably port audioplayers code inside Flutter Sound.
But I do not guarantee any delay.

@kbanta11
Copy link
Author

What I really don't get is why iOS gives me the undeclared identifier error for the sounds package, but only after I made changes to my fork of the package. From what I can tell, the sounds class exists, and even if I make no changes to ANY of the iOS code, it still gives me this error, but only if I'm using my forked version. Does anyone have any insight into why xcode would consider Sounds to be undeclared? (or where to start looking)?

@Larpoux
Copy link
Contributor

Larpoux commented Nov 10, 2020

This is a question for my friend @bsutton 👀

@Larpoux
Copy link
Contributor

Larpoux commented Nov 10, 2020

re-post

@relf108
Copy link
Collaborator

relf108 commented Nov 12, 2020

The most likely scenerio I can think of with you're issues on the forked version of sounds is that we've pushed a breaking iOS change to GitHub and kept the pub package on a (semi) stable version which is what you're using when you're not forking (correct me if I'm wrong). We've been working super hard these past few days in getting out some major changes regarding how we're handling the iOS side of the project and as such haven't had much of a chance to clean up master. That being said, I've got a lot of free time as of a few days ago all of which is going into finishing this major refactoring so stay tuned for that. Once it's done we'll be clearing up all the issues which have come in over the past couple weeks.
Thanks so much for your patience and we hope to have this dealt with soon :)

@kbanta11
Copy link
Author

The most likely scenerio I can think of with you're issues on the forked version of sounds is that we've pushed a breaking iOS change to GitHub and kept the pub package on a (semi) stable version which is what you're using when you're not forking (correct me if I'm wrong). We've been working super hard these past few days in getting out some major changes regarding how we're handling the iOS side of the project and as such haven't had much of a chance to clean up master. That being said, I've got a lot of free time as of a few days ago all of which is going into finishing this major refactoring so stay tuned for that. Once it's done we'll be clearing up all the issues which have come in over the past couple weeks.
Thanks so much for your patience and we hope to have this dealt with soon :)

Do we have an idea of what the last commit was that worked for iOS to work off of that in my fork? Or an estimate on work needed for FFI to be complete and a new version compatible with iOS to be ready (happy to help with what little I'm able, if there is anything)?

@bsutton
Copy link
Owner

bsutton commented Jan 12, 2021

@kbanta11 Kyle we would love some help with the ffi work particularly if you have an ios background.

I've raised an issue #60 to track what is going on with the ffi conversion.
Its still a bit light on so raise questions against that issue and I will try to answer them.
I'm a little bogged down with other project for the next couple of weeks so not much will be happening at this end.

@bsutton
Copy link
Owner

bsutton commented Mar 18, 2021

We have delayed the ffi work to get out a 1.0.0 release. The full swift code is on master.

@bsutton bsutton closed this as completed Mar 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants