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

[VOTE]: Audio Session Management #825

Closed
Larpoux opened this issue Jan 20, 2022 · 13 comments
Closed

[VOTE]: Audio Session Management #825

Larpoux opened this issue Jan 20, 2022 · 13 comments
Labels
help wanted Extra attention is needed Not yet handled

Comments

@Larpoux
Copy link
Collaborator

Larpoux commented Jan 20, 2022

We have a decision to take for Audio Session management inside Flutter Sound 9.0

Please, read this wiki page and vote.

@Larpoux Larpoux added help wanted Extra attention is needed Not yet handled labels Jan 20, 2022
@mhstoller
Copy link

mhstoller commented Jan 21, 2022

Removing the session handling in flutter_sound does make it more lightweight and (apparently) would improve compatibility with other plugins. But, flutter_sound has always been all encompassing and this is something that users benefit from. One package that lets you easily and quickly play and record audio.

Rather than re-architect this plugin to outsource the session management to another package I would advocate to use that time and effort to fix some of the bugs around playback and recording and make flutter_sound a better experience overall. Removing session management adds a lot of complexity to develop, document, and for other to migrate to the new version for very little benefit as far as I'm aware.

To some extent, stripping out session management makes flutter_sound more of a plugin for Just Audio. At that point why not just create a plugin for recording audio using Just Audio (as playback is already handled) and have that be the library? I'm not seeing the benefit to having something that will depend on Just Audio, but handle playback separately from it.

With regards to the content of the linked wiki:

Flutter Sound has compatibility issues with other plugins (like Just Audio)

I'm not understanding why users need both Just Audio and flutter_sound together. Can someone explain the use cases for this? Is this only for background playback, and if so, what is the current configuration being used for that to work with Flutter Sound and Just Audio for background playback?

There are some strange effects on iOS when Flutter Sound tries to manage several Flutter Sound Players or Recorders

flutter_sound can prevent multiple sessions internally with a mutex

@Larpoux
Copy link
Collaborator Author

Larpoux commented Jan 21, 2022

@mhstoller ,
Thank you for your post/feedback.
I really agree with much of your post.

At that point why not just create a plugin for recording audio using Just Audio (as playback is already handled) and have that be the library? I'm not seeing the benefit to having something that will depend on Just Audio, but handle playback separately from it.

Yes. More time is passing, more I think it would be a possibility.
Many Flutter Sound users love Just Audio.
And when I ask them what is the reason they choosedFlutter Sound instead of Just Audio, the main reason is always : because we need a recorder

Actually, Flutter Sound contributors seems to decide to remove the Audio Sessions Manager from Flutter Sound.
See the @alexda12's contribution on our wiki
But I agree with you, one reason I decided to use Flutter Sound it was because it was very simple to use.

@mhstoller , you VERY OFTEN contribute to Flutter Sound "customer(!)" support. And your feedback is really useful.
I really would be happy if your join us on discord :
It will be very positive for us. If you do not have much time, this is no problem : you can just overview what we are talking about, and just say your opinion. We try to be very quick to take decisions, and a real-time feed back can be very good.

I really would be happy if you consider you as a Flutter Sound contributor, even with a light work from you.

@Larpoux
Copy link
Collaborator Author

Larpoux commented Jan 21, 2022

If we take into account @mhstoller's vote, we actually have :

  • 1 vote for (proposition 1)
  • 1 vote against (proposition 2)
  • 2 blank votes. (Mine is actually blank)

If we apply direct-democraty rules, then this proposition is rejected. We are going to keep the Audio Session management inside Flutter Sound, unless someone change his/her vote or we have new votes.

@Larpoux
Copy link
Collaborator Author

Larpoux commented Jan 21, 2022

@mhstoller : would you kindly copy an paste your post into the wiki please ?

@mhstoller
Copy link

To be clear, I'm not necessarily saying that starting a recorder plugin for just audio is a bad idea, just that it would be its own project I would think. If users are really only using flutter_sound for recording and want to use Just Audio, then maybe it makes sense to abandon flutter_sound in favor of just a recorder plugin (which is sad given the amount of work you've done).

