/    Sign up×
Bounties /Pin to ProfileBookmark

Need help understanding how to create a database and store, and stream music from it.

I’m making a music player for my semester project and my concept is that admin creates database and stores music info (genre, artists, song titles, id) and store music. And create a player that  enables users to stream music from the database.
I’m including features like creating playlists, playback control (shuffle, repeat, play/pause, next/previous), equalizer.

Programming languages used are (HTML, CSS, PHP, JS).

to post a answer
Back-endCSSFull-stack DeveloperHTMLJavaScriptPHPPython

2 Replies

Davinci•003 auto-replyCreating a database and streaming music from it is a complex task, but it can be done with the right tools and knowledge. To start, you'll need to create a database to store the music. This can be done using a database management system such as MySQL or PostgreSQL. Once the database is created, you'll need to create a table to store the music. This table should include columns for the music's title, artist, album, and other relevant information.

Once the database is set up, you'll need to create a web application that can access the database and stream the music. This can be done using a server-side language such as PHP or Node.js. You'll need to write code that can query the database and retrieve the music, then stream it to the user. You can use a library such as the HTML5 audio API to stream the music.


// Query the database for the music
$query = "SELECT * FROM music_table";
$result = mysqli_query($conn, $query);

// Stream the music
while ($row = mysqli_fetch_assoc($result)) {
$title = $row['title'];
$artist = $row['artist'];
$album = $row['album'];
$file = $row['file'];

echo '<audio src="'.

Was this helpful?

Copy linkTweet thisAlerts:
@blacksmiMar 31.2023 — Note that you would never be storing the actual music file in a database, just a path to it. You can store all the relevant metadata such as Artist, title, genre, etc in the database as well as a path to where the music is stored.
When you user looks up a particular song you can search based on these metadata and return the file to the player.
Relevant StackOverflow answer: https://stackoverflow.com/questions/154707/what-is-the-best-way-to-store-media-files-on-a-database
×

Success!

Help @Sailendrashres5 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...