A music streaming platform in Bubble uses Data Types for tracks, albums, artists, and playlists, with audio playback handled by an HTML5 audio element or an audio player plugin. You upload audio files, build browsing and search interfaces, create playlist management, implement playback controls with a persistent player bar, and let users build personal libraries. This tutorial covers the core streaming platform features.
Overview: Music Streaming Platform in Bubble
This tutorial guides you through building a music platform with audio playback, library browsing, playlist management, and a persistent player.
Prerequisites
- A Bubble app with user authentication
- Audio files (MP3) hosted or uploaded to Bubble
- Understanding of custom states and HTML elements
Step-by-step guide
Create the music data model
Create the music data model
Create 'Artist' with: name, bio, image, genre. Create 'Album' with: title, artist, cover_image, release_date, genre. Create 'Track' with: title, album, artist, audio_file (file), duration_seconds (number), track_number (number), play_count (number). Create 'Playlist' with: name, creator (User), tracks (list of Tracks), is_public (yes/no), cover_image. Add to User: 'library_tracks' (list of Tracks), 'library_albums' (list of Albums).
Expected result: Data Types for artists, albums, tracks, and playlists with user library fields.
Build the music browsing interface
Build the music browsing interface
Create a home page with sections: Featured albums (curated), New Releases (sorted by release_date), Top Tracks (sorted by play_count), and Browse by Genre (category buttons). Each album card shows cover image, title, and artist. Clicking an album opens a detail page showing the track list in a Repeating Group with track number, title, duration, and a play button. Add a search bar that searches across tracks, albums, and artists.
Expected result: Users can browse music by featured content, new releases, popularity, and genre with search.
Implement audio playback with a persistent player
Implement audio playback with a persistent player
Add a Floating Group at the bottom of every page (put it in a reusable element) for the player bar. Inside, add an HTML element with an HTML5 audio element. Use custom states on the reusable element: 'now_playing' (Track), 'is_playing' (yes/no), 'playlist_queue' (list of Tracks). When a play button is clicked, set now_playing and use JavaScript to set the audio src and call play(). Add play/pause, next, previous buttons, and a progress bar.
1<audio id="audio-player" style="display:none;"></audio>2<script>3function playTrack(url) {4 var player = document.getElementById('audio-player');5 player.src = url;6 player.play();7}8function pauseTrack() {9 document.getElementById('audio-player').pause();10}11function togglePlay() {12 var player = document.getElementById('audio-player');13 if (player.paused) player.play(); else player.pause();14}15</script>Expected result: A persistent player bar at the bottom of every page plays audio with basic controls.
Build playlist creation and management
Build playlist creation and management
Create a 'My Playlists' page showing the user's playlists in a Repeating Group. Add a 'Create Playlist' button that opens a popup for name and optional cover image. On track listings, add an 'Add to Playlist' option that shows a dropdown of the user's playlists and adds the track to the selected playlist's tracks list. On the playlist detail page, show all tracks with a remove option and drag-to-reorder using a list management approach.
Expected result: Users can create playlists, add tracks from anywhere in the app, and manage playlist contents.
Create the user library (Liked songs, saved albums)
Create the user library (Liked songs, saved albums)
Add a heart/like button on every track and album card. Clicking it adds/removes the item from the user's library_tracks or library_albums list. Create a Library page with tabs: Liked Songs, Saved Albums, My Playlists. Each tab shows a Repeating Group of the user's saved items. The Liked Songs list doubles as an auto-generated playlist that can be played sequentially.
Expected result: Users can save tracks and albums to their personal library with one-click like buttons.
Track play counts and listening history
Track play counts and listening history
When a track starts playing, increment its play_count field (Make changes to Thing). Create a 'ListenHistory' Data Type with: user, track, played_at (date). Create a record each time a track plays. Use this data for: Recently Played section on the home page, personalized recommendations (most played genres/artists), and listening statistics on the user's profile.
Expected result: Play counts update in real time, and users see their listening history and personalized recommendations.
Complete working example
1MUSIC STREAMING — WORKFLOW SUMMARY2=====================================34DATA TYPES:5 Artist: name, bio, image, genre6 Album: title, artist, cover, release_date7 Track: title, album, artist, audio_file, duration, play_count8 Playlist: name, creator, tracks (list), is_public9 ListenHistory: user, track, played_at1011PLAYER BAR (reusable Floating Group):12 HTML5 audio element (hidden)13 States: now_playing (Track), is_playing, queue (list)14 Controls: play/pause, next, previous, progress15 JavaScript: playTrack(url), pauseTrack(), togglePlay()1617PLAYBACK:18 Click play → set now_playing state19 JavaScript → set audio src, play()20 Increment play_count21 Create ListenHistory record2223PLAYLISTS:24 Create → new Playlist25 Add track → add to playlist's tracks list26 Remove → remove from list2728LIBRARY:29 Like track → add to user's library_tracks30 Save album → add to user's library_albums31 Toggle: add if not in list, remove if in listCommon mistakes when building a Music Streaming Platform in Bubble
Why it's a problem: Reloading the audio player on page navigation, interrupting playback
How to avoid: Place the audio player in a reusable Floating Group that persists across page navigation
Why it's a problem: Storing audio files without considering bandwidth and storage costs
How to avoid: Use an external CDN or streaming service for audio hosting, not Bubble's built-in file storage, for large catalogs
Why it's a problem: Not handling the 'ended' audio event for auto-play next track
How to avoid: Add a JavaScript event listener for the audio 'ended' event that triggers playing the next track in the queue
Best practices
- Use a persistent Floating Group for the player bar across all pages
- Store large audio catalogs on external CDN (S3, Cloudflare R2) instead of Bubble storage
- Handle the audio 'ended' event for seamless next-track playback
- Track play counts for popularity-based recommendations
- Use list operations (add/remove) for playlist and library management
- Implement a queue system so users can add tracks to play next
- Add keyboard shortcuts (space for play/pause) via JavaScript
Still stuck?
Copy one of these prompts to get a personalized, step-by-step explanation.
I want to build a music streaming app in Bubble.io with track browsing, playlists, a persistent audio player, and a user library. What Data Types and player implementation do I need?
Build a music streaming platform. Create Artist, Album, Track, and Playlist data types. Add a persistent player bar with play/pause/next controls using HTML5 audio. Let users create playlists and save tracks to their library.
Frequently asked questions
Can I stream audio without downloading the entire file first?
Yes. HTML5 audio supports progressive streaming — playback starts before the full file downloads. For optimal streaming, host files on a CDN with byte-range request support.
How do I handle music licensing?
You need proper licenses for any copyrighted music. For a platform hosting user-uploaded content, implement content identification and takedown procedures. For royalty-free music, use licensed libraries.
Can the player continue playing when navigating between pages?
Yes, if the player is in a reusable Floating Group. Since Floating Groups persist during navigation (when using Bubble's SPA-like behavior), playback continues uninterrupted.
How do I display a waveform visualization?
Use the Web Audio API in JavaScript to analyze the audio frequency data and render it on an HTML5 canvas element inside the player bar.
Can RapidDev build a complete music or podcast platform in Bubble?
Yes. RapidDev can build audio streaming platforms with playback, playlists, subscriptions, artist dashboards, and analytics in Bubble.
Talk to an Expert
Our team has built 600+ apps. Get personalized help with your project.
Book a free consultation