I always thought that flutter_sound's strength was that it did everything for playback and recording, but if this is not what users want from it or it is not a good way forward then I understand. Currently I see this other Record package for Flutter. I have tried it and ran into a problem with measuring decibel level on iOS and it doesn't seem to have a lot of contributors. We can maybe leverage that project, or port flutter_sound's existing recording features into a new project.

Just Audio seems to have a bigger community of developers around it, so creating a recording plugin for it will probably be well received. Flutter Sound has a lot of complexity and bugs/enhancements to work on but not many active contributors (I don't know if this has improved recently). If people only use flutter_sound for recording then this makes the most sense. I still am not clear on why flutter sound needs playback capability in addition to what Just Audio already offers, if we are to remove session management from flutter sound.

@therealjohnsummer
Copy link

@mhstoller I used to use Flutter_Sound entirely as at the time it served its purposesm but now I use both just_audio and flutter sound. You ask for use cases - here are some :

Just audio is much better at providing uninterrupted loopless/gapless playback. In addition just_audio has inbuilt support for caching & buffering something that AFAIK flutter sound doesnt have. Finally - and the biggest win point for me is that Just_audio has a LockCachingAudioSource whereby once an audio file is being streamed it is being concurrently downloaded thus the next time that the URL is activated , the local cache will be used in place - again, AFAIK Flutter Sound doesnt have this.

Regarding :

But, flutter_sound has always been all encompassing and this is something that users benefit from. One package that lets you easily and quickly play and record audio.

I think this is Flutter sounds downfall and consequently will introduce more complexity than added benefits. The great thing about pub.dev ecosystem is that plugin developers can create useful plugins that operate as a black-box and allow for easy integration between other plugins. Flutter sound doesnt facilitate this if it manages internally access/configuration to AVAudioSession/AudioManager.

Finally, on a positive note for Flutter Sound - its codec support is impressive and offers better consistent reliable playback of audio files from android-to-ios and ios-to-android then what Just_Audio offers.

@Larpoux
Copy link
Collaborator Author

Larpoux commented Jan 21, 2022

Thank you @therealjohnsummer for your feedback.
My own thinking (but it's just me) what I like in Flutter Sound are:

  • The support of audio streams with raw PCM
  • The possibility of managing the lock screen

Unfortunately, we are going to remove the lock screen management from Flutter Sound because we have some compatibility issues on Android.
For the PCM streams, the problem is that it is just a draft. Many things are missing:

  • no web support
  • just integer16
  • no control of the current level
  • big latency issue on Android
  • and many other things

Our idea is actually to develop another plugin separate from Flutter Sound and eventually later remove every thing about Raw PCM streams from Flutter Sound.

If some of you wants to participate to the specifications of this new plugin, please feel fre to join us on discord.

With this new vote, we have now:

  • 2 votes for removing the audio session management from Flutter Sound
  • 1 vote to keep it
  • 2 blank votes

@Larpoux
Copy link
Collaborator Author

Larpoux commented Jan 23, 2022

The polling station is close (closed?) .
The final vote is :

  • 3 votes for removing the audio session management from Flutter Sound
  • 1 vote to keep it
  • 1 blank vote

We are going to remove the Audio Session Management from Flutter Sound 9.0

@Larpoux Larpoux closed this as completed Jan 23, 2022
@therealjohnsummer
Copy link

@Larpoux this is a good decision. I look forward to the improved Flutter Sound 9.0

@Larpoux
Copy link
Collaborator Author

Larpoux commented Jan 23, 2022

@therealjohnsummer :
Perhaps you can join us on Discord

You will not have to spend much time on this forum if you do not have time. But you will know what we are talking about and you will be able to give your feedback with real-time.

Everybody must understand that it is very difficult to take the good decisions when we are alone.
I really believe in direct-democracy.
Discord is open for everybody.

@mrtnetwork
Copy link

This is a good idea, I worked with the audio_session plugin and it looks good on audio management

@Seferi
Copy link

Seferi commented Jan 31, 2022

In that case _myRecorder.openAudioSession() doesn't work anymore. How do we initiate it then ?

@Larpoux
Copy link
Collaborator Author

Larpoux commented Jan 31, 2022

openRecorder

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 Not yet handled
Projects
None yet
Development

No branches or pull requests

5 participants