Surface and cache audio for every bani ID in Sunder Gutka, map each verse ID to its start/end timestamp, and support multiple artist renditions. On first Play tap, the app should:
- Quickly render UI by fetching only the lightweight manifest.
- Download audio + verse-map via CDN-backed URLs in the background.
- Cache with LRU + pin policy, guided by manifest version checks.
- Stream fallback & adaptive chunked playback (HLS/DASH) until download completes.
- Lazy-load non-default artist renditions on explicit user selection.
UI MOCKUPS COMING SOON.....
1. Metadata vs. Media Endpoints
-
Manifest endpoint
-
GET /media/bani/:baniId/manifest → returns for each rendition:
{ "artist": "...", "versionHash": "...", "audioUrl": "...", "qualityLevels": [...] }
-
Extremely lightweight (≈1–2 KB), cacheable at edge.
-
Verse-map endpoint
GET /media/bani/:baniId/verses?artist=…&version=… → ordered [ { verseId, startMs, endMs } ] JSON.
-
Audio streaming
- HLS/DASH playlist URLs via CDN for adaptive streaming until local download finishes.
2. CDN & Edge Caching
- Front both manifest and media files behind a global CDN.
- Pre-warm “hot” banis via analytics.
- Enable HTTP/2/3 + gzip.
3. Client-Side Architecture
-
UI flow:
-
On opening a Bani screen, fetch only the manifest.
-
Render artist/quality selector + disabled “Play” button until manifest arrives.
-
When user taps “Play Audio”:
- Spawn background download tasks for chosen rendition’s audio & verse-map.
- Immediately start streaming playback from CDN (HLS/DASH) while download proceeds.
- Upon download completion, switch to local file for all subsequent plays.
-
Cache layer:
- Store paired assets (
.mp3 + verse-map JSON) under one key.
- Enforce max total size (e.g. 100 MB) with LRU eviction.
- Allow “pin” on favorites to exempt from eviction.
-
Versioning:
- Compare local
versionHash against manifest; auto-refresh if changed.
4. Multi-Artist & Quality Support
- Load only the default artist’s manifest; fetch other artists’ manifests on demand.
- Support bitrate selection (low/medium/high) before download starts.
- Seek logic by verse index (not raw time) so rendition switches stay in sync.
5. Offline & Error Handling
- Use background workers (iOS URLSession background, Android WorkManager).
- Graceful retry with exponential back-off on download failure; surface status to user.
- “Clear downloads” option removes all cached audio + verse maps.
6. Monitoring & Metrics
- Track manifest fetch vs. download counts, cache hit ratio, failure rates, storage used.
- Roll out via feature-flagged canary to 1% of users; monitor before full release.
Possible Subtasks
Backend / API / CDN
Client (iOS, Android)
Streaming & Quality
Testing & QA
Docs & Rollout
This ensures that audio assets are only fetched when needed, minimizes wasted bandwidth, and keeps the core app flow lean for users who choose to ignore audio.
Surface and cache audio for every bani ID in Sunder Gutka, map each verse ID to its start/end timestamp, and support multiple artist renditions. On first Play tap, the app should:
UI MOCKUPS COMING SOON.....
1. Metadata vs. Media Endpoints
Manifest endpoint
GET /media/bani/:baniId/manifest→ returns for each rendition:{ "artist": "...", "versionHash": "...", "audioUrl": "...", "qualityLevels": [...] }Extremely lightweight (≈1–2 KB), cacheable at edge.
Verse-map endpoint
GET /media/bani/:baniId/verses?artist=…&version=…→ ordered[ { verseId, startMs, endMs } ]JSON.Audio streaming
2. CDN & Edge Caching
3. Client-Side Architecture
UI flow:
On opening a Bani screen, fetch only the manifest.
Render artist/quality selector + disabled “Play” button until manifest arrives.
When user taps “Play Audio”:
Cache layer:
.mp3+ verse-map JSON) under one key.Versioning:
versionHashagainst manifest; auto-refresh if changed.4. Multi-Artist & Quality Support
5. Offline & Error Handling
6. Monitoring & Metrics
Possible Subtasks
/manifestand/versesendpoints in OpenAPI / Swagger. We are going to combine this with existing API that gives us audio files for sttm-web.versionHash& multi-quality URLs.Fetch only manifest on Bani screen open; render artist/quality UI.
On “Play Audio” tap:
Implement LRU + pin-to-keep cache logic with max-size enforcement.
Verse sync & highlighting by verse index; tapping a verse seeks playback.
On rendition switch: compare verse indices, fetch verse-map if needed, seek.
Expose “Clear all downloads” in Settings.
Publish API docs with manifest/verses schemas.
Update client-SDK README for audio feature.
Draft release notes emphasizing:
More marketing level updates coming soon
This ensures that audio assets are only fetched when needed, minimizes wasted bandwidth, and keeps the core app flow lean for users who choose to ignore audio.