JioSaavn streaming gives VIVI Music access to an alternative audio source for tracks that are available on the JioSaavn catalogue. When a match is found, VIVI can serve audio at up to 320 kbps — often higher fidelity than a standard YouTube Music stream. YouTube Music remains the primary and fallback source; JioSaavn is only used when a confident track match is located.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/vivizzz007/vivi-music/llms.txt
Use this file to discover all available pages before exploring further.
JioSaavn streams are only substituted when
SaavnService finds a matching track. If no match is found, or if the JioSaavn request times out (6 s request / 4 s connect), VIVI falls back to the YouTube Music stream transparently with no interruption to playback.Enabling JioSaavn streaming
Open JioSaavn settings
Navigate to Settings → Player → JioSaavn (or Settings → JioSaavn depending on your build). The screen is implemented in
JioSettings.kt.Toggle streaming on
Tap the pill-shaped Enable JioSaavn Streaming toggle at the top of the screen. The toggle is stored in
EnableSaavnStreamingKey. When enabled, the card changes colour from the surface variant to the primary container to signal that the feature is active.Audio quality options
TheSaavnAudioQuality enum defines three tiers, each mapping directly to a JioSaavn CDN bitrate:
High — 320 kbps
QUALITY_320 — the highest quality tier. Maps to the 320kbps download URL variant. Recommended for wired headphones or Wi-Fi listening.Medium — 160 kbps
QUALITY_160 — a balanced option. Maps to the 160kbps download URL variant. Good for mobile data.Low — 96 kbps
QUALITY_96 — the most data-efficient option. Maps to the 96kbps download URL variant. Suitable for constrained connections.SaavnAudioQualityKey. If the exact requested quality is not present in the CDN response, SaavnService.selectBestUrl falls back first to 320 kbps, then to the highest quality URL available.
How the JioSaavn module works
Thejiosaavn/ Gradle module exposes a single SaavnService Kotlin object that handles all communication with the JioSaavn public API.
Search and stream resolution
Search and stream resolution
When VIVI needs a stream URL for a track it calls
SaavnService.searchSongs(query), which sends a search.getResults request with ctx=android (this context yields better 320 kbps access than the default web context). Up to 10 candidates are returned and scored for the best match.Once a candidate is selected, SaavnService.getBestStreamUrl(saavnSongId, quality) calls song.getDetails to retrieve the full RawSongItem including the encryptedMediaUrl field.URL decryption
URL decryption
JioSaavn CDN links are delivered in an encrypted form.
SaavnService decrypts them locally on the device using DES-ECB with the standard 8-byte key, then constructs three quality-variant URLs (_96, _160, _320) by replacing the bitrate suffix in the decrypted path. No decryption keys or stream URLs are ever sent to external servers.Pro-Only track detection
Pro-Only track detection
Each
RawSongItem carries a rights object. When rights.code == "1" or the reason string contains “Pro Only”, the track is flagged isProOnly = true and VIVI skips the JioSaavn stream, falling back to YouTube Music automatically.Timeouts and fallback
Timeouts and fallback
SaavnService is configured with short timeouts (6 s request, 4 s connect, 6 s socket) so that a slow or unavailable JioSaavn response never delays playback. If any step fails — network error, no search results, decryption failure, or Pro-Only gating — VIVI silently falls back to the YouTube Music source.Attribution
VIVI’s JioSaavn integration — including theSaavnService search, DES-ECB stream decryption, and quality-selection logic — is an original contribution developed for VIVI Music. If you copy, adapt, or reuse this code in another application, the following attribution rules from rules.md apply:
- Repository documentation and source headers must state that the JioSaavn streaming, search, or decryption logic was obtained from Vivi Music.
- In-app UI (e.g., the stream quality or audio source settings screen) must clearly label the source as
JioSaavn (via vivimusic). - Because VIVI Music is licensed under GPL-3.0, any project that reuses this code must also be fully open-sourced under GPL-3.0. Reuse in closed-source or proprietary applications is not permitted.