0.4.4 • Published 2 years ago

stupid-player v0.4.4

Weekly downloads
6
License
MIT
Repository
github
Last release
2 years ago

stupid-player

It's middleware for simple create player in node.js project.

You can play any readable stream with mp3 content. But you can create readable stream for http-link, file path and magnet URI with internal method.

Using

/** CREATE */
const StupidPlayer = require('stupid-player').StupidPlayer;

const URL = 'https://free.music/abc.mp3';
const PATH = '/home/noname/music/abc.mp3';
const MAGNET = 'magnet:?xt=urn:btih:225e65b5fada79cc4e28c547f769e25cf7440f7e';

const player = new StupidPlayer();

player.on(player.EVENT_PLAY, callback);
player.on(player.EVENT_STOP, callback);
player.on(player.EVENT_ERROR, callback);

(async () => {
    const readStream = await StupidPlayer.getReadStream(URL || PATH || MAGNET);

    await player.play(readStream);

    // Some code...
  
    /** CHANGE VOLUME */
    const volume = 50;// 0..100

    await player.setVolume(volume)
    const currentVolume = player.getVolume();
    console.log(currentVolume);

    await player.stop();
})()

Building

For linux:

sudo apt-get install make gcc libasound2-dev libmp3lame-dev libmpg123-dev

For windows:

You must have installed python.

0.4.4

2 years ago

0.4.3

3 years ago

0.4.2

3 years ago

0.4.1

3 years ago

0.4.0

3 years ago

0.3.4

3 years ago

0.3.3

3 years ago

0.3.2

6 years ago

0.3.1

7 years ago

0.3.0

8 years ago

0.1.0

9 years ago

0.0.6

9 years ago