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

manageAudioSession option for IosRecordConfig #401

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bbjay
Copy link

@bbjay bbjay commented Sep 18, 2024

Hi there,

I'm using this plugin alongside just_audio and audio_session plugins in my app.
Because my players have to support audio route switching, I am using the audio_session plugin for it.
With this setup, I ran into the following issues when recording on iOS:

  • sometimes the first 1-2 seconds of a recording is being truncated
  • notifications of route changes stopped working

The reason for this is that AudioRecorder.start() also configures the shared AVAudioSession and activates it,
after I already have configured and activated it through audio_session.
This re-activation can cause a delay in audio processing when recording and also explains the cancelation of
an existing route change subscription.
(On Android everything is working fine, since this plugin does not touch the AudioManager attributes)

With the added IosRecordConfig.manageAudioSession option set to false, I can circumvent these issues.
It defaults to true, so no changes in default behavior.

May I also suggest a renaming of the IosRecordConfig.audioCategories field to audioCategoryOptions?
Because the category, currently hardcoded to .playAndRecord, is a different property of the audio session.
I think the IosRecordConfig addition has not been released yet, so no breaking change would be introduced.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant