[Feature]: Android app: watch and listen together, deep links
Una pull request collegata è già stata integrata.
- #59 di @PhrolovaMoe — integrata
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 20/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Ferma
- Stack tecnologico
- android, react-native, typescript
- Ambito
- backend-api-design, distributed-systems, mobile
Direzione di ricerca
Read epic #40 and the prerequisite issues #45 and #46 first; inspect the named web entry points web/src/routes/together.$code.tsx, player/Room.tsx, player/sync.ts, routes/listen.$code.tsx and music/listen.ts. The issue also names packages/shared as the destination for shared protocol logic. Done means implementing the listed Android room, link, guest and notification flows while preserving web behavior and meeting the sync, queue, sharing and Live Update acceptance criteria; a linked merged PR indicates work has already proceeded.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
[!NOTE]
This issue was written by Claude (Claude Opus 5.5) from a planning session with @PhrolovaMoe. Part of #40, builds on #45 and #46. Read the epic first.
Area
Streaming / playback
Problem
Watch together (web/src/routes/together.$code.tsx, player/Room.tsx, player/sync.ts) and listen together (routes/listen.$code.tsx, music/listen.ts) are core features. Rooms are joined through links, often by people who aren't signed in (public rooms allow named guests). The app has to speak both protocols, open room links, and let guests in.
Proposed solution
Protocols (facts; no server changes)
- Watch: a WebSocket at
/api/together/{code}/ws?name=<guest name>. Listen:/api/listen/{code}/ws?name=…. Both are plain JSON, not GraphQL. - The server authenticates the upgrade from the
Authorization: Bearerheader (or cookie). Guests are allowed into public rooms with aname(src/api/together.rs:27-39). - Messages are as in
sync.ts(Outgoing:ping,play/pause/seek,rate,status,tracks,media,name,settings,invite,end) andlisten.ts(plusskip,queue,add,remove,move). - The welcome message carries
serverTimefor clock sync. - Room media goes through room-scoped routes (
/api/together/{code}/media/{id}/…,/api/listen/{code}/tracks/{id}/…, room avatars and art), which work for guests.
Sharing code with web
- Move the platform-independent parts of
sync.tsandlisten.tsintopackages/shared, and make web use them too:- message types
- clock-offset estimation from the quickest recent round trips
- the snapshot model
- reconnect/backoff
- the drift-correction rules
- Inject the WebSocket constructor, the clock (
performance.timeOrigin + performance.now()on web, a monotonic clock on Android), and media control. - React Native's
WebSocketaccepts headers on Android (new WebSocket(url, undefined, { headers })). Use it for the Bearer token. - Web behaviour must not change.
Watching together
- The #45 player screen with the web
Room.tsxfeatures:- participants with avatars and status
- control mode (everyone/host), wait-for-all, public toggle
- invite users (
invite), copy/share the link, end the room RoomNotices, tap-to-join, and the room's own track selection (tracks)
- Phone presentation: a participants pill in the player's top bar, which opens a bottom sheet with people, settings and invite. Join/leave notices are toasts over the video.
- Sharing uses the Android share sheet with the room's https web URL (it works for people without the app).
- Drift correction drives the #45 module API (
seek,setRate,play/pause) assync.tsdrives<video>today.
Listening together
- A room screen like
listen.$code.tsx: Now Playing-style art, shared queue (add/remove/move with the reorder haptics), participants, invite, settings, and the ambient tint. - Playback goes through the #46 engine through
followRemote(shared in #46). The mini-player shows the room while you're in it.
Live Update for sessions
- While in a room, post a promoted ongoing notification (Android 16 Live Update; a normal ongoing notification on 14/15):
- "Watching together · 3 people" or "Listening together · 3 people", with the host's name
- tap to return to the room, and a "Leave" action
- Update it when people join or leave. Remove it when you leave or the room ends.
- Media playback keeps its media notification as well.
Deep links
- Custom scheme, handled with Expo Router linking:
tinystream://<host[:port]>/together/<code>tinystream://<host[:port]>/listen/<code>tinystream://<host[:port]>/title/<id>,/album/<id>,/artist/<id>,/playlist/<id>,/c/<code>(public clip pages, #49)- The scheme means https. Add
?insecure=1for http servers.
- Share to the app: an intent filter for
ACTION_SENDwithtext/plain. If the shared text contains a URL whose path matches one of the routes above (the web UI's paths are the same), handle it as the custom-scheme link for that origin. This is how "open a tinystream link in the app" works for any self-hosted domain. Verified https App Links can't be used, because they need every domain declared in the APK at build time. - Web UI change: on Android browsers (UA check), the web's together, listen and public clip pages show a small dismissible "Open in the app" banner linking to the matching
tinystream://URL. Dismissal is remembered in localStorage.
Resolving a link:
- If the link's origin matches a saved server, switch to it (#42 rules), then:
- signed in → open the screen
- room link and signed out → the guest flow
- anything else and signed out → sign in, then continue
- If it's an unknown server:
- room links → the guest flow
- other links → offer "Add this server" (#42 connect flow pre-filled), then continue
Guest flow:
- A sheet: "Join room title on server as a guest". A name field, prefilled with the last guest name used on this device, plus Join.
- Guests connect without a token and aren't added to the saved server list (offer "Add this server" after leaving).
- While joined as a guest, the rest of the app keeps showing the user's own active server. The room screen is modal over it.
Acceptance criteria
- Phone and web in the same watch room stay in sync (play, pause, seek, rate, and the correction after a stall), both as a signed-in user and as a guest.
- The same for listen rooms, including queue edits from either side.
- Sharing a room link from the browser to the app joins it.
adb shell am start -d "tinystream://host/together/CODE"joins. An unknown server leads to the guest flow. - The Live Update shows the participant count and Leave works.
- The web "Open in the app" banner appears on Android only.
- Lingua principale
- TypeScript
- Stelle
- 4
- Fork
- 1
- Merge medio
- 4h 49m
- PR unite (30g)
- 5
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di tinystream-dev/tinystream
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
tinystream-dev/tinystream#132 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
tinystream-dev/tinystream#131 ·
-
bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
tinystream-dev/tinystream#129 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
tinystream-dev/tinystream#128 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
tinystream-dev/tinystream#124 ·
Tutte le issue di tinystream-dev/tinystream
Issue simili
-
Console writes URL credentials to the local log, though AGENTS.md says secrets never reach diskAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 86/100
sandbox-quantum/switch#2163 ·
I maintainer di solito rispondono entro 1 giorno
-
automated issue report
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
area/dashboard kind/bug QA/dev-automation
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
bug pydanty:is-working
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
pydantic/pydantic-ai#13939 ·
I maintainer di solito rispondono entro 1 giorno
-
self-host
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
funmusicplace/mirlo#2625 ·
I maintainer di solito rispondono entro 1 giorno