DEV Community

geethudinoyt ruthvik
geethudinoyt ruthvik

Posted on

How I Built a Free Music Streaming App in Flutter That Streams Millions of Songs — No Ads, No Subscription

Tags: flutter, dart, opensource, music, mobile

I was tired of paying Spotify $10/month and still getting ads on free tiers. So I built my own.

HeySongers is a free, open-source music streaming app for Android and Windows that streams from YouTube Music, supports offline downloads, and has zero ads. Here's how it works under the hood.

The Stack
Layer Technology
Frontend Flutter + Dart
Music Source dart_ytmusic_api + youtube_explode_dart
Audio Engine media_kit + audio_service for background playback
State Management provider
Local Storage hive for playlists + sqflite for offline tracks
Networking dio with caching via cached_network_image
UI shimmer for loading, phosphor_flutter for icons, google_fonts for typography
How Music Streaming Works
The core challenge was streaming audio from YouTube without any official API.

Step 1: Search & Metadata dart_ytmusic_api handles search queries. It returns song metadata — title, artist, album art, duration, and most importantly, the video ID.

Step 2: Extracting Audio Streams youtube_explode_dart takes that video ID and extracts the raw audio stream URL. It parses the YouTube player response to get the adaptive audio format (usually opus or m4a).

Step 3: Playback media_kit handles the actual audio rendering. It's lightweight, supports gapless playback, and works reliably across Android and Windows.

Step 4: Offline Downloads When a user taps download, the audio stream is fetched via dio and written to local storage using path_provider. hive indexes the downloaded files so the app can serve them instantly in offline mode.

Background Playback (The Hard Part)
Mobile apps that stop playing when you switch apps are annoying. Flutter's audio_service makes this work by running a headless isolate that survives app suspension. The audio controls (play/pause/seek) sync with the Android notification shade and Windows taskbar via platform channels.

The UI
I wanted it to feel premium despite being free. Dark theme by default with an optional light theme. shimmer loading skeletons make searches feel instant. Album art loads lazily via cached_network_image so scrolling through playlists is smooth.

Biggest Challenge
The YouTube streaming endpoints change frequently. youtube_explode_dart handles most of it, but I had to add retry logic and fallback formats because not all videos serve the same audio codecs. Some return opus, some m4a, and the extraction logic needs to handle both.

What's Next
AI-powered recommendations
Lyrics sync
Equalizer
iOS & Linux support
Try It
HeySongers is 100% open source. No premium tier, no ads, no tracking. Just music.

⭐ Star on GitHub: 📥 Download:

Built with ❤️ by Ruthvik Pedapondara (@geethudinoyt)

Top comments (0)