[Android] Speaker can't be selected while a call is registered with Telecom (no way to request a Telecom call endpoint)
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
- 48/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- android, dart
- Área
- audio-video-rtc, mobile
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
[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.
- 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 45/100
GetStream/stream-video-flutter#1652 ·
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 1-3 horas Aptitud para principiantes 62/100
wger-project/flutter#1428 · 1 comentario ·
Los mantenedores suelen responder en 5 días
-
[Feature] 会话侧栏的「伙伴小屋」入口行希望能隐藏Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
ccch1mneyyy/dsh-Go#2051 ·
Los mantenedores suelen responder en 1 día
-
documentation good first issue help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
younghwan91/fin-checkup#126 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 Medio día Aptitud para principiantes 66/100
rajput-hemant/calculator#214 ·
-
duration: small priority: medium type: bug
Dificultad 2/5 Menos de una hora Aptitud para principiantes 78/100
duobaseio/forui#1254 · 1 comentario ·
Los mantenedores suelen responder en 1 día