All Projects → ch1ller0 → fridgefm-radio-core

ch1ller0 / fridgefm-radio-core

Licence: MIT license
Simple lightweight package for creating your own radio station via NodeJS heavily inspired by Shoutcast and Icecast.

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to fridgefm-radio-core

goicy
AAC and MPEG (MP1, MP2, MP3) Icecast/Shoutcast source client written in Go
Stars: ✭ 58 (+81.25%)
Mutual labels:  mp3, icecast, shoutcast
jsCast
📻 An Audio Streaming Application written in JavaScript
Stars: ✭ 23 (-28.12%)
Mutual labels:  radio, stream, icecast
Audioplayer
Audio Player for Nextcloud and ownCloud
Stars: ✭ 179 (+459.38%)
Mutual labels:  stream, mp3
Odio
odio is now Strimio!
Stars: ✭ 262 (+718.75%)
Mutual labels:  radio, stream
create-music-stream
Creates a PCM 16 bit Little Endian Stream from a mp3 file or youtube video
Stars: ✭ 21 (-34.37%)
Mutual labels:  stream, mp3
nowplaying
A lightweight PHP adapter for viewing the current now playing data in Icecast and SHOUTcast 1/2. A part of the AzuraCast software suite.
Stars: ✭ 20 (-37.5%)
Mutual labels:  icecast, shoutcast
Jiosaavnapi
An unofficial API for JioSaavn written in Python 3
Stars: ✭ 123 (+284.38%)
Mutual labels:  stream, mp3
sox-stream
📣 A stream-friendly wrapper around SoX
Stars: ✭ 50 (+56.25%)
Mutual labels:  stream, mp3
Swyh
Stream the sound from your PC to an UPnP/DLNA device
Stars: ✭ 383 (+1096.88%)
Mutual labels:  stream, mp3
player-shoutcast-html5
Responsive HMTL5 Web Player for SHOUTCast and Icecast streamings with cover art and lyrics
Stars: ✭ 71 (+121.88%)
Mutual labels:  icecast, shoutcast
icecast-parser
Node.js module for getting and parsing metadata from SHOUTcast/Icecast radio streams
Stars: ✭ 66 (+106.25%)
Mutual labels:  icecast, shoutcast
custer
macOS streaming radio in your menu bar
Stars: ✭ 17 (-46.87%)
Mutual labels:  radio, stream
obplayer
📻 OBPlayer Streaming Automation Playout with CAP EAS Alerting
Stars: ✭ 93 (+190.63%)
Mutual labels:  icecast, shoutcast
Jamais-Vu
Audio Fingerprinting and Recognition in Python using NVidia's CUDA
Stars: ✭ 24 (-25%)
Mutual labels:  radio, mp3
radiobot
Your hobbyist radio station solution.
Stars: ✭ 17 (-46.87%)
Mutual labels:  radio, shoutcast
go-callbag
golang implementation of Callbag
Stars: ✭ 19 (-40.62%)
Mutual labels:  stream
deep-action-detection
Multi-stream CNN architectures for action detection with actor-centric filtering
Stars: ✭ 24 (-25%)
Mutual labels:  stream
wasm-streams
Bridging between web streams and Rust streams using WebAssembly
Stars: ✭ 61 (+90.63%)
Mutual labels:  stream
conti
minimalistic playout server
Stars: ✭ 23 (-28.12%)
Mutual labels:  stream
multipart-read-stream
Read a multipart stream over HTTP
Stars: ✭ 13 (-59.37%)
Mutual labels:  stream

Radio engine for NodeJS

build coverage npm GitHub node

Usage

Simple lightweight package to start your own live radio station 📻 Just drop your mp3 files and broadcast them to the world 🌎Heavily inspired by Shoutcast and Icecast.

Setup

Installation

npm i @fridgefm/radio-core --save

Server

const { Station } = require('@fridgefm/radio-core');
const station = new Station();

station.addFolder('User/Music');

server.get('/stream', (req, res) => {
  station.connectListener(req, res);
});

station.start();

Client

<audio
    controls
    type='audio/mp3'
    src='/stream'
/>

Station constructor

Creating a station is as simple as

const myAwesomeStation = new Station({
  verbose: false, // if true - enables verbose logging (great for debugging),
  responseHeaders: { // in case you want custom response headers for your endpoint
    'icy-genre': 'jazz'
  }
})

Station methods

connectListener connects real users to your station, this is the only method that should be exposed to listeners
response argument is required

station.connectListener(request, response, callback);

addFolder adds track within a folder to the playlist

station.addFolder('User/Music');

start starts broadcasting

station.start();

next instantly switches track to the next one

station.next();

getPlaylist just returns you the entire playlist

station.getPlaylist();

reorderPlaylist lets you manipulate the entire playlist via passed callback

const myShuffleMethod = (list) => list
  // doubles the list (making it twice as long)
  .concat(list)
  // filters out the specific track
  .filter(track => track.fsStats.name !== 'Artist - Track'); 

station.reorderPlaylist(myShuffleMethod);

There are also some built-in shuffle methods

const { SHUFFLE_METHODS } = require('@fridgefm/radio-core')

// This one randomly shuffles the playlist (keeping the length the same)
station.reorderPlaylist(SHUFFLE_METHODS.randomShuffle());

// This one moves the track on the 1st position and moves it to the 2nd position 
station.reorderPlaylist(SHUFFLE_METHODS.rearrange({ from: 1, to: 2 }));

on lets you make a subscription to station events (see below)

Station events

Station emits several events - they are available via

const { PUBLIC_EVENTS } = require('@fridgefm/radio-core')

NEXT_TRACK

event fires when track changes
useful for getting to know when exactly the track changed and what track that is

station.on(PUBLIC_EVENTS.NEXT_TRACK, (track) => {
  const result = await track.getMetaAsync();
  console.log(result)
})

START

Event fires on station start

station.on(PUBLIC_EVENTS.START, () => { console.log('Station started') });

RESTART

Event fires on station restart (when playlist is drained and new one is created)
it might be a nice time to shuffle your playlist for example

station.on(PUBLIC_EVENTS.RESTART, () => { /* do something*/ });

ERROR

Event fires when there is some error. You should add this handler - otherwise any error will be treated as unhandled (causing process.exit depending on Node version)

station.on(PUBLIC_EVENTS.ERROR, (e) => { handleError(e) });

or just go to examples

Development

yarn dev

or

yarn dev [path/to/your_mp3tracks]
# in this case it would take a little more time, just wait

Demo

Sandbox is available here on Codesandbox
Fully working demo is available on FridgeFM

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].