ryanheise / audio_session

MIT License
107 stars 68 forks source link

Can not play by speaker on iOS #115

Closed SELiOTe closed 7 months ago

SELiOTe commented 7 months ago

avAudioSessionCategory set to soloAmbient, avAudioSessionMode is defaultMode, but always play audio from receiver

iPhone XR iOS 15.7 Flutter 3.13.9 just_audio: ^0.9.35 audio_session: ^0.1.17

ryanheise commented 7 months ago

I suggest asking on the Apple forums about the behaviour of their API (or on StackOverflow).

SELiOTe commented 7 months ago

I suggest asking on the Apple forums about the behaviour of their API (or on StackOverflow).

Finally i found it's a bug by record: ^5.0.1, i set AudioSession globally, but record changed AudioSession each time

ryanheise commented 7 months ago

Ah, yes. You might consider pointing the record author to the audio_session README which explains the issue and why plugins sharing the audio session need to cooperate. audio_session obviously provides an easy solution to plugin authors, but alternatively the plugin author could just redesign its API to add an optional boolean parameter to its method that can be used to prevent it from overwriting the audio session.