-
Notifications
You must be signed in to change notification settings - Fork 240
feat(audio): engine availability control and external call system session mode #1127
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
Changes from all commits
71c4ad9
48fb184
05ec2fa
3cbf322
5171793
dd6f1e0
673d744
81a60e4
11af808
b70b39b
215ba61
1c5abc3
10c913a
9c69af1
6af4614
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| minor type="added" "Audio engine availability and externalCallSystem mode for CallKit" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| // Copyright 2026 LiveKit, Inc. | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| import 'package:meta/meta.dart'; | ||
|
|
||
| /// Whether the WebRTC audio engine is allowed to run, per direction. | ||
| /// | ||
| /// This is the highest-priority gate over anything that may start the engine | ||
| /// (enabling the microphone, starting playback of remote audio). Requests | ||
| /// made while a direction is unavailable are not lost: the engine starts as | ||
| /// soon as availability allows. | ||
| /// | ||
| /// Used to coordinate with platform call systems that own audio activation | ||
| /// timing, such as CallKit on iOS: keep the engine unavailable until | ||
| /// `provider(didActivate:)` and make it available inside the | ||
| /// activate/deactivate window. See `AudioManager.setEngineAvailability`. | ||
| /// | ||
| /// Experimental: this API may change in a future release. | ||
| @experimental | ||
| class AudioEngineAvailability { | ||
| /// Whether the engine may run its input (microphone / recording) side. | ||
| final bool isInputAvailable; | ||
|
|
||
| /// Whether the engine may run its output (playout / remote audio) side. | ||
| final bool isOutputAvailable; | ||
|
|
||
| const AudioEngineAvailability({ | ||
| required this.isInputAvailable, | ||
| required this.isOutputAvailable, | ||
| }); | ||
|
|
||
| /// Both input and output are available (the default). | ||
| static const defaultAvailability = AudioEngineAvailability(isInputAvailable: true, isOutputAvailable: true); | ||
|
|
||
| /// Neither input nor output is available. The engine will not run. | ||
| static const none = AudioEngineAvailability(isInputAvailable: false, isOutputAvailable: false); | ||
|
|
||
| @override | ||
| bool operator ==(Object other) => | ||
| other is AudioEngineAvailability && | ||
| other.isInputAvailable == isInputAvailable && | ||
| other.isOutputAvailable == isOutputAvailable; | ||
|
|
||
| @override | ||
| int get hashCode => Object.hash(isInputAvailable, isOutputAvailable); | ||
|
|
||
| @override | ||
| String toString() => | ||
| 'AudioEngineAvailability(isInputAvailable: $isInputAvailable, isOutputAvailable: $isOutputAvailable)'; | ||
| } |
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Audio session configuration not re-applied when switching from manual to external-call-system mode The mode transition check ( Impact: An app that switches from manual to external-call-system mode mid-session will keep the old audio session configuration until the next engine lifecycle event, causing incorrect audio routing or category. Mechanism: the re-apply condition doesn't account for externalCallSystem being an automatic-configuration modeBefore this PR there were only two modes ( The fix should check whether the new mode is any automatic-configuration mode, e.g.: or equivalently check both Was this helpful? React with 👍 or 👎 to provide feedback.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yea I think that's expected, mid-session switching is not really supported. |
Uh oh!
There was an error while loading. Please reload this page.