Love sharing music with your peers? Try this out!
- Open Streaming music folder.
- Run command:
npm i
app.get('/stream', (req, res) => res.download('{song_path}'))
app.get('/img', (req, res) => res.download('{image_path}'))
app.get('/name', (req, res) => res.send('{Name you want to display}'))
replace {Name you want to display}, {image_path}, and {song_path} accordingly.- Run command:
node app.js
- Now open Listining Music/js/data.json file and add json object(sample object has been added) in soundtracks array {
link
:http://localhost:3000/stream
,name
:http://localhost:3000/name
,img
:http://localhost:3000/img
} - Now open index.html file in the Browser. You can now see your radio playing the song you added and with background image you had given in
app.js
file.
- Follow the same steps as above with a small change, here instead of
http://localhost:3000
we need to add the url which can be accessed from different machines.
- ngrok to the rescue!! ngrok allows you to expose a web server running on your local machine to the internet. Just tell ngrok what port your web server is listening on. After going through the installation of ngrok, run app.js file and just enter command
ngrok http 3000
. It will give an url which could be accessed from any machine. You can use free subscription of ngrok. There are other tools likeservo.net
too, but I foundngrok
most suitable. - Replace
http://localhost:3000
with url you get from following above steps. - Still wondering how it is distributed? Well you can run the application on multiple machines and every user can give audio file of there own choice saved on their local machine. Simply add all the three params(link, name, and img) of any system you want in
soundtracks
array and 🎉. You can now listen to any of the songs which your peers are streaming.
- Avdhesh Yadav
- Anshuman Verma
- ,and Me 😎
P.S. This is repository is extended version of onganku.