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
- 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.
- Search & Metadata -
dart_ytmusic_apihandles search queries. It returns song metadata - title, artist, album art, duration, and most importantly, the video ID. - Extracting Audio Streams -
youtube_explode_darttakes that video ID and extracts the raw audio stream URL. It parses the YouTube player response to get the adaptive audio format (usuallyopusorm4a). - Playback -
media_kithandles the actual audio rendering. It's lightweight, supports gapless playback, and works reliably across Android and Windows. - Offline Downloads - When a user taps download, the audio stream is fetched via
dioand written to local storage usingpath_provider.hiveindexes 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 )
Comments
No comments yet. Start the discussion.