[iOS] No audio on a call answered from CallKit when configureAudioSession is false
Los mantenedores suelen responder en 2 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 45/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Área
- audio-video-rtc, mobile
Línea de trabajo
Start by reading the iOS push notification plugin’s CallKit answer handling and its configureAudioSession() implementation, especially provider(_:perform: CXAnswerCallAction) and provider(_:didActivate:). The report identifies the missing recording category when configuration is disabled, but leaves the preferred fix open among several options. Done means an incoming CallKit answer activates audio with configureAudioSession: false while leaving session activation to the app; check existing iOS CallKit and audio session tests, if present.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Summary
stream_video_push_notification either fully manages AVAudioSession for every CallKit call (configureAudioSession: true) or does nothing at all (false). An app that lets WebRTC own the audio session has to pass false. Then a call answered on the CallKit screen gets no audio in either direction: CallKit never activates the audio session, because the category still can't record when the call is answered.
Environment
stream_video_flutter/stream_video_push_notification1.7.2 (git ref2ec78303dbc6fe8043e104b4cd378d56b2159a4e)- iOS 26.6, iPhone 15 Pro (physical device)
- Ringing call (
getOrCreate(ringing: true)), received as a VoIP push (APN provider) and shown by the plugin with CallKit IOSPushConfiguration(configureAudioSession: false, ...)- Audio session configured through
AudioConfigurationPolicy.custom(playAndRecord/voiceChat, nomixWithOthers)
Steps to reproduce
- Set
configureAudioSession: falseinStreamVideoPushConfiguration.ios. - Put the callee app in the background. No call has been joined yet, so WebRTC hasn't configured
AVAudioSessionand its category is still the default. - Ring the callee from another device.
- Answer on the CallKit screen, then accept and join the call in the app (
consumeIncomingCall→accept→join).
Expected
CallKit activates the audio session (provider(_:didActivate:)), and the call has audio both ways.
Actual
- The call joins and both peer connections reach
connected. The remote audio track is received, and the SFU reports the remote participant speaking. provider(_:didActivate:)is never called after the answer, and noActionCallToggleAudioSessionevent arrives.- Neither side hears anything.
Cause
When the call is answered, the audio session category is still the app's default, which can't record. With configureAudioSession: false, the plugin's configureAudioSession() is a no-op in both provider(_:perform: CXAnswerCallAction) and provider(_:didActivate:). So nothing sets playAndRecord before the answer action is fulfilled, and CallKit doesn't activate the session. Apple expects the app to configure the category before fulfilling CXAnswerCallAction.
Outgoing calls aren't affected: the app joins first, which lets WebRTC configure the session, and only then reports the call to CallKit (startOutgoingCall).
This is confirmed indirectly: an extra CXAnswerCallAction issued later, after WebRTC had set playAndRecord, did trigger didActivate, and audio came up.
Why configureAudioSession: true isn't an option
With true, the plugin applies a fixed configuration to every call, outgoing included, which overrides the one WebRTC applies:
- options are hard-coded:
.allowBluetoothA2DP,.duckOthers,.allowBluetooth(no way to drop ducking or add.allowAirPlay) setPreferredSampleRate(44100)andsetPreferredIOBufferDuration(0.005)setActive(true)is called by the plugin, although with CallKit the system is meant to activate the session
In our case this broke the audio route of outgoing calls, for example the CallKit speaker button. So false is the only workable setting, and incoming calls then have no audio.
Workaround
We observe CallKit from the app and set the category as soon as an incoming call starts ringing. We don't activate the session ourselves:
final class IncomingCallAudioSession: NSObject, CXCallObserverDelegate {
private let callObserver = CXCallObserver()
override init() {
super.init()
callObserver.setDelegate(self, queue: .main)
}
func callObserver(_ callObserver: CXCallObserver, callChanged call: CXCall) {
guard !call.isOutgoing, !call.hasConnected, !call.hasEnded else { return }
let rtc = RTCAudioSession.sharedInstance()
guard rtc.category != AVAudioSession.Category.playAndRecord.rawValue else { return }
rtc.lockForConfiguration()
defer { rtc.unlockForConfiguration() }
try? rtc.setCategory(
.playAndRecord,
mode: .voiceChat,
options: [.allowBluetoothHFP, .allowBluetoothA2DP, .allowAirPlay]
)
}
}
It's created in application(_:didFinishLaunchingWithOptions:). An app launched by a VoIP push may not have a Flutter engine yet when the call rings, so it can't live in a Flutter plugin.
Proposed fix
Any of these would remove the need for the workaround:
- Always set a recording category before fulfilling the answer. When
configureAudioSessionis false, still setplayAndRecord(with a configurable mode and options) inCXAnswerCallAction, withoutsetActive, and leave the rest to the app. - Per-direction setting. For example
configureAudioSessionForIncoming/configureAudioSessionForOutgoing, so the plugin can configure answered calls only. - Configurable options. Let
IOSPushConfigurationtake the category options (and skip the sample rate, buffer duration andsetActivecalls), soconfigureAudioSession: truecan match the app's WebRTC configuration. - Document it. At least note that
configureAudioSession: falserequires the app to set a recording category before a CallKit answer.
Related plugin behaviour we ran into
Calling setCallConnected on an incoming call that was already answered requests another CXAnswerCallAction (StreamCallKitCallController.connectedCall). That emits a second ActionCallAccept for the same call. It's easy to hit when an app marks every call connected the same way, as you would for outgoing calls. Ignoring incoming calls in connectedCall, or documenting that it's for outgoing calls only, would help.
- Lenguaje dominante
- Dart
- Estrellas
- 79
- Forks
- 55
- Merge medio
- 2 d 12 h
- PR fusionados (30 d)
- 142
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de GetStream/stream-video-flutter
-
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
GetStream/stream-video-flutter#1661 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
GetStream/stream-video-flutter#1621 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
GetStream/stream-video-flutter#1615 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
Dificultad 4/5 3-5 días Aptitud para principiantes 52/100
GetStream/stream-video-flutter#1535 · 2 comentarios ·
Los mantenedores suelen responder en 2 días
-
Dificultad 4/5 3-5 días Aptitud para principiantes 42/100
GetStream/stream-video-flutter#1430 · 1 comentario ·
Los mantenedores suelen responder en 2 días
Todos los issues de GetStream/stream-video-flutter
Issues similares
-
Dificultad 2/5 Medio día Aptitud para principiantes 66/100
rajput-hemant/calculator#214 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
leancodepl/marionette_mcp#160 ·
Los mantenedores suelen responder en 4 días
-
claude
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
linagora/tmail-flutter#5180 ·
Los mantenedores suelen responder en 1 día
-
needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
decentespresso/decaid#1257 ·
Los mantenedores suelen responder en 1 día