daef7ea190
Helper functions (matrix-mas capability group): - mas_client_register_bash_infra: register/sync OAuth clients via mas-cli - mas_syn2mas_migration_bash_infra: dry-run + apply user migration to MAS - synapse_msc3861_enable_go_infra: edit homeserver.yaml MSC3861 block (with diff) - wellknown_oidc_patch_go_infra: patch well-known JSON with msc2965.authentication - synapse_login_flows_check_go_infra: health-check post-migration login flows Flows + issues for custom Matrix clients (PC + Android): - 0010 matrix-client-pc: Wails + React+Mantine (issues 0147-0153) - 0011 matrix-client-android: Kotlin + Compose (issues 0154-0161) - 0162 enable MAS as auth provider (Synapse delegate) — EXECUTED on VPS - 0163 custom admin panel propio (sustituye synapse-admin) Production state (organic-machine.com): - Synapse migrated SQLite -> Postgres - MSC3861 active, password_config disabled - 21 users + 41 access_tokens migrated via syn2mas - 4 MAS clients registered (element, matrix_pc, matrix_android, admin_panel) - synapse-admin container removed + Coolify route deleted - well-known patched with org.matrix.msc2965.authentication Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
74 lines
3.5 KiB
Markdown
74 lines
3.5 KiB
Markdown
---
|
|
id: "0158"
|
|
title: "matrix-client-android calls LiveKit nativo: mic/cam/screen + PiP"
|
|
status: pending
|
|
priority: high
|
|
created: 2026-05-24
|
|
related_flows: ["0011"]
|
|
related_issues: ["0157", "0159", "0161"]
|
|
dependencies: ["0157"]
|
|
tags: [matrix, android, livekit, calls, webrtc, pip, audio-focus]
|
|
---
|
|
|
|
## Objetivo
|
|
|
|
Llamadas nativas via `io.livekit:livekit-android` SDK oficial. Codecs HW (H.264/VP9 hardware decoder), audio focus + AEC/NS nativos, MediaSession para controls en lockscreen, Picture-in-Picture mode Android nativo. Soporta 1:1 + grupales (limite 16 del LiveKit config actual).
|
|
|
|
## Tareas
|
|
|
|
1. Backend (compartido con cliente PC):
|
|
- Reusar `livekit_token_gen_go_infra` que esta en flow 0010.
|
|
- Cliente Android pide token al mismo endpoint `/api/call/token` que el cliente PC.
|
|
2. ViewModel:
|
|
- `CallViewModel(matrixClient, roomId)`:
|
|
- `joinCall()` — pide token + conecta `Room.connect()`.
|
|
- `toggleMic()`, `toggleCamera()`, `toggleScreenShare()`.
|
|
- `hangup()`.
|
|
- `Flow<CallState>` con participants, tracks, connection state.
|
|
3. Compose:
|
|
- `CallScreen` fullscreen:
|
|
- Grid tiles participantes (`Flow` layout responsive 1/2/4/9/16).
|
|
- Tile principal: active speaker (track audio level del SDK).
|
|
- Controles bottom: mic, cam, screen, raise hand, hangup.
|
|
- `IncomingCallScreen` fullscreen con accept/decline (system overlay activity).
|
|
- `CallTile` composable con `VideoView` (SurfaceViewRenderer del SDK).
|
|
4. PiP (Picture-in-Picture):
|
|
- `Activity` con `setPictureInPictureParams()`.
|
|
- Auto-enter PiP al minimizar la app durante call.
|
|
- PiP tile: video remoto + boton hangup.
|
|
5. Audio routing:
|
|
- `AudioFocusRequest` (Android 8+) — focus exclusivo durante call.
|
|
- Switch speaker/earpiece/bluetooth via `AudioManager.setSpeakerphoneOn()` + connection state listeners para audifonos BT.
|
|
- Echo cancellation + noise suppression: SDK los habilita por defecto, verificar.
|
|
6. ICE/TURN: igual que cliente PC, depende del LiveKit config server-side.
|
|
7. Tests:
|
|
- Instrumented `Call1to1Test` con emulator + segundo cliente (PC) — connect, video, hangup.
|
|
- Manual `ScreenShareTest` con device fisico.
|
|
- Manual `4ParticipantsTest`.
|
|
- Manual `PiPTest` — call activa + Home button -> PiP aparece.
|
|
|
|
## Funciones del registry a crear
|
|
|
|
- `livekit_call_kotlin_infra` — wrapper `Room` SDK + permission helpers.
|
|
- `audio_routing_kotlin_infra` — speaker/earpiece/BT switching.
|
|
- `CallScreen_kotlin_ui` — fullscreen call UI.
|
|
- `CallTile_kotlin_ui` — tile con VideoView.
|
|
- `IncomingCallScreen_kotlin_ui` — accept/decline overlay activity.
|
|
|
|
## Acceptance
|
|
|
|
- [ ] Start call desde Android -> PC Wails recibe y conecta.
|
|
- [ ] 30s call con video+audio nativo (verificar HW codec via `adb shell dumpsys media.codec`).
|
|
- [ ] Mute mic + apagar cam refleja en otro cliente.
|
|
- [ ] Screen share desde Android (con `MediaProjection`) visible en PC.
|
|
- [ ] PiP: minimizar app durante call -> tile flotante con video remoto.
|
|
- [ ] Bluetooth headphones: cambio automatico al conectar/desconectar.
|
|
- [ ] Battery: call 30min con AC + WiFi <15% drain.
|
|
|
|
## Notas
|
|
|
|
- Permissions runtime: `RECORD_AUDIO`, `CAMERA`, `POST_NOTIFICATIONS` (Android 13+), `FOREGROUND_SERVICE`, `FOREGROUND_SERVICE_MEDIA_PROJECTION` (Android 14+).
|
|
- Foreground service requerido para mantener call con app en background (issue 0161).
|
|
- E2EE en call (insertable streams): TBD post-DoD, igual que en cliente PC.
|
|
- Connection service Android (sistema): TBD, opcional. Permite integracion con dialer system + Bluetooth Car. Valorar coste/beneficio.
|