JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 9
  • Score
    100M100P100Q44707F
  • License MIT

Package Exports

  • stupid-player

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (stupid-player) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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.