[iOS] No audio on a call answered from CallKit when configureAudioSession is false
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 45/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Dart
- スター
- 79
- フォーク
- 55
- 平均マージ
- 2日 12時間
- マージ済み PR(30日)
- 142
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
GetStream/stream-video-flutter のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
GetStream/stream-video-flutter#1661 ·
メンテナーはふだん 2 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
GetStream/stream-video-flutter#1621 ·
メンテナーはふだん 2 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
GetStream/stream-video-flutter#1615 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 52/100
GetStream/stream-video-flutter#1535 · コメント 2 件 ·
メンテナーはふだん 2 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 42/100
GetStream/stream-video-flutter#1430 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
GetStream/stream-video-flutter の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
wger-project/flutter#1428 · コメント 1 件 ·
メンテナーはふだん 5 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
ccch1mneyyy/dsh-Go#2051 ·
メンテナーはふだん 1 日以内に返信
-
documentation good first issue help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
younghwan91/fin-checkup#126 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 半日 初心者へのやさしさ 66/100
rajput-hemant/calculator#214 ·
-
duration: small priority: medium type: bug
難易度 2/5 1時間未満 初心者へのやさしさ 78/100
duobaseio/forui#1254 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信