Giter Club home page Giter Club logo

node-radio-server's Introduction

Node Radio Server

Want to listen along to your music with friends but don't want to subscribe to a certain brand-name music service?

This is a simple NodeJS app that allows you to host a server people can connect to and all have the same music playing at the same time.

Windows Users

This HAS NOT BEEN TESTED on Windows. It should work as long as you modify the configuration file correctly, but if you encounter issues, please make an issue on the GitHub repository so it can be fixed.

DRM

Before you ask, DRM-restricted content cannot be played. Buy your music in a non-encrypted form.

Setup

  1. Clone the repo: git clone https://github.com/alexanderepolite/node-radio-server.git.
  2. Install dependencies: cd node-radio-server and npm i.
  3. Compile: tsc (if you don't have this command, run npm i -g typescript to install it).
  4. Modify the config.json file to your liking. Make sure it points to your music directory.
  5. Start the server with node dist/index.js, optionally host it using pm2.

Interacting

You can use one of the following commands in the terminal:

  • skip: skip the current song for all clients
  • stats: statistics
  • client-info: get a list of all ip addresses connected

You can also use tab to autofill.

Using

Once the server has started, it will choose random songs to play.

It will give you a list of IP addresses you can use to connect to the server. Usually, it will not list your public IP address, so you will have to get that and port forward if you want other people to connect to your computer.

Non-WS Music

How I initially designed this wasn't great. You can use the WebSocket (default) to send the entire audio file, or use an external HTTP(S) server to tell users where to get files. That, however, requires some additional setup. If you need help with this part, email me (link in my GitHub profile), it is somewhat complicated:

First, have the music you want in subdirectories, then copy the createRemoteResourceFile.js in the root of this repository to the root of the url_base in the config.json file. Note: this only searches one directory from the current one.

Second, use node createRemoteResourceFile.js to generate a songs.txt file. This will be read by the program for random song selections.

Third, have an HTTP server point to this directory that can serve the songs.txt file, as well as the other mp3 files.

Lastly, make sure you enable the URL method in the config file, else it will continue to use the WebSocket method.

WS Music

If you are going to send music through the WebSocket, please note that it sends the ENTIRE file. Please reduce the bitrate of your music if it is lagging or starting a few seconds in.

Questions?

Make an issue on the GitHub repository, I will try to respond quickly.

node-radio-server's People

Contributors

alexanderepolite avatar

Stargazers

Nikita avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.