[Android] Speaker can't be selected while a call is registered with Telecom (no way to request a Telecom call endpoint)
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- android, dart
- Domain
- audio-video-rtc, mobile
Research direction
Start by tracing Call.setAudioOutputDevice through RtcManager.setAudioOutputDevice, then inspect the Telecom integration’s TelecomCallAction.kt, TelecomCallRepository.processCallActions, and StreamTelecomManager method-channel events. Compare endpoint switching with the Android and React Native SDKs cited in the issue. Done means selecting speaker during a Telecom-managed call requests the matching Telecom endpoint and routes audio through the speaker.
Written by the indexing model from the issue text.
Description
[Android] Speaker can't be selected while a call is registered with Telecom (no way to request a Telecom call endpoint)
Summary
With the Android Telecom integration of stream_video_push_notification enabled, switching the call audio to the loudspeaker with call.setAudioOutputDevice(speaker) has no effect on Android 17: the audio keeps playing through the earpiece.
Once a call is registered with Telecom through Jetpack Telecom (CallsManager.addCall), Telecom owns the call's audio route (its call endpoint). The plugin observes the endpoint (currentCallEndpoint / availableEndpoints, forwarded as the telecomAudioEndpointsChanged custom event), but there is no way to change it: TelecomCallAction only has Answer, Disconnect, Hold and Activate, and CallControlScope.requestEndpointChange is never called. Meanwhile the SDK's own output API goes around Telecom (setAudioOutputDevice → rtc.Helper.selectAudioOutput → AudioSwitch → AudioManager.setSpeakerphoneOn), so on Android 17 Telecom keeps its own route.
The integration is on by default on Android 17, and an accepted ringing call stays registered with Telecom (dismissRingingCall), so this probably affects any app that offers a speaker toggle on Android 17, not only apps that opt in below 17. We have only reproduced it with an outgoing call registered through startOutgoingCall; the ringing path is an inference from the code.
Stream's native Android SDK and React Native SDK already solve this by routing output selection through requestEndpointChange while the call is Telecom-managed (details below). The Flutter plugin is missing that part of the integration.
Environment
stream_video / stream_video_flutter / stream_video_push_notification |
1.7.2, git ref 2ec78303dbc6fe8043e104b4cd378d56b2159a4e. The same code is still on main as of a1f1862b. |
stream_webrtc_flutter |
4.0.1 |
androidx.core:core-telecom |
1.0.1 (via the plugin) |
| Device | Google Pixel 6a, Android 17 |
| Not reproducible on | Android 15, same build (Telecom integration also active there) |
App targetSdk |
36 |
Steps to reproduce
-
Enable the Telecom integration:
StreamVideoPushNotificationManager.create( // providers ... pushConfiguration: const StreamVideoPushConfiguration( android: AndroidPushConfiguration( telecom: TelecomPushConfiguration(enabled: true), // default on Android 17 ), ), ); -
Join an audio call on the earpiece, then register it with Telecom:
await call.join(connectOptions: CallConnectOptions( audioOutputDevice: earpiece, // RtcMediaDevice with id 'earpiece' )); await pushManager.startOutgoingCall(uuid: uuid, callCid: call.callCid.value, ...); await pushManager.setCallConnected(uuid); -
During the call, switch to the loudspeaker:
await call.setAudioOutputDevice(speaker); // RtcMediaDevice with id 'speaker'
Expected: audio plays through the loudspeaker.
Actual: audio keeps playing through the earpiece. setAudioOutputDevice returns success.
The same steps worked before we enabled the Telecom integration, and still work on Android 15 with it enabled.
Evidence
- In our logs, the
ActionCallCustomevents (telecomAudioEndpointsChanged) arrive once or twice right after the call connects and never again after the user selects the speaker. If Telecom's route had changed,currentCallEndpointwould have emitted and a new event would have arrived. So Telecom never moved off the earpiece. TelecomCallAction.kthas onlyAnswer,Disconnect(cause),HoldandActivate. Nothing inTelecomCallRepository.processCallActionscallsrequestEndpointChange.StreamTelecomManagerforwards endpoint changes to Dart (onCallAudioEndpointsChanged→ACTION_CALL_CUSTOMwithtype: telecomAudioEndpointsChanged), but there is no method-channel call or Dart API to request one.RtcManager.setAudioOutputDeviceon mobile callsrtc.Helper.selectAudioOutput(device.id). On Android that goes to AudioSwitch, which switches to the speaker withAudioManager.setSpeakerphoneOn(true)(deprecated since API 31) and doesn't involve Telecom.- For calls added through
CallsManager, the documented way to change the route isCallControlScope.requestEndpointChange(CallEndpointCompat). Android 15 apparently still respects an app's ownsetSpeakerphoneOnfor such calls. Android 17 does not.
We haven't pinned down which platform change in Android 17 causes Telecom to keep its route, and can capture adb logcat -s Telecom AudioService / dumpsys telecom if that helps. Going by the comment in your Android SDK (below), it isn't specific to Android 17: it was already seen on a Samsung S21 Ultra running Android 14.
How the other Stream SDKs handle it
Android SDK (GetStream/stream-video-android, checked at e344e8c)
MediaManager.kt,select(device): after selecting the device through the audio handler, it mirrors the selection to Telecom whenever the call is Telecom-managed (requestTelecomEndpointSwitch). The code comment explains why: for Telecom-managed calls, Telecom's routing takes priority overAudioManager.setCommunicationDevice(), and it cites a Samsung S21 Ultra on Android 14.- It maps
Speakerphone/Earpiece/BluetoothHeadset/WiredHeadsetto the matchingCallEndpointCompat.TYPE_*. If that endpoint isn't available yet, it waits up to 2 seconds for it. It skips the request when the endpoint is already current, and lets a newer selection supersede an older one (TelecomEndpointSwitchCoordinator). JetpackTelecomRepository.kthandlesTelecomCallAction.SwitchAudioEndpointwithrequestEndpointChangeand logs the result.
React Native SDK (GetStream/stream-video-js, checked at c6df247)
react-native-callingx(Android) exposesrequestAudioEndpointChange(callId, endpointId)andgetAvailableAudioEndpoints(callId). On the Kotlin side these becomeCallAction.SwitchAudioEndpoint→requestEndpointChangeinTelecomCallRepository.kt.react-native-sdk,CallManager.ts: when the call is Telecom-managed ("Android Telecom owns routing"),select(deviceId)andsetForceSpeakerphoneOn(force)go through callingx, and the device list and selected device are read from the Telecom endpoint snapshot.- callingx also passes a preferred starting endpoint when adding the call, based on
CallsManager.getAvailableStartingCallEndpointsand a sticky default preference. That way a call that should start on the speaker does so under Telecom too.
Suggested fix
Essentially, port what the Android SDK and React Native SDK already do:
- Add an endpoint request to the Telecom integration, for example:
TelecomCallAction.RequestEndpoint(type)handled inprocessCallActionswithrequestEndpointChange(...). Look the endpoint up in the repository's trackedavailableCallEndpoints, not by collectingavailableEndpointsa second time: those flows are channel-backed, so a second collector steals values from the first.- a method-channel call and Dart API, e.g.
StreamVideoPushNotificationManager.setTelecomAudioEndpoint(uuid, type), returning whether Telecom accepted it.
- While a call is registered with Telecom, have
Call.setAudioOutputDeviceon Android also request the matching Telecom endpoint. The ids map one to one:speaker→TYPE_SPEAKER,earpiece→TYPE_EARPIECE,wired-headset→TYPE_WIRED_HEADSET,bluetooth→TYPE_BLUETOOTH. - Optionally, follow Telecom when it changes the route itself (system output switcher, a headset connecting), so
CallState.audioOutputDevicestays accurate. - Optionally, pass a preferred starting endpoint when registering the call, as callingx does, so a call joined with
speakerDefaultOn/ a speakeraudioOutputDevicestarts on the speaker under Telecom too. - Until then, the README section "Android Telecom integration" could mention that output switching isn't supported while a call is registered with Telecom.
- Dominant language
- Dart
- Stars
- 79
- Forks
- 55
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 142
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from GetStream/stream-video-flutter
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
GetStream/stream-video-flutter#1661 ·
Maintainers usually reply within 2 days
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
GetStream/stream-video-flutter#1652 ·
Maintainers usually reply within 2 days
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
GetStream/stream-video-flutter#1615 · 1 comment ·
Maintainers usually reply within 2 days
-
Difficulty 4/5 3-5 days Newbie friendliness 52/100
GetStream/stream-video-flutter#1535 · 2 comments ·
Maintainers usually reply within 2 days
-
Difficulty 4/5 3-5 days Newbie friendliness 42/100
GetStream/stream-video-flutter#1430 · 1 comment ·
Maintainers usually reply within 2 days
All issues in GetStream/stream-video-flutter
Similar issues
-
Difficulty 2/5 Half a day Newbie friendliness 66/100
rajput-hemant/calculator#214 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
leancodepl/marionette_mcp#160 ·
Maintainers usually reply within 4 days
-
claude
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
linagora/tmail-flutter#5180 ·
Maintainers usually reply within 1 day
-
needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
decentespresso/decaid#1257 ·
Maintainers usually reply within 1 